Advertisement
Kaedys

Untitled

Dec 16th, 2023
797
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.63 KB | None | 0 0
  1.                     if (this.ShouldBeDowned())
  2.                     {
  3.                         if (!this.forceDowned && dinfo != null && dinfo.Value.Def.ExternalViolenceFor(this.pawn) && !this.pawn.IsWildMan() && (this.pawn.Faction == null || !this.pawn.Faction.IsPlayer) && (this.pawn.HostFaction == null || !this.pawn.HostFaction.IsPlayer))
  4.                         {
  5.                             bool flag = ModsConfig.BiotechActive && this.pawn.genes != null && this.pawn.genes.HasGene(GeneDefOf.Deathless);
  6.                             float num;
  7.                             if (flag && this.pawn.Faction == Faction.OfPlayer)
  8.                             {
  9.                                 num = 0f;
  10.                             }
  11.                             else if (this.pawn.RaceProps.Animal)
  12.                             {
  13.                                 num = 0.5f;
  14.                             }
  15.                             else if (this.pawn.RaceProps.IsMechanoid)
  16.                             {
  17.                                 num = 1f;
  18.                             }
  19.                             else
  20.                             {
  21.                                 num = (Find.Storyteller.difficulty.unwaveringPrisoners ? HealthTuning.DeathOnDownedChance_NonColonyHumanlikeFromPopulationIntentCurve : HealthTuning.DeathOnDownedChance_NonColonyHumanlikeFromPopulationIntentCurve_WaveringPrisoners).Evaluate(StorytellerUtilityPopulation.PopulationIntent) * Find.Storyteller.difficulty.enemyDeathOnDownedChanceFactor;
  22.                             }
  23.                             if (Rand.Chance(num))
  24.                             {
  25.                                 if (DebugViewSettings.logCauseOfDeath)
  26.                                 {
  27.                                     Log.Message("CauseOfDeath: chance on downed " + num.ToStringPercent());
  28.                                 }
  29.                                 if (flag && !this.pawn.Dead)
  30.                                 {
  31.                                     this.pawn.health.AddHediff(HediffDefOf.MissingBodyPart, this.pawn.health.hediffSet.GetBrain(), dinfo, null);
  32.                                     return;
  33.                                 }
  34.                                 this.pawn.Kill(dinfo, null);
  35.                                 return;
  36.                             }
  37.                         }
  38.                         this.forceDowned = false;
  39.                         this.MakeDowned(dinfo, hediff);
  40.                         return;
  41.                     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement