/// <summary>Does the ingestion outcome special.</summary> /// <param name="pawn">The pawn.</param> /// <param name="ingested">The ingested.</param> protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested) { foreach (HediffDef h in AllCompleteDefs.Concat(AllPartialDefs)) { if (!h.CanInfect(pawn)) { continue; } Hediff hediff = HediffMaker.MakeHediff(h, pawn); float num; if (severity > 0f) { num = severity; } else { num = h.initialSeverity; } if (divideByBodySize) { num /= pawn.BodySize; } AddictionUtility.ModifyChemicalEffectForToleranceAndBodySize(pawn, toleranceChemical, ref num); hediff.Severity = num; pawn.health.AddHediff(hediff, null, null); } }
/// <summary>Does the ingestion outcome special.</summary> /// <param name="pawn">The pawn.</param> /// <param name="ingested">The ingested.</param> protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested) { float completeChance = LoadedModManager.GetMod <PawnmorpherMod>().GetSettings <PawnmorpherSettings>().partialChance; _scratchList.Clear(); if (Rand.RangeInclusive(0, 100) <= completeChance) { _scratchList.AddRange(AllCompleteDefs.Where(h => h.CanInfect(pawn))); } else { _scratchList.AddRange(AllPartialDefs.Where(h => h.CanInfect(pawn))); } if (_scratchList.Count == 0) { return; } hediffDef = _scratchList.RandElement(); Hediff hediff = HediffMaker.MakeHediff(hediffDef, pawn); float num; if (severity > 0f) { num = severity; } else { num = hediffDef.initialSeverity; } if (divideByBodySize) { AddictionUtility.ModifyChemicalEffectForToleranceAndBodySize(pawn, toleranceChemical, ref num); } hediff.Severity = num; pawn.health.AddHediff(hediff, null, null); }