public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
        {
            float mtb = this.IncidentMTBDays;

            if (mtb >= 0f)
            {
                if (Rand.MTBEventOccurs(mtb, 60000f, 1000f))
                {
                    Map map = target as Map;
                    if (map != null && map.dangerWatcher.DangerRating >= StoryDanger.High)
                    {
                        IncidentDef incident = null;
                        if (this.UsableIncidentsInCategory(IncidentCategory.AllyAssistance, target).TryRandomElementByWeight((IncidentDef d) => d.baseChance, out incident))
                        {
                            yield return(new FiringIncident(incident, this, this.GenerateParms(incident.category, target)));
                        }
                    }
                }
            }
        }
 private bool ShouldDoRefireCheckWith(IncidentDef other)
 {
     if (other.tags == null)
     {
         return(false);
     }
     if (other == this)
     {
         return(false);
     }
     for (int i = 0; i < other.tags.Count; i++)
     {
         for (int j = 0; j < this.refireCheckTags.Count; j++)
         {
             if (other.tags[i] == this.refireCheckTags[j])
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
        {
            int num = IntervalsPassed;

            if (Props.minColonistCount > 0)
            {
                if (target.StoryState.lastFireTicks.ContainsKey(Props.incident) || PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_FreeColonists.Count < Props.minColonistCount)
                {
                    yield break;
                }
                num -= target.StoryState.GetTicksFromColonistCount(Props.minColonistCount) / 1000;
            }
            if (num != Props.fireAfterDaysPassed * 60)
            {
                yield break;
            }
            if (Props.skipIfColonistHasMinTitle != null)
            {
                List <Pawn> allMapsCaravansAndTravelingTransportPods_Alive_FreeColonists = PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_FreeColonists;
                for (int i = 0; i < allMapsCaravansAndTravelingTransportPods_Alive_FreeColonists.Count; i++)
                {
                    if (allMapsCaravansAndTravelingTransportPods_Alive_FreeColonists[i].royalty != null && allMapsCaravansAndTravelingTransportPods_Alive_FreeColonists[i].royalty.AllTitlesForReading.Any() && allMapsCaravansAndTravelingTransportPods_Alive_FreeColonists[i].royalty.MainTitle().seniority >= Props.skipIfColonistHasMinTitle.seniority)
                    {
                        yield break;
                    }
                }
            }
            Map anyPlayerHomeMap = Find.AnyPlayerHomeMap;

            if (!Props.skipIfOnExtremeBiome || (anyPlayerHomeMap != null && !anyPlayerHomeMap.Biome.isExtremeBiome))
            {
                IncidentDef incident = Props.incident;
                if (incident.TargetAllowed(target))
                {
                    yield return(new FiringIncident(incident, this, GenerateParms(incident.category, target)));
                }
            }
        }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.$current = IncidentDefOf.Eclipse;
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                    this.$current = IncidentDefOf.ToxicFallout;
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);

                case 2u:
                    this.$current = IncidentDefOf.SolarFlare;
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);

                case 3u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }
Esempio n. 5
0
        public float CommonalityOfDisease(IncidentDef diseaseInc)
        {
            if (this.cachedDiseaseCommonalities == null)
            {
                this.cachedDiseaseCommonalities = new Dictionary <IncidentDef, float>();
                for (int i = 0; i < this.diseases.Count; i++)
                {
                    this.cachedDiseaseCommonalities.Add(this.diseases[i].diseaseInc, this.diseases[i].commonality);
                }
                foreach (IncidentDef incidentDef in DefDatabase <IncidentDef> .AllDefs)
                {
                    if (incidentDef.diseaseBiomeRecords != null)
                    {
                        for (int j = 0; j < incidentDef.diseaseBiomeRecords.Count; j++)
                        {
                            if (incidentDef.diseaseBiomeRecords[j].biome == this)
                            {
                                this.cachedDiseaseCommonalities.Add(incidentDef.diseaseBiomeRecords[j].diseaseInc, incidentDef.diseaseBiomeRecords[j].commonality);
                            }
                        }
                    }
                }
            }
            float num;
            float result;

            if (this.cachedDiseaseCommonalities.TryGetValue(diseaseInc, out num))
            {
                result = num;
            }
            else
            {
                result = 0f;
            }
            return(result);
        }
 private static string <DoIncidentEditInterface> m__0(IncidentDef id)
 {
     return(id.LabelCap);
 }
 public override void Randomize()
 {
     this.incident = this.RandomizableIncidents().RandomElement <IncidentDef>();
 }
 private static string <DebugTablesIncidentChances> m__5(IncidentDef d)
 {
     return(StorytellerUtilityPopulation.PopulationIntent.ToString("F3"));
 }
 internal IncidentParms <> m__0(IncidentDef x)
 {
     return(this.$this.GenerateParms(this.cat, this.target));
 }
 private static string <DebugTablesIncidentChances> m__3(IncidentDef d)
 {
     return(d.Worker.AdjustedChance.ToString());
 }
 private static string <DebugTablesIncidentChances> m__4(IncidentDef d)
 {
     return(PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_Colonists.Count <Pawn>().ToString());
 }
 private static string <DebugTablesIncidentChances> m__1(IncidentDef d)
 {
     return(d.defName);
 }
		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*/;
					}
				}
			}
		}
Esempio n. 14
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.$current = IncidentDefOf.TraderCaravanArrival;
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                    this.$current = IncidentDefOf.OrbitalTraderArrival;
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);

                case 2u:
                    this.$current = IncidentDefOf.WandererJoin;
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);

                case 3u:
                    this.$current = IncidentDefOf.Eclipse;
                    if (!this.$disposing)
                    {
                        this.$PC = 4;
                    }
                    return(true);

                case 4u:
                    this.$current = IncidentDefOf.ToxicFallout;
                    if (!this.$disposing)
                    {
                        this.$PC = 5;
                    }
                    return(true);

                case 5u:
                    this.$current = IncidentDefOf.SolarFlare;
                    if (!this.$disposing)
                    {
                        this.$PC = 6;
                    }
                    return(true);

                case 6u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }
 private static string <DebugTablesIncidentChances> m__5(IncidentDef d)
 {
     return(Find.Storyteller.intenderPopulation.PopulationIntent.ToString("F3"));
 }
Esempio n. 16
0
 public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
 {
     if (target == Find.Maps.Find((Map x) => x.IsPlayerHome))
     {
         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)
         {
             IncidentCategory threatCategory = (!Find.Storyteller.difficulty.allowIntroThreats) ? IncidentCategory.Misc : IncidentCategory.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(Find.Storyteller.def, incDef.category, target)
                 });
             }
         }
         IncidentDef incDef2;
         if (this.IntervalsPassed == 264 && (from def in DefDatabase <IncidentDef> .AllDefs
                                             where def.TargetAllowed(target) && def.category == IncidentCategory.Misc
                                             select def).TryRandomElementByWeight(new Func <IncidentDef, float>(base.IncidentChanceFinal), out incDef2))
         {
             yield return(new FiringIncident(incDef2, this, null)
             {
                 parms = StorytellerUtility.DefaultParmsNow(Find.Storyteller.def, 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 == IncidentCategory.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)
                 });
             }
         }
     }
 }
Esempio n. 17
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 (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*/;
            }
        }
 private static string <DebugLogTestFutureIncidents> m__3(IncidentDef x)
 {
     return(x.defName);
 }
Esempio n. 19
0
        private static DiaOption RequestAICoreQuest(Map map, Faction faction, Pawn negotiator)
        {
            string text = "RequestAICoreInformation".Translate(new object[]
            {
                ThingDefOf.AIPersonaCore.label,
                1500.ToString()
            });

            if (faction.PlayerGoodwill < 40)
            {
                DiaOption diaOption = new DiaOption(text);
                diaOption.Disable("NeedGoodwill".Translate(new object[]
                {
                    40.ToString("F0")
                }));
                return(diaOption);
            }
            IncidentDef   def  = IncidentDefOf.Quest_ItemStashAICore;
            bool          flag = PlayerItemAccessibilityUtility.ItemStashHas(ThingDefOf.AIPersonaCore);
            IncidentParms coreIncidentParms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.Misc, Find.World);

            coreIncidentParms.faction = faction;
            bool flag2 = def.Worker.CanFireNow(coreIncidentParms, false);

            if (flag || !flag2)
            {
                DiaOption diaOption2 = new DiaOption(text);
                diaOption2.Disable("NoKnownAICore".Translate(new object[]
                {
                    1500
                }));
                return(diaOption2);
            }
            if (FactionDialogMaker.AmountSendableSilver(map) < 1500)
            {
                DiaOption diaOption3 = new DiaOption(text);
                diaOption3.Disable("NeedSilverLaunchable".Translate(new object[]
                {
                    1500
                }));
                return(diaOption3);
            }
            DiaOption diaOption4 = new DiaOption(text);

            diaOption4.action = delegate
            {
                if (def.Worker.TryExecute(coreIncidentParms))
                {
                    TradeUtility.LaunchThingsOfType(ThingDefOf.Silver, 1500, map, null);
                }
                Current.Game.GetComponent <GameComponent_OnetimeNotification>().sendAICoreRequestReminder = false;
            };
            string text2 = "RequestAICoreInformationResult".Translate(new object[]
            {
                faction.leader.LabelIndefinite()
            }).CapitalizeFirst();

            diaOption4.link = new DiaNode(text2)
            {
                options =
                {
                    FactionDialogMaker.OKToRoot(faction, negotiator)
                }
            };
            return(diaOption4);
        }
 private static string <DebugTablesIncidentChances> m__2(IncidentDef d)
 {
     return(d.baseChance.ToString());
 }
Esempio n. 21
0
 public override void Randomize()
 {
     incident = RandomizableIncidents().RandomElement();
 }
 private static float <TryChooseIncident> m__0(IncidentDef d)
 {
     return(d.baseChance);
 }