public bool CanFireNow(IncidentParms parms, bool forced = false)
 {
     if (!parms.forced)
     {
         if (!def.TargetAllowed(parms.target))
         {
             return(false);
         }
         if (GenDate.DaysPassed < def.earliestDay)
         {
             return(false);
         }
         if (!Find.Storyteller.difficultyValues.AllowedBy(def.disabledWhen) || (def.category == IncidentCategoryDefOf.ThreatBig && !Find.Storyteller.difficultyValues.allowBigThreats))
         {
             return(false);
         }
         if (parms.points >= 0f && parms.points < def.minThreatPoints)
         {
             return(false);
         }
         if (def.allowedBiomes != null)
         {
             BiomeDef biome = Find.WorldGrid[parms.target.Tile].biome;
             if (!def.allowedBiomes.Contains(biome))
             {
                 return(false);
             }
         }
         Scenario scenario = Find.Scenario;
         for (int i = 0; i < scenario.parts.Count; i++)
         {
             ScenPart_DisableIncident scenPart_DisableIncident = scenario.parts[i] as ScenPart_DisableIncident;
             if (scenPart_DisableIncident != null && scenPart_DisableIncident.Incident == def)
             {
                 return(false);
             }
         }
         if (def.minPopulation > 0 && PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_FreeColonists.Count() < def.minPopulation)
         {
             return(false);
         }
         if (FiredTooRecently(parms.target))
         {
             return(false);
         }
         if (def.minGreatestPopulation > 0 && Find.StoryWatcher.statsRecord.greatestPopulation < def.minGreatestPopulation)
         {
             return(false);
         }
     }
     if (!CanFireNowSub(parms))
     {
         return(false);
     }
     return(true);
 }
 public bool CanFireNow(IncidentParms parms, bool forced = false)
 {
     if (!parms.forced)
     {
         if (!this.def.TargetAllowed(parms.target))
         {
             return(false);
         }
         if (GenDate.DaysPassed < this.def.earliestDay)
         {
             return(false);
         }
         if (Find.Storyteller.difficulty.difficulty < this.def.minDifficulty)
         {
             return(false);
         }
         if (this.def.allowedBiomes != null)
         {
             BiomeDef biome = Find.WorldGrid[parms.target.Tile].biome;
             if (!this.def.allowedBiomes.Contains(biome))
             {
                 return(false);
             }
         }
         Scenario scenario = Find.Scenario;
         for (int i = 0; i < scenario.parts.Count; i++)
         {
             ScenPart_DisableIncident scenPart_DisableIncident = scenario.parts[i] as ScenPart_DisableIncident;
             if (scenPart_DisableIncident != null && scenPart_DisableIncident.Incident == this.def)
             {
                 return(false);
             }
         }
         if (this.def.minPopulation > 0 && PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_FreeColonists.Count <Pawn>() < this.def.minPopulation)
         {
             return(false);
         }
         Dictionary <IncidentDef, int> lastFireTicks = parms.target.StoryState.lastFireTicks;
         int ticksGame = Find.TickManager.TicksGame;
         int num;
         if (lastFireTicks.TryGetValue(this.def, out num))
         {
             float num2 = (float)(ticksGame - num) / 60000f;
             if (num2 < this.def.minRefireDays)
             {
                 return(false);
             }
         }
         List <IncidentDef> refireCheckIncidents = this.def.RefireCheckIncidents;
         if (refireCheckIncidents != null)
         {
             for (int j = 0; j < refireCheckIncidents.Count; j++)
             {
                 if (lastFireTicks.TryGetValue(refireCheckIncidents[j], out num))
                 {
                     float num3 = (float)(ticksGame - num) / 60000f;
                     if (num3 < this.def.minRefireDays)
                     {
                         return(false);
                     }
                 }
             }
         }
         if (this.def.minGreatestPopulation > 0 && Find.StoryWatcher.statsRecord.greatestPopulation < this.def.minGreatestPopulation)
         {
             return(false);
         }
     }
     return(this.CanFireNowSub(parms));
 }
        public bool CanFireNow(IIncidentTarget target)
        {
            if (!this.def.TargetAllowed(target))
            {
                return(false);
            }
            if (GenDate.DaysPassed < this.def.earliestDay)
            {
                return(false);
            }
            if (this.def.minPopulation > 0 && PawnsFinder.AllMapsCaravansAndTravelingTransportPods_FreeColonists.Count() < this.def.minPopulation)
            {
                return(false);
            }
            if (Find.Storyteller.difficulty.difficulty < this.def.minDifficulty)
            {
                return(false);
            }
            if (this.def.allowedBiomes != null)
            {
                BiomeDef biome = Find.WorldGrid[target.Tile].biome;
                if (!this.def.allowedBiomes.Contains(biome))
                {
                    return(false);
                }
            }
            for (int i = 0; i < Find.Scenario.parts.Count; i++)
            {
                ScenPart_DisableIncident scenPart_DisableIncident = Find.Scenario.parts[i] as ScenPart_DisableIncident;
                if (scenPart_DisableIncident != null && scenPart_DisableIncident.Incident == this.def)
                {
                    return(false);
                }
            }
            Dictionary <IncidentDef, int> lastFireTicks = target.StoryState.lastFireTicks;
            int ticksGame = Find.TickManager.TicksGame;
            int num       = default(int);

            if (lastFireTicks.TryGetValue(this.def, out num))
            {
                float num2 = (float)((float)(ticksGame - num) / 60000.0);
                if (num2 < this.def.minRefireDays)
                {
                    return(false);
                }
            }
            List <IncidentDef> refireCheckIncidents = this.def.RefireCheckIncidents;

            if (refireCheckIncidents != null)
            {
                for (int j = 0; j < refireCheckIncidents.Count; j++)
                {
                    if (lastFireTicks.TryGetValue(refireCheckIncidents[j], out num))
                    {
                        float num3 = (float)((float)(ticksGame - num) / 60000.0);
                        if (num3 < this.def.minRefireDays)
                        {
                            return(false);
                        }
                    }
                }
            }
            if (!this.CanFireNowSub(target))
            {
                return(false);
            }
            return(true);
        }