diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index 741fbb3..733e865 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -1340,9 +1340,9 @@ namespace RJW_Menstruation protected Pawn Fertilize() { - if (cums.NullOrEmpty()) return null; + if (cums == null) return null; List eligibleCum = cums.FindAll(cum => CumCanFertilize(cum)); - if (eligibleCum.Count == 0) return null; + if (eligibleCum.Empty()) return null; float totalFertPower = eligibleCum.Sum(cum => cum.FertVolume); diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs index 3251459..7a42bae 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs @@ -244,7 +244,7 @@ namespace RJW_Menstruation isInduced && comp.Pawn.jobs.curDriver is JobDriver_Sex job && job.Sexprops != null && - !job.Sexprops.usedCondom && + !UsingCondom(comp.Pawn, job.Partner) && (job.Sexprops.sexType == xxx.rjwSextype.Vaginal || job.Sexprops.sexType == xxx.rjwSextype.DoublePenetration)) ovulatoryProgress = 0.0f; else if (comp.curStage == HediffComp_Menstruation.Stage.Ovulatory) ovulatoryProgress = isInduced ? Mathf.Max(ovaryChanceToShow_01, comp.StageProgessNextUpdate) : comp.StageProgessNextUpdate; @@ -466,5 +466,13 @@ namespace RJW_Menstruation return damage.totalDamageDealt; } + + public static bool UsingCondom(Pawn pawn, Pawn partner) + { + return + ((pawn?.jobs?.curDriver as JobDriver_Sex)?.Sexprops.usedCondom ?? false) + || + ((partner?.jobs?.curDriver as JobDriver_Sex)?.Sexprops.usedCondom ?? false); + } } } diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs index eb776e3..e02c665 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs @@ -19,13 +19,11 @@ namespace RJW_Menstruation public static bool Prefix(SexProps props) { xxx.rjwSextype sextype = props.sexType; - Pawn pawn = props.pawn; - Pawn partner = props.partner; + Pawn pawn = props.pawn; // Penis + Pawn partner = props.partner; // Womb if (sextype != xxx.rjwSextype.Vaginal && sextype != xxx.rjwSextype.DoublePenetration) return true; - if (!partner.ShouldCycle()) return true; - if (!InteractionCanCausePregnancy(props)) return false; List pawnparts = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn)); @@ -38,6 +36,8 @@ namespace RJW_Menstruation if (Genital_Helper.has_penis_fertile(pawn, pawnparts) && PregnancyHelper.CanImpregnate(pawn, partner, sextype)) { + if (MenstruationUtility.UsingCondom(pawn, partner)) return false; // Probably unnecessary + PregnancyHelper.DoImpregnate(pawn, partner); return false; } @@ -344,7 +344,7 @@ namespace RJW_Menstruation xxx.rjwSextype sextype = __instance.Sexprops.sexType; if (!(target is Pawn partner)) return; if (sextype != xxx.rjwSextype.Vaginal && sextype != xxx.rjwSextype.DoublePenetration) return; - if (__instance.Sexprops.usedCondom) return; + if (MenstruationUtility.UsingCondom(pawn, partner)) return; if (AndroidsCompatibility.IsAndroid(pawn)) return; if (!Impregnate_Patch.InteractionCanCausePregnancy(__instance.Sexprops)) return; if (!partner.ShouldCycle()) return;