/// <summary> /// Harmony postfix method for SexUtility.ProcessSex. It calculates and applies damage and other effects /// </summary> /// <param name="pawn">Pawn 1 (rapist, w***e etc.)</param> /// <param name="partner">Pawn 2 (victim, client etc.)</param> /// <param name="rape">True if it's a non-consensual sex</param> /// <param name="sextype">Sex type (only Vaginal, Anal and Double Penetration are supported ATM)</param> public static void SexUtility_Prefix(Pawn pawn, Pawn partner, bool rape, xxx.rjwSextype sextype) { Log("* Initiator *"); LogPawnData(pawn); Log("* Partner *"); LogPawnData(partner); PenetrationUtility.ProcessPenetrations(pawn, partner, rape, sextype); }
/// <summary> /// Harmony patch for childbirth damage /// </summary> /// <param name="__instance"></param> /// <param name="baby"></param> public static void Hediff_BasePregnancy_Patch(Pawn mother, Pawn baby) { if (mother?.health?.hediffSet is null) { Log("No hediffSet found for the mother!"); return; } Log("Hediff_BasePregnancy_Patch for " + mother?.Label); // Checking if this mother has already given birth in current tick (damage applies only once) if ((lastBirthTick = Find.TickManager.TicksGame) != lastBirthTick) { gaveBirthThisTick.Clear(); } else if (gaveBirthThisTick.Contains(mother)) { Log("This mother has already given birth this tick. No more damage is applied."); return; } // Remember this mother, so as not to apply damage again if she has several babies gaveBirthThisTick.Add(mother); Hediff v****a = GetVagina(mother); if (v****a?.Part is null) { Log("No v****a found!"); return; } Log("V****a original size: " + v****a.Severity + "; effective size: " + PenetrationUtility.GetOrganSize(v****a) + "; HP: " + v****a.Part.def.hitPoints); double babySize; if (baby is null) { Log("Baby not found! Assuming it is 25% the size of the mother."); babySize = mother.BodySize * 0.25; } else { babySize = baby.BodySize; } Log("Baby size: " + babySize); double damage = (babySize / PenetrationUtility.GetOrganSize(v****a) * 30 - 1) * v****a.Part.def.hitPoints / 12 * Rand.Range(0.75f, 1.25f); Log("Childbirth damage: " + damage + " HP"); if (damage > 0) { PenetrationUtility.StretchOrgan(v****a, damage); damage *= Math.Max(1 - PenetrationUtility.GetWetness(v****a) * 0.5, 0.4); PenetrationUtility.AddHediff("SexStretch", damage, v****a, null); } }