Example #1
0
        private static void TestSurgeryFailCatastrophicx100()
        {
            for (int i = 0; i < 100; i++)
            {
                PawnKindDef random = DefDatabase <PawnKindDef> .GetRandom();

                Pawn pawn = PawnGenerator.GeneratePawn(random, FactionUtility.DefaultFactionFrom(random.defaultFactionType));
                GenSpawn.Spawn(pawn, CellFinderLoose.RandomCellWith((IntVec3 c) => c.Standable(Find.CurrentMap), Find.CurrentMap), Find.CurrentMap);
                pawn.health.forceIncap = true;
                BodyPartRecord part = pawn.health.hediffSet.GetNotMissingParts().RandomElement();
                HealthUtility.GiveInjuriesOperationFailureCatastrophic(pawn, part);
                pawn.health.forceIncap = false;
                if (pawn.Dead)
                {
                    Log.Error("Pawn died: " + pawn + " at " + pawn.Position);
                }
            }
        }