diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll index ae8c52b..91b7c94 100644 Binary files a/1.4/Assemblies/RJW_Menstruation.dll and b/1.4/Assemblies/RJW_Menstruation.dll differ diff --git a/1.4/Languages/English/Keyed/RJW_Menstruation.xml b/1.4/Languages/English/Keyed/RJW_Menstruation.xml index d8d471e..8ff0f64 100644 --- a/1.4/Languages/English/Keyed/RJW_Menstruation.xml +++ b/1.4/Languages/English/Keyed/RJW_Menstruation.xml @@ -132,6 +132,7 @@ Custom Hybrid Editor Hybrids of {0} When {0} breed with {1}, {2} will be born at {3} chance. If both races have hybrid definitions for each other, the father's definition will be used. - + No eggs + \ No newline at end of file diff --git a/1.4/MilkModule/Assemblies/MilkModule.dll b/1.4/MilkModule/Assemblies/MilkModule.dll index 7c22131..0adf6be 100644 Binary files a/1.4/MilkModule/Assemblies/MilkModule.dll and b/1.4/MilkModule/Assemblies/MilkModule.dll differ diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index 29b54cc..24fa00e 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -1030,7 +1030,7 @@ namespace RJW_Menstruation if (cycleVariability < 0f) cycleVariability = MenstruationUtility.RandomVariabilityPercent(); if (currentIntervalHours < 0) { - if (Pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) curStage = Stage.Infertile; + if (Pawn.health.capacities.GetLevel(xxx.reproduction) <= 0 || Pawn.SterileGenes()) curStage = Stage.Infertile; else if (!IsBreedingSeason()) curStage = Stage.Anestrus; else curStage = RandomStage(); if (curStage == Stage.Follicular) diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs index 2257c55..7bbdefb 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs @@ -2,6 +2,7 @@ using System.Linq; using RimWorld; using Verse; +using System.Collections.Generic; namespace RJW_Menstruation { @@ -61,4 +62,50 @@ namespace RJW_Menstruation __result = 0.999f; } } + + [HarmonyPatch(typeof(Recipe_ExtractOvum), nameof(Recipe_ExtractOvum.AvailableReport))] + public class ExtractOvum_AvailableReport_Patch + { + public static void PostFix(Thing thing, ref AcceptanceReport __result) + { + if (!__result.Accepted) return; + Pawn pawn = (Pawn)thing; + if (pawn.IsRJWPregnant()) + { + __result = "CannotPregnant".Translate(); + return; + } + List comps = pawn.GetMenstruationComps().ToList(); + if (!comps.Any()) return; + if (comps.All(comp => comp.ovarypower <= 0)) + { + __result = Translations.CannotNoEggs; + return; + } + return; + } + } + + [HarmonyPatch(typeof(Recipe_ExtractOvum), "OnSurgerySuccess")] + public class ExtractOvum_OnSurgerySuccess_Patch + { + public static void PostFix(Pawn pawn) + { + List comps = pawn.GetMenstruationComps().ToList(); + if (!comps.Any()) return; + HediffComp_Menstruation mostEggs = comps.MaxBy(comp => comp.ovarypower); + if (mostEggs.ovarypower <= 0) return; // Shouldn't happen + mostEggs.ovarypower--; + } + } + + [HarmonyPatch(typeof(Recipe_ImplantEmbryo), nameof(Recipe_ImplantEmbryo.ApplyOnPawn))] + public class ImplantEmbryo_ApplyOnPawn_Patch + { + public static void PostFix(Pawn pawn) + { + foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps()) + comp.TakeLoosePregnancy(); + } + } } \ No newline at end of file diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Translations.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Translations.cs index 973a90b..35d95c8 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Translations.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Translations.cs @@ -135,6 +135,8 @@ namespace RJW_Menstruation public static readonly string Gizmo_GatherCum = "Gizmo_GatherCum".Translate(); public static readonly string FloatMenu_CleanSelf = "FloatMenu_CleanSelf".Translate(); + public static readonly string CannotNoEggs = "CannotNoEggs".Translate(); + public static readonly string CustomHybrid_List_Title = "CustomHybrid_List_Title".Translate(); static public string CustomHybrid_Title(string label) { return TranslatorFormattedStringExtensions.Translate("CustomHybrid_Title", label); } static public string CustomHybrid_Tooltip(string label, string breedee, string baby, string chance) { return TranslatorFormattedStringExtensions.Translate("CustomHybrid_Tooltip", label, breedee, baby, chance); } diff --git a/changelogs.txt b/changelogs.txt index 32469b1..9d26535 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,5 +1,7 @@ Version 1.0.8.2 - Updated race support patches for new and removed vaginas. + - The Biotech extract ovum operation will now remove an egg from a pawn's ovaries. + - A pawn's womb should now recognize an implanted embryo. Version 1.0.8.1 - Added the option for humans to start Biotech pregnancies if the DLC is enabled. If set, non-humans will use the old multiple pregnancy instead.