예제 #1
0
        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 IncidentParms GenerateParms(IncidentCategoryDef incCat, IIncidentTarget target)
        {
            IncidentParms incidentParms = StorytellerUtility.DefaultParmsNow(incCat, target);

            incidentParms.points *= Rand.Range(0.5f, 1.5f);
            return(incidentParms);
        }
        public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
        {
            if (Rand.MTBEventOccurs(this.Props.mtbDays, 60000f, 1000f))
            {
                List <IncidentCategoryDef> triedCategories = new List <IncidentCategoryDef>();
                IEnumerable <IncidentDef>  options;
                for (;;)
                {
                    if (triedCategories.Count >= this.Props.categoryWeights.Count)
                    {
                        break;
                    }
                    IncidentCategoryDef incidentCategoryDef = this.DecideCategory(target, triedCategories);
                    triedCategories.Add(incidentCategoryDef);
                    IncidentParms parms = this.GenerateParms(incidentCategoryDef, target);
                    options = from d in base.UsableIncidentsInCategory(incidentCategoryDef, target)
                              where !d.NeedsParmsPoints || d.minThreatPoints <= parms.points
                              select d;
                    if (options.Any <IncidentDef>())
                    {
                        goto Block_3;
                    }
                }
                yield break;
Block_3:
                IncidentDef incDef;
                if (options.TryRandomElementByWeight(new Func <IncidentDef, float>(base.IncidentChanceFinal), out incDef))
                {
                    yield return(new FiringIncident(incDef, this, this.GenerateParms(incDef.category, target)));
                }
            }
            yield break;
        }
예제 #4
0
 public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
 {
     if (Rand.MTBEventOccurs(this.Props.mtbDays, 60000f, 1000f))
     {
         bool targetIsRaidBeacon = target.IncidentTargetTags().Contains(IncidentTargetTagDefOf.Map_RaidBeacon);
         List <IncidentCategoryDef> triedCategories = new List <IncidentCategoryDef>();
         IncidentDef incDef;
         for (;;)
         {
             IncidentCategoryDef       category = this.ChooseRandomCategory(target, triedCategories);
             IncidentParms             parms    = this.GenerateParms(category, target);
             IEnumerable <IncidentDef> options  = from d in base.UsableIncidentsInCategory(category, target)
                                                  where !d.NeedsParmsPoints || parms.points >= d.minThreatPoints
                                                  select d;
             if (options.TryRandomElementByWeight(new Func <IncidentDef, float>(base.IncidentChanceFinal), out incDef))
             {
                 break;
             }
             triedCategories.Add(category);
             if (triedCategories.Count >= this.Props.categoryWeights.Count)
             {
                 goto Block_6;
             }
         }
         if (!this.Props.skipThreatBigIfRaidBeacon || !targetIsRaidBeacon || incDef.category != IncidentCategoryDefOf.ThreatBig)
         {
             yield return(new FiringIncident(incDef, this, <MakeIntervalIncidents> c__AnonStorey.parms));
         }
         Block_6 :;
     }
     yield break;
 }
        public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
        {
            if (!Rand.MTBEventOccurs(Props.mtbDays, 60000f, 1000f))
            {
                yield break;
            }
            bool flag = target.IncidentTargetTags().Contains(IncidentTargetTagDefOf.Map_RaidBeacon);
            List <IncidentCategoryDef> list = new List <IncidentCategoryDef>();
            IncidentParms parms;
            IncidentDef   result;

            while (true)
            {
                IncidentCategoryDef incidentCategoryDef = ChooseRandomCategory(target, list);
                parms = GenerateParms(incidentCategoryDef, target);
                if (UsableIncidentsInCategory(incidentCategoryDef, parms).TryRandomElementByWeight(base.IncidentChanceFinal, out result))
                {
                    break;
                }
                list.Add(incidentCategoryDef);
                if (list.Count >= Props.categoryWeights.Count)
                {
                    yield break;
                }
            }
            if (!Props.skipThreatBigIfRaidBeacon || !flag || result.category != IncidentCategoryDefOf.ThreatBig)
            {
                yield return(new FiringIncident(result, this, parms));
            }
        }
예제 #6
0
 public virtual void DebugTablesIncidentChances(IncidentCategoryDef cat)
 {
     DebugTables.MakeTablesDialog(from d in DefDatabase <IncidentDef> .AllDefs
                                  where d.category == cat
                                  orderby IncidentChanceFinal(d) descending
                                  select d, new TableDataGetter <IncidentDef>("defName", (IncidentDef d) => d.defName), new TableDataGetter <IncidentDef>("baseChance", (IncidentDef d) => d.baseChance.ToString()), new TableDataGetter <IncidentDef>("AdjustedChance", (IncidentDef d) => d.Worker.AdjustedChance.ToString()), new TableDataGetter <IncidentDef>("Factor-PopCurrent", (IncidentDef d) => IncidentChanceFactor_CurrentPopulation(d).ToString()), new TableDataGetter <IncidentDef>("Factor-PopIntent", (IncidentDef d) => IncidentChanceFactor_PopulationIntent(d).ToString()), new TableDataGetter <IncidentDef>("final chance", (IncidentDef d) => IncidentChanceFinal(d).ToString()), new TableDataGetter <IncidentDef>("vismap-usable", (IncidentDef d) => (Find.CurrentMap == null) ? "-" : ((!UsableIncidentsInCategory(cat, Find.CurrentMap).Contains(d)) ? string.Empty : "V")), new TableDataGetter <IncidentDef>("world-usable", (IncidentDef d) => (!UsableIncidentsInCategory(cat, Find.World).Contains(d)) ? string.Empty : "W"), new TableDataGetter <IncidentDef>("pop-current", (IncidentDef d) => PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_Colonists.Count().ToString()), new TableDataGetter <IncidentDef>("pop-intent", (IncidentDef d) => StorytellerUtilityPopulation.PopulationIntent.ToString("F3")));
 }
예제 #7
0
        public override IncidentParms GenerateParms(IncidentCategoryDef incCat, IIncidentTarget target)
        {
            IncidentParms incidentParms = StorytellerUtility.DefaultParmsNow(incCat, target);

            incidentParms.points *= this.Props.randomPointsFactorRange.RandomInRange;
            return(incidentParms);
        }
 public override void ResolveReferences(StorytellerDef parentDef)
 {
     base.ResolveReferences(parentDef);
     if (this.threatSmallCategory == null)
     {
         this.threatSmallCategory = IncidentCategoryDefOf.ThreatSmall;
     }
     if (this.threatBigCategory == null)
     {
         this.threatBigCategory = IncidentCategoryDefOf.ThreatBig;
     }
 }
        public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
        {
            if (target != Find.Maps.Find((Map x) => x.IsPlayerHome))
            {
                yield break;
            }
            if (IntervalsPassed == 150)
            {
                IncidentDef visitorGroup = IncidentDefOf.VisitorGroup;
                if (visitorGroup.TargetAllowed(target))
                {
                    FiringIncident firingIncident = new FiringIncident(visitorGroup, this);
                    firingIncident.parms.target = target;
                    firingIncident.parms.points = Rand.Range(40, 100);
                    yield return(firingIncident);
                }
            }
            if (IntervalsPassed == 204)
            {
                IncidentCategoryDef threatCategory = (Find.Storyteller.difficultyValues.allowIntroThreats ? IncidentCategoryDefOf.ThreatSmall : IncidentCategoryDefOf.Misc);
                if (DefDatabase <IncidentDef> .AllDefs.Where((IncidentDef def) => def.TargetAllowed(target) && def.category == threatCategory).TryRandomElementByWeight(base.IncidentChanceFinal, out var result))
                {
                    FiringIncident firingIncident2 = new FiringIncident(result, this);
                    firingIncident2.parms = StorytellerUtility.DefaultParmsNow(result.category, target);
                    yield return(firingIncident2);
                }
            }
            if (IntervalsPassed == 264 && DefDatabase <IncidentDef> .AllDefs.Where((IncidentDef def) => def.TargetAllowed(target) && def.category == IncidentCategoryDefOf.Misc).TryRandomElementByWeight(base.IncidentChanceFinal, out var result2))
            {
                FiringIncident firingIncident3 = new FiringIncident(result2, this);
                firingIncident3.parms = StorytellerUtility.DefaultParmsNow(result2.category, target);
                yield return(firingIncident3);
            }
            if (IntervalsPassed != 324)
            {
                yield break;
            }
            IncidentDef incidentDef = IncidentDefOf.RaidEnemy;

            if (!Find.Storyteller.difficultyValues.allowIntroThreats)
            {
                incidentDef = DefDatabase <IncidentDef> .AllDefs.Where((IncidentDef def) => def.TargetAllowed(target) && def.category == IncidentCategoryDefOf.Misc).RandomElementByWeightWithFallback(base.IncidentChanceFinal);
            }
            if (incidentDef != null && incidentDef.TargetAllowed(target))
            {
                FiringIncident firingIncident4 = new FiringIncident(incidentDef, this);
                firingIncident4.parms                         = GenerateParms(incidentDef.category, target);
                firingIncident4.parms.points                  = 40f;
                firingIncident4.parms.raidForceOneIncap       = true;
                firingIncident4.parms.raidNeverFleeIndividual = true;
                yield return(firingIncident4);
            }
        }
예제 #10
0
        public static IncidentParms DefaultParmsNow(IncidentCategoryDef incCat, IIncidentTarget target)
        {
            if (incCat == null)
            {
                Log.Warning("Trying to get default parms for null incident category.", false);
            }
            IncidentParms incidentParms = new IncidentParms();

            incidentParms.target = target;
            if (incCat.needsParmsPoints)
            {
                incidentParms.points = StorytellerUtility.DefaultThreatPointsNow(target);
            }
            return(incidentParms);
        }
        public static IncidentParms DefaultParmsNow(IncidentCategoryDef incCat, IIncidentTarget target)
        {
            if (incCat == null)
            {
                Log.Warning("Trying to get default parms for null incident category.", false);
            }
            IncidentParms incidentParms = new IncidentParms();

            incidentParms.target = target;
            if (incCat.needsParmsPoints)
            {
                incidentParms.points = StorytellerUtility.DefaultThreatPointsNow(target);
                if (target is Map && incCat == IncidentCategoryDefOf.ThreatBig)
                {
                    switch (Find.StoryWatcher.statsRecord.numThreatBigs)
                    {
                    case 0:
                        incidentParms.points                  = 38f;
                        incidentParms.raidForceOneIncap       = true;
                        incidentParms.raidNeverFleeIndividual = true;
                        break;

                    case 1:
                        incidentParms.points *= 0.5f;
                        break;

                    case 2:
                        incidentParms.points *= 0.7f;
                        break;

                    case 3:
                        incidentParms.points *= 0.8f;
                        break;

                    case 4:
                        incidentParms.points *= 0.9f;
                        break;

                    default:
                        incidentParms.points *= 1f;
                        break;
                    }
                }
            }
            return(incidentParms);
        }
        public virtual void DebugTablesIncidentChances(IncidentCategoryDef cat)
        {
            IEnumerable <IncidentDef> dataSources = from d in DefDatabase <IncidentDef> .AllDefs
                                                    where d.category == cat
                                                    orderby this.IncidentChanceFinal(d) descending
                                                    select d;

            TableDataGetter <IncidentDef>[] array = new TableDataGetter <IncidentDef> [10];
            array[0] = new TableDataGetter <IncidentDef>("defName", (IncidentDef d) => d.defName);
            array[1] = new TableDataGetter <IncidentDef>("baseChance", (IncidentDef d) => d.baseChance.ToString());
            array[2] = new TableDataGetter <IncidentDef>("AdjustedChance", (IncidentDef d) => d.Worker.AdjustedChance.ToString());
            array[3] = new TableDataGetter <IncidentDef>("Factor-PopCurrent", (IncidentDef d) => this.IncidentChanceFactor_CurrentPopulation(d).ToString());
            array[4] = new TableDataGetter <IncidentDef>("Factor-PopIntent", (IncidentDef d) => this.IncidentChanceFactor_PopulationIntent(d).ToString());
            array[5] = new TableDataGetter <IncidentDef>("final chance", (IncidentDef d) => this.IncidentChanceFinal(d).ToString());
            array[6] = new TableDataGetter <IncidentDef>("vismap-usable", (IncidentDef d) => (Find.CurrentMap != null) ? ((!this.UsableIncidentsInCategory(cat, Find.CurrentMap).Contains(d)) ? string.Empty : "V") : "-");
            array[7] = new TableDataGetter <IncidentDef>("world-usable", (IncidentDef d) => (!this.UsableIncidentsInCategory(cat, Find.World).Contains(d)) ? string.Empty : "W");
            array[8] = new TableDataGetter <IncidentDef>("pop-current", (IncidentDef d) => PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_Colonists.Count <Pawn>().ToString());
            array[9] = new TableDataGetter <IncidentDef>("pop-intent", (IncidentDef d) => StorytellerUtilityPopulation.PopulationIntent.ToString("F3"));
            DebugTables.MakeTablesDialog <IncidentDef>(dataSources, array);
        }
예제 #13
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    if (target != Find.Maps.Find((Map x) => x.IsPlayerHome))
                    {
                        return(false);
                    }
                    if (base.IntervalsPassed == 150)
                    {
                        inc = IncidentDefOf.VisitorGroup;
                        if (inc.TargetAllowed(target))
                        {
                            FiringIncident qi = new FiringIncident(inc, this, null);
                            qi.parms.target = target;
                            qi.parms.points = (float)Rand.Range(40, 100);
                            this.$current   = qi;
                            if (!this.$disposing)
                            {
                                this.$PC = 1;
                            }
                            return(true);
                        }
                    }
                    break;

                case 1u:
                    break;

                case 2u:
                    goto IL_23E;

                case 3u:
                    goto IL_2ED;

                case 4u:
                    goto IL_41A;

                default:
                    return(false);
                }
                if (base.IntervalsPassed == 204)
                {
                    IncidentCategoryDef threatCategory = (!Find.Storyteller.difficulty.allowIntroThreats) ? IncidentCategoryDefOf.Misc : IncidentCategoryDefOf.ThreatSmall;
                    if ((from def in DefDatabase <IncidentDef> .AllDefs
                         where def.TargetAllowed(< MakeIntervalIncidents > c__AnonStorey.target) && def.category == threatCategory
                         select def).TryRandomElementByWeight(new Func <IncidentDef, float>(base.IncidentChanceFinal), out incDef))
                    {
                        FiringIncident qi2 = new FiringIncident(incDef, this, null);
                        qi2.parms     = StorytellerUtility.DefaultParmsNow(incDef.category, <MakeIntervalIncidents> c__AnonStorey.target);
                        this.$current = qi2;
                        if (!this.$disposing)
                        {
                            this.$PC = 2;
                        }
                        return(true);
                    }
                }
IL_23E:
                if (base.IntervalsPassed == 264 && (from def in DefDatabase <IncidentDef> .AllDefs
                                                    where def.TargetAllowed(< MakeIntervalIncidents > c__AnonStorey.target) && def.category == IncidentCategoryDefOf.Misc
                                                    select def).TryRandomElementByWeight(new Func <IncidentDef, float>(base.IncidentChanceFinal), out incDef2))
                {
                    FiringIncident qi3 = new FiringIncident(incDef2, this, null);
                    qi3.parms     = StorytellerUtility.DefaultParmsNow(incDef2.category, <MakeIntervalIncidents> c__AnonStorey.target);
                    this.$current = qi3;
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);
                }
IL_2ED:
                if (base.IntervalsPassed == 324)
                {
                    inc2 = IncidentDefOf.RaidEnemy;
                    if (!Find.Storyteller.difficulty.allowIntroThreats)
                    {
                        inc2 = (from def in DefDatabase <IncidentDef> .AllDefs
                                where def.TargetAllowed(< MakeIntervalIncidents > c__AnonStorey.target) && def.category == IncidentCategoryDefOf.Misc
                                select def).RandomElementByWeightWithFallback(new Func <IncidentDef, float>(base.IncidentChanceFinal), null);
                    }
                    if (inc2 != null && inc2.TargetAllowed(< MakeIntervalIncidents > c__AnonStorey.target))
                    {
                        FiringIncident fi = new FiringIncident(inc2, this, null);
                        fi.parms                         = this.GenerateParms(inc2.category, <MakeIntervalIncidents> c__AnonStorey.target);
                        fi.parms.points                  = 40f;
                        fi.parms.raidForceOneIncap       = true;
                        fi.parms.raidNeverFleeIndividual = true;
                        this.$current                    = fi;
                        if (!this.$disposing)
                        {
                            this.$PC = 4;
                        }
                        return(true);
                    }
                }
IL_41A:
                this.$PC = -1;
                return(false);
            }
예제 #14
0
		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*/;
					}
				}
			}
		}
 protected virtual IEnumerable <IncidentDef> UsableIncidentsInCategory(IncidentCategoryDef cat, Func <IncidentDef, IncidentParms> parmsGetter)
 {
     return(from x in DefDatabase <IncidentDef> .AllDefsListForReading
            where x.category == cat && x.Worker.CanFireNow(parmsGetter(x), false)
            select x);
 }
 protected IEnumerable <IncidentDef> UsableIncidentsInCategory(IncidentCategoryDef cat, IncidentParms parms)
 {
     return(this.UsableIncidentsInCategory(cat, (IncidentDef x) => parms));
 }
 protected IEnumerable <IncidentDef> UsableIncidentsInCategory(IncidentCategoryDef cat, IIncidentTarget target)
 {
     return(this.UsableIncidentsInCategory(cat, (IncidentDef x) => this.GenerateParms(cat, target)));
 }
 public virtual IncidentParms GenerateParms(IncidentCategoryDef incCat, IIncidentTarget target)
 {
     return(StorytellerUtility.DefaultParmsNow(incCat, target));
 }
예제 #19
0
        public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
        {
            if (target != Find.Maps.Find((Map x) => x.IsPlayerHome))
            {
                yield break;
            }
            if (this.IntervalsPassed == 150)
            {
                IncidentDef inc = IncidentDefOf.VisitorGroup;
                if (inc.TargetAllowed(target))
                {
                    yield return(new FiringIncident(inc, this, null)
                    {
                        parms =
                        {
                            target = target,
                            points = (float)Rand.Range(40, 100)
                        }
                    });
                }
            }
            if (this.IntervalsPassed == 204)
            {
                IncidentCategoryDef threatCategory = (!Find.Storyteller.difficulty.allowIntroThreats) ? IncidentCategoryDefOf.Misc : IncidentCategoryDefOf.ThreatSmall;
                IncidentDef         incDef;
                if ((from def in DefDatabase <IncidentDef> .AllDefs
                     where def.TargetAllowed(target) && def.category == threatCategory
                     select def).TryRandomElementByWeight(new Func <IncidentDef, float>(base.IncidentChanceFinal), out incDef))
                {
                    yield return(new FiringIncident(incDef, this, null)
                    {
                        parms = StorytellerUtility.DefaultParmsNow(incDef.category, target)
                    });
                }
            }
            IncidentDef incDef2;

            if (this.IntervalsPassed == 264 && (from def in DefDatabase <IncidentDef> .AllDefs
                                                where def.TargetAllowed(target) && def.category == IncidentCategoryDefOf.Misc
                                                select def).TryRandomElementByWeight(new Func <IncidentDef, float>(base.IncidentChanceFinal), out incDef2))
            {
                yield return(new FiringIncident(incDef2, this, null)
                {
                    parms = StorytellerUtility.DefaultParmsNow(incDef2.category, target)
                });
            }
            if (this.IntervalsPassed == 324)
            {
                IncidentDef inc2 = IncidentDefOf.RaidEnemy;
                if (!Find.Storyteller.difficulty.allowIntroThreats)
                {
                    inc2 = (from def in DefDatabase <IncidentDef> .AllDefs
                            where def.TargetAllowed(target) && def.category == IncidentCategoryDefOf.Misc
                            select def).RandomElementByWeightWithFallback(new Func <IncidentDef, float>(base.IncidentChanceFinal), null);
                }
                if (inc2 != null && inc2.TargetAllowed(target))
                {
                    yield return(new FiringIncident(inc2, this, null)
                    {
                        parms = this.GenerateParms(inc2.category, target),
                        parms =
                        {
                            points                  =  40f,
                            raidForceOneIncap       = true,
                            raidNeverFleeIndividual = true
                        }
                    });
                }
            }
            yield break;
        }
예제 #20
0
 protected virtual IEnumerable <IncidentDef> UsableIncidentsInCategory(IncidentCategoryDef cat, Func <IncidentDef, IncidentParms> parmsGetter)
 {
     return(DefDatabase <IncidentDef> .AllDefsListForReading.Where((IncidentDef x) => x.category == cat && x.Worker.CanFireNow(parmsGetter(x))));
 }