protected override bool TryExecuteWorker(IncidentParms parms) { this.ResolveArrivalPoints(parms); Map map = (Map)parms.target; PawnKindDef scp939 = PawnKindDefOf_SCP.SCP_939_PawnKindDef; if (scp939 is null) { return(false); } float num = parms.points; int num2 = GenMath.RoundRandom(num / scp939.combatPower); int numMax = Rand.RangeInclusive(15, 20); num2 = Mathf.Clamp(num2, 1, numMax); int duration = Mathf.RoundToInt(this.def.durationDays.RandomInRange * 60000); GameCondition_SCP939 cond = (GameCondition_SCP939)GameConditionMaker.MakeCondition(this.def.gameCondition, duration); cond.scp939Count = num2; parms.target.GameConditionManager.RegisterCondition(cond); Find.LetterStack.ReceiveLetter("LetterSCP939Enters".Translate().CapitalizeFirst(), "LetterSCP939EntersText".Translate(), LetterDefOf.ThreatBig); return(true); }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell)); yield return(new Toil { initAction = delegate() { GameCondition_SCP939 scpEvent = (GameCondition_SCP939)pawn.Map.GameConditionManager.ActiveConditions.Find(x => x is GameCondition_SCP939); scpEvent.AddToRegistry(pawn); return; } }); yield break; }