public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target) { if (!(target is World)) { List <IncidentDef> allIncidents = DefDatabase <IncidentDef> .AllDefsListForReading; int i = 0; IncidentDef inc; IncidentParms parms; while (true) { if (i >= allIncidents.Count) { yield break; } inc = allIncidents[i]; if (inc.category == Props.category) { _003CMakeIntervalIncidents_003Ec__Iterator0 _003CMakeIntervalIncidents_003Ec__Iterator = (_003CMakeIntervalIncidents_003Ec__Iterator0) /*Error near IL_0095: stateMachine*/; BiomeDef biome = Find.WorldGrid[target.Tile].biome; if (inc.mtbDaysByBiome != null) { MTBByBiome entry = inc.mtbDaysByBiome.Find((MTBByBiome x) => x.biome == biome); if (entry != null) { float mtb = entry.mtbDays; if (Props.applyCaravanVisibility) { Caravan caravan = target as Caravan; if (caravan != null) { mtb /= caravan.Visibility; } else { Map map = target as Map; if (map != null && map.Parent.def.isTempIncidentMapOwner) { IEnumerable <Pawn> pawns = map.mapPawns.SpawnedPawnsInFaction(Faction.OfPlayer).Concat(map.mapPawns.PrisonersOfColonySpawned); mtb /= CaravanVisibilityCalculator.Visibility(pawns, caravanMovingNow: false); } } } if (Rand.MTBEventOccurs(mtb, 60000f, 1000f)) { parms = GenerateParms(inc.category, target); if (inc.Worker.CanFireNow(parms)) { break; } } } } } i++; } yield return(new FiringIncident(inc, this, parms)); /*Error: Unable to find new state assignment for yield return*/; } }
public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target) { if (Rand.MTBEventOccurs(Props.mtbDays, 60000f, 1000f)) { bool targetIsRaidBeacon = target.IncidentTargetTags().Contains(IncidentTargetTagDefOf.Map_RaidBeacon); List <IncidentCategoryDef> triedCategories = new List <IncidentCategoryDef>(); IncidentParms parms; IncidentDef incDef; while (true) { _003CMakeIntervalIncidents_003Ec__Iterator0 _003CMakeIntervalIncidents_003Ec__Iterator = (_003CMakeIntervalIncidents_003Ec__Iterator0) /*Error near IL_007c: stateMachine*/; IncidentCategoryDef category = ChooseRandomCategory(target, triedCategories); parms = GenerateParms(category, target); IEnumerable <IncidentDef> options = from d in UsableIncidentsInCategory(category, target) where !d.NeedsParmsPoints || parms.points >= d.minThreatPoints select d; if (options.TryRandomElementByWeight(base.IncidentChanceFinal, out incDef)) { break; } triedCategories.Add(category); if (triedCategories.Count >= Props.categoryWeights.Count) { yield break; } } if (!Props.skipThreatBigIfRaidBeacon || !targetIsRaidBeacon || incDef.category != IncidentCategoryDefOf.ThreatBig) { yield return(new FiringIncident(incDef, this, parms)); /*Error: Unable to find new state assignment for yield return*/; } } }
public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target) { _003CMakeIntervalIncidents_003Ec__Iterator0 _003CMakeIntervalIncidents_003Ec__Iterator = (_003CMakeIntervalIncidents_003Ec__Iterator0) /*Error near IL_0032: stateMachine*/; if (DebugSettings.enableRandomDiseases && target.Tile != -1) { BiomeDef biome = Find.WorldGrid[target.Tile].biome; float mtb2 = biome.diseaseMtbDays; mtb2 *= Find.Storyteller.difficulty.diseaseIntervalFactor; if (!Rand.MTBEventOccurs(mtb2, 60000f, 1000f)) { yield break; } IncidentDef inc; if (!(from d in DefDatabase <IncidentDef> .AllDefs where d.Worker.CanFireNow(target) && d.category == IncidentCategory.Disease select d).TryRandomElementByWeight <IncidentDef>((Func <IncidentDef, float>)((IncidentDef d) => biome.CommonalityOfDisease(d)), out inc)) { yield break; } yield return(new FiringIncident(inc, this, this.GenerateParms(inc.category, target))); /*Error: Unable to find new state assignment for yield return*/; } }
public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target) { if (!(target is World)) { List <IncidentDef> allIncidents = DefDatabase <IncidentDef> .AllDefsListForReading; int i = 0; IncidentDef inc; while (true) { if (i < allIncidents.Count) { inc = allIncidents[i]; if (inc.category == this.Props.category) { _003CMakeIntervalIncidents_003Ec__Iterator0 _003CMakeIntervalIncidents_003Ec__Iterator = (_003CMakeIntervalIncidents_003Ec__Iterator0) /*Error near IL_0095: stateMachine*/; BiomeDef biome = Find.WorldGrid[target.Tile].biome; if (inc.mtbDaysByBiome != null) { MTBByBiome entry = inc.mtbDaysByBiome.Find((MTBByBiome x) => x.biome == biome); if (entry != null) { float mtb = entry.mtbDays; if (this.Props.applyCaravanStealthFactor) { Caravan caravan = target as Caravan; if (caravan != null) { mtb *= CaravanIncidentUtility.CalculateCaravanStealthFactor(caravan.PawnsListForReading.Count); } else { Map map = target as Map; if (map != null && map.info.parent.def.isTempIncidentMapOwner) { int pawnCount = map.mapPawns.SpawnedPawnsInFaction(Faction.OfPlayer).Count + map.mapPawns.PrisonersOfColonySpawnedCount; mtb *= CaravanIncidentUtility.CalculateCaravanStealthFactor(pawnCount); } } } if (Rand.MTBEventOccurs(mtb, 60000f, 1000f) && inc.Worker.CanFireNow(target)) { break; } } } } i++; continue; } yield break; } yield return(new FiringIncident(inc, this, this.GenerateParms(inc.category, target))); /*Error: Unable to find new state assignment for yield return*/; } }
public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target) { _003CMakeIntervalIncidents_003Ec__Iterator0 _003CMakeIntervalIncidents_003Ec__Iterator = (_003CMakeIntervalIncidents_003Ec__Iterator0) /*Error near IL_0032: stateMachine*/; if (DebugSettings.enableRandomDiseases && target.Tile != -1) { BiomeDef biome = Find.WorldGrid[target.Tile].biome; float mtb2 = biome.diseaseMtbDays; mtb2 *= Find.Storyteller.difficulty.diseaseIntervalFactor; if (Rand.MTBEventOccurs(mtb2, 60000f, 1000f) && UsableIncidentsInCategory(Props.category, target).TryRandomElementByWeight((IncidentDef d) => biome.CommonalityOfDisease(d), out IncidentDef inc)) { yield return(new FiringIncident(inc, this, GenerateParms(inc.category, target))); /*Error: Unable to find new state assignment for yield return*/; } } }
public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target) { _003CMakeIntervalIncidents_003Ec__Iterator0 _003CMakeIntervalIncidents_003Ec__Iterator = (_003CMakeIntervalIncidents_003Ec__Iterator0) /*Error near IL_0032: stateMachine*/; if (!Rand.MTBEventOccurs(this.Props.mtbDays, 60000f, 1000f)) { yield break; } List <IncidentCategory> triedCategories = new List <IncidentCategory>(); IEnumerable <IncidentDef> options; while (true) { _003CMakeIntervalIncidents_003Ec__Iterator0 _003CMakeIntervalIncidents_003Ec__Iterator2 = (_003CMakeIntervalIncidents_003Ec__Iterator0) /*Error near IL_007f: stateMachine*/; if (triedCategories.Count < this.Props.categoryWeights.Count) { IncidentCategory category = this.DecideCategory(target, triedCategories); triedCategories.Add(category); IncidentParms parms = this.GenerateParms(category, target); options = from d in DefDatabase <IncidentDef> .AllDefs where d.category == category && d.Worker.CanFireNow(target) && (!d.NeedsParms || d.minThreatPoints <= parms.points) select d; if (options.Any()) { break; } continue; } yield break; } IncidentDef incDef; if (!options.TryRandomElementByWeight <IncidentDef>((Func <IncidentDef, float>)base.IncidentChanceFinal, out incDef)) { yield break; } yield return(new FiringIncident(incDef, this, this.GenerateParms(incDef.category, target))); /*Error: Unable to find new state assignment for yield return*/; }
public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target) { _003CMakeIntervalIncidents_003Ec__Iterator0 _003CMakeIntervalIncidents_003Ec__Iterator = (_003CMakeIntervalIncidents_003Ec__Iterator0) /*Error near IL_003e: stateMachine*/; if (target == Find.Maps.Find((Map x) => x.IsPlayerHome)) { if (this.IntervalsPassed == 150) { IncidentDef inc2 = IncidentDefOf.VisitorGroup; if (inc2.TargetAllowed(target)) { yield return(new FiringIncident(inc2, this, null) { parms = { target = target, points = (float)Rand.Range(40, 100) } }); /*Error: Unable to find new state assignment for yield return*/; } } if (this.IntervalsPassed == 204) { _003CMakeIntervalIncidents_003Ec__Iterator0 _003CMakeIntervalIncidents_003Ec__Iterator2 = (_003CMakeIntervalIncidents_003Ec__Iterator0) /*Error near IL_015f: stateMachine*/; IncidentCategory threatCategory = (IncidentCategory)((!Find.Storyteller.difficulty.allowIntroThreats) ? 1 : 2); IncidentDef incDef2; if ((from def in DefDatabase <IncidentDef> .AllDefs where def.TargetAllowed(target) && def.category == threatCategory select def).TryRandomElementByWeight <IncidentDef>((Func <IncidentDef, float>)base.IncidentChanceFinal, out incDef2)) { yield return(new FiringIncident(incDef2, this, null) { parms = StorytellerUtility.DefaultParmsNow(Find.Storyteller.def, incDef2.category, target) }); /*Error: Unable to find new state assignment for yield return*/; } } IncidentDef incDef; if (this.IntervalsPassed == 264 && (from def in DefDatabase <IncidentDef> .AllDefs where def.TargetAllowed(target) && def.category == IncidentCategory.Misc select def).TryRandomElementByWeight <IncidentDef>((Func <IncidentDef, float>)base.IncidentChanceFinal, out incDef)) { yield return(new FiringIncident(incDef, this, null) { parms = StorytellerUtility.DefaultParmsNow(Find.Storyteller.def, incDef.category, target) }); /*Error: Unable to find new state assignment for yield return*/; } if (this.IntervalsPassed != 324) { yield break; } IncidentDef inc = IncidentDefOf.RaidEnemy; if (!Find.Storyteller.difficulty.allowIntroThreats) { inc = (from def in DefDatabase <IncidentDef> .AllDefs where def.TargetAllowed(target) && def.category == IncidentCategory.Misc select def).RandomElementByWeightWithFallback(base.IncidentChanceFinal, null); } if (inc == null) { yield break; } if (!inc.TargetAllowed(target)) { yield break; } yield return(new FiringIncident(inc, this, null) { parms = this.GenerateParms(inc.category, target) }); /*Error: Unable to find new state assignment for yield return*/; } }
public override IEnumerable<FiringIncident> MakeIntervalIncidents(IIncidentTarget target) { _003CMakeIntervalIncidents_003Ec__Iterator0 _003CMakeIntervalIncidents_003Ec__Iterator = (_003CMakeIntervalIncidents_003Ec__Iterator0)/*Error near IL_003e: stateMachine*/; if (target == Find.Maps.Find((Map x) => x.IsPlayerHome)) { if (IntervalsPassed == 150) { IncidentDef inc2 = IncidentDefOf.VisitorGroup; if (inc2.TargetAllowed(target)) { yield return new FiringIncident(inc2, this) { parms = { target = target, points = (float)Rand.Range(40, 100) } }; /*Error: Unable to find new state assignment for yield return*/; } } if (IntervalsPassed == 204) { _003CMakeIntervalIncidents_003Ec__Iterator0 _003CMakeIntervalIncidents_003Ec__Iterator2 = (_003CMakeIntervalIncidents_003Ec__Iterator0)/*Error near IL_015f: stateMachine*/; IncidentCategoryDef threatCategory = (!Find.Storyteller.difficulty.allowIntroThreats) ? IncidentCategoryDefOf.Misc : IncidentCategoryDefOf.ThreatSmall; if ((from def in DefDatabase<IncidentDef>.AllDefs where def.TargetAllowed(target) && def.category == threatCategory select def).TryRandomElementByWeight(base.IncidentChanceFinal, out IncidentDef incDef2)) { yield return new FiringIncident(incDef2, this) { parms = StorytellerUtility.DefaultParmsNow(incDef2.category, target) }; /*Error: Unable to find new state assignment for yield return*/; } } if (IntervalsPassed == 264 && (from def in DefDatabase<IncidentDef>.AllDefs where def.TargetAllowed(target) && def.category == IncidentCategoryDefOf.Misc select def).TryRandomElementByWeight(base.IncidentChanceFinal, out IncidentDef incDef)) { yield return new FiringIncident(incDef, this) { parms = StorytellerUtility.DefaultParmsNow(incDef.category, target) }; /*Error: Unable to find new state assignment for yield return*/; } if (IntervalsPassed == 324) { IncidentDef inc = IncidentDefOf.RaidEnemy; if (!Find.Storyteller.difficulty.allowIntroThreats) { inc = (from def in DefDatabase<IncidentDef>.AllDefs where def.TargetAllowed(target) && def.category == IncidentCategoryDefOf.Misc select def).RandomElementByWeightWithFallback(base.IncidentChanceFinal); } if (inc != null && inc.TargetAllowed(target)) { FiringIncident fi = new FiringIncident(inc, this); fi.parms = GenerateParms(inc.category, target); fi.parms.points = 40f; fi.parms.raidForceOneIncap = true; fi.parms.raidNeverFleeIndividual = true; yield return fi; /*Error: Unable to find new state assignment for yield return*/; } } } }