public string DebugString()
 {
     if (Time.frameCount % 60 == 0)
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.AppendLine("Storyteller : " + this.def.label);
         stringBuilder.AppendLine("------------- Global threats data ---------------");
         stringBuilder.AppendLine("   NumRaidsEnemy: " + Find.StoryWatcher.statsRecord.numRaidsEnemy);
         stringBuilder.AppendLine("   TotalThreatPointsFactor: " + Find.StoryWatcher.watcherRampUp.TotalThreatPointsFactor.ToString("F5"));
         stringBuilder.AppendLine("      ShortTermFactor: " + Find.StoryWatcher.watcherRampUp.ShortTermFactor.ToString("F5"));
         stringBuilder.AppendLine("      LongTermFactor: " + Find.StoryWatcher.watcherRampUp.LongTermFactor.ToString("F5"));
         stringBuilder.AppendLine("   AllyAssistanceMTBMultiplier (ally): " + StorytellerUtility.AllyIncidentMTBMultiplier(false).ToString());
         stringBuilder.AppendLine("   AllyAssistanceMTBMultiplier (non-hostile): " + StorytellerUtility.AllyIncidentMTBMultiplier(true).ToString());
         stringBuilder.AppendLine();
         stringBuilder.AppendLine("-------------- Global population data --------------");
         stringBuilder.AppendLine(this.intenderPopulation.DebugReadout);
         stringBuilder.AppendLine("------------- All incident targets --------------");
         for (int i = 0; i < this.AllIncidentTargets.Count; i++)
         {
             stringBuilder.AppendLine("   " + this.AllIncidentTargets[i].ToString());
         }
         IIncidentTarget incidentTarget = Find.WorldSelector.SingleSelectedObject as IIncidentTarget;
         if (incidentTarget == null)
         {
             incidentTarget = Find.CurrentMap;
         }
         if (incidentTarget != null)
         {
             stringBuilder.AppendLine();
             stringBuilder.AppendLine("---------- Selected: " + incidentTarget + " --------");
             stringBuilder.AppendLine("   Wealth: " + incidentTarget.PlayerWealthForStoryteller.ToString("F0"));
             stringBuilder.AppendLine("   IncidentPointsRandomFactorRange: " + incidentTarget.IncidentPointsRandomFactorRange);
             stringBuilder.AppendLine("   Pawns-Humanlikes: " + (from p in incidentTarget.PlayerPawnsForStoryteller
                                                                 where p.def.race.Humanlike
                                                                 select p).Count <Pawn>());
             stringBuilder.AppendLine("   Pawns-Animals: " + (from p in incidentTarget.PlayerPawnsForStoryteller
                                                              where p.def.race.Animal
                                                              select p).Count <Pawn>());
             Map map = incidentTarget as Map;
             if (map != null)
             {
                 stringBuilder.AppendLine("   StoryDanger: " + map.dangerWatcher.DangerRating);
                 stringBuilder.AppendLine("   FireDanger: " + map.fireWatcher.FireDanger.ToString("F2"));
                 stringBuilder.AppendLine("   DaysSinceSeriousDamage: " + map.damageWatcher.DaysSinceSeriousDamage.ToString("F1"));
                 stringBuilder.AppendLine("   LastThreatBigQueueTick: " + map.storyState.LastThreatBigTick.ToStringTicksToPeriod());
             }
             stringBuilder.AppendLine("   Current points (ignoring early raid factors): " + StorytellerUtility.DefaultThreatPointsNow(incidentTarget).ToString("F0"));
             stringBuilder.AppendLine("   Current points for specific IncidentMakers:");
             for (int j = 0; j < this.storytellerComps.Count; j++)
             {
                 IncidentParms incidentParms = this.storytellerComps[j].GenerateParms(IncidentCategoryDefOf.ThreatBig, incidentTarget);
                 stringBuilder.AppendLine("      " + this.storytellerComps[j].GetType().ToString().Substring(23) + ": " + incidentParms.points.ToString("F0"));
             }
         }
         this.debugStringCached = stringBuilder.ToString();
     }
     return(this.debugStringCached);
 }
        public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
        {
            float mtb = this.Props.baseMtbDays * StorytellerUtility.AllyIncidentMTBMultiplier(true);

            if (mtb < 0f)
            {
                yield break;
            }
            if (Rand.MTBEventOccurs(mtb, 60000f, 1000f))
            {
                IncidentDef incDef;
                if (this.TryChooseIncident(target, out incDef))
                {
                    yield return(new FiringIncident(incDef, this, this.GenerateParms(incDef.category, target)));
                }
            }
            yield break;
        }
        public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
        {
            Map map = target as Map;

            if (map == null || map.dangerWatcher.DangerRating < StoryDanger.High)
            {
                yield break;
            }
            float mtb = this.Props.baseMtbDays * StorytellerUtility.AllyIncidentMTBMultiplier(false);

            if (mtb <= 0f || !Rand.MTBEventOccurs(mtb, 60000f, 1000f))
            {
                yield break;
            }
            IncidentDef incident;

            if (!base.UsableIncidentsInCategory(IncidentCategoryDefOf.AllyAssistance, target).TryRandomElementByWeight((IncidentDef d) => d.baseChance, out incident))
            {
                yield break;
            }
            yield return(new FiringIncident(incident, this, this.GenerateParms(incident.category, target)));

            yield break;
        }