Exemple #1
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            int   j      = 0;
            Map   map    = (Map)parms.target;
            float points = StorytellerUtility.DefaultThreatPointsNow(map);

            if (points > 2000)
            {
                points = 2000;
            }
            for (int i = 0; i < 1 + (points / 200); i++)
            {
                if (TryFindRandomAnimal(map, out Pawn animal))
                {
                    j++;
                    IncidentWorker_AnimalInsanityMass.DriveInsane(animal);
                }

                if (Rand.Range(0, 7) == 0)
                {
                    break;
                }
            }

            if (j == 0)
            {
                return(false);
            }
            Find.LetterStack.ReceiveLetter("LetterLabelColoniesAnimalRampage".Translate().CapitalizeFirst(), "LetterColoniesAnimalRampage".Translate(), LetterDefOf.ThreatSmall);
            Find.TickManager.slower.SignalForceNormalSpeedShort();
            return(true);
        }
        public override bool IsPossible()
        {
            worker     = new IncidentWorker_AnimalInsanityMass();
            worker.def = IncidentDef.Named("AnimalInsanityMass");

            parms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.ThreatBig, target);

            return(worker.CanFireNow(parms));
        }