public void ApplyInjuriesOrIllnessToTeam(Map map, List <Pawn> teamPawns) { if ((map.Biome == BiomeDefOf.TropicalRainforest) || (map.Biome == BiomeDef.Named("TropicalSwamp"))) { // Apply malaria/sleeping sickness to all team pawns in tropical or swamp biomes. HediffDef illness = null; if (Rand.Value < 0.5f) { illness = HediffDef.Named("SleepingSickness"); } else { illness = HediffDefOf.Malaria; } foreach (Pawn pawn in teamPawns) { pawn.health.AddHediff(illness); } } else { // Randomly damage some pawns. int injuredPawnsNumber = Mathf.RoundToInt(Rand.Range(0.25f, 0.5f) * teamPawns.Count); injuredPawnsNumber = Mathf.Clamp(injuredPawnsNumber, 1, teamPawns.Count - 1); for (int pawnIndex = 0; pawnIndex < injuredPawnsNumber; pawnIndex++) { Expedition.RandomlyDamagePawn(teamPawns[pawnIndex], Rand.Range(1, 2), Rand.Range(12, 20)); } } }
public void SpawnSurvivingPawns() { List <Pawn> survivingPawns = new List <Pawn>(); foreach (Pawn pawn in this.pawnsAboard) { GenSpawn.Spawn(pawn, this.OccupiedRect().Cells.RandomElement(), this.Map); Expedition.RandomlyDamagePawn(pawn, Rand.RangeInclusive(1, 4), Rand.RangeInclusive(4, 16)); if (pawn.Dead == false) { survivingPawns.Add(pawn); } } this.pawnsAboard.Clear(); if (survivingPawns.Count > 0) { IntVec3 exitSpot = IntVec3.Invalid; bool exitSpotIsValid = RCellFinder.TryFindBestExitSpot(survivingPawns.First(), out exitSpot, TraverseMode.PassAllDestroyableThings); if (exitSpotIsValid) { LordMaker.MakeNewLord(Util_Faction.MiningCoFaction, new LordJob_ExitMap(exitSpot), this.Map, survivingPawns); } } }