Properly count quirks for impregnation fetish

This commit is contained in:
lutepickle 2022-03-16 12:28:37 -07:00
parent 4677db4e93
commit 8013481634
2 changed files with 22 additions and 1 deletions

Binary file not shown.

View file

@ -88,7 +88,28 @@ namespace RJW_Menstruation
((PregnancyHelper.CanImpregnate(pawn, partner) && (partner.GetMenstruationComp()?.IsDangerDay ?? true)) ((PregnancyHelper.CanImpregnate(pawn, partner) && (partner.GetMenstruationComp()?.IsDangerDay ?? true))
|| ||
(PregnancyHelper.CanImpregnate(partner, pawn) && (pawn.GetMenstruationComp()?.IsDangerDay ?? true))); (PregnancyHelper.CanImpregnate(partner, pawn) && (pawn.GetMenstruationComp()?.IsDangerDay ?? true)));
return; }
}
[HarmonyPatch(typeof(Quirk), "CountSatisfiedQuirks")]
public static class CountSatisfiedQuirks_Patch
{
public static void Postfix(ref int __result, SexProps props)
{
// Awkward, but it'll have to do
Pawn pawn = props.pawn;
if (!pawn.Has(Quirk.ImpregnationFetish) || !props.hasPartner()) return;
// Check if the existing code would have added the count
Pawn partner = props.partner;
if (!(PregnancyHelper.CanImpregnate(pawn, partner, props.sexType) || PregnancyHelper.CanImpregnate(partner, pawn, props.sexType))) return;
__result = Mathf.Max(0, __result - 1); // __result shouldn't go negative, but it's better to be safe
if (
(PregnancyHelper.CanImpregnate(pawn, partner, props.sexType) && (partner.GetMenstruationComp()?.IsDangerDay ?? true))
||
(PregnancyHelper.CanImpregnate(partner, pawn, props.sexType) && (pawn.GetMenstruationComp()?.IsDangerDay ?? true)))
__result++;
} }
} }