diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll index 936deef..a0e592c 100644 Binary files a/1.4/Assemblies/RJW_Menstruation.dll and b/1.4/Assemblies/RJW_Menstruation.dll differ diff --git a/1.4/Defs/ThoughtDefs/Thoughts_sex.xml b/1.4/Defs/ThoughtDefs/Thoughts_sex.xml index d66d16b..e35d3e8 100644 --- a/1.4/Defs/ThoughtDefs/Thoughts_sex.xml +++ b/1.4/Defs/ThoughtDefs/Thoughts_sex.xml @@ -225,7 +225,20 @@ - - + + + EggRestorationReceived + Thought_Memory + 4 + 1 + +
  • + + I can breed for a little longer now. + 2 +
  • +
    +
    + diff --git a/1.4/Languages/English/Keyed/RJW_Menstruation.xml b/1.4/Languages/English/Keyed/RJW_Menstruation.xml index 5be5d11..6302b25 100644 --- a/1.4/Languages/English/Keyed/RJW_Menstruation.xml +++ b/1.4/Languages/English/Keyed/RJW_Menstruation.xml @@ -136,5 +136,7 @@ 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 + Must have a womb + {PAWN_labelShort} has completed {PAWN_possessive} egg restoration cycle. \ No newline at end of file diff --git a/1.4/MilkModule/Assemblies/MilkModule.dll b/1.4/MilkModule/Assemblies/MilkModule.dll index 7320b77..5961d35 100644 Binary files a/1.4/MilkModule/Assemblies/MilkModule.dll and b/1.4/MilkModule/Assemblies/MilkModule.dll differ diff --git a/1.4/Patches/Biosculpter_Patch.xml b/1.4/Patches/Biosculpter_Patch.xml new file mode 100644 index 0000000..cdee9e3 --- /dev/null +++ b/1.4/Patches/Biosculpter_Patch.xml @@ -0,0 +1,24 @@ + + + + +
  • Ideology
  • +
    + + /Defs/ThingDef[defName="BiosculpterPod"]/comps + +
  • + eggRestoration + + Restore one year worth of eggs in each womb. + Eggs/Egg + 4 + + + (0.867, 0.373, 0.396) + 1.0 +
  • +
    +
    +
    +
    \ No newline at end of file diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/CompBiosclupterPod_EggRestorationCycle.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/CompBiosclupterPod_EggRestorationCycle.cs new file mode 100644 index 0000000..537ef53 --- /dev/null +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/CompBiosclupterPod_EggRestorationCycle.cs @@ -0,0 +1,27 @@ +using RimWorld; +using Verse; + +namespace RJW_Menstruation +{ + public class CompProperties_BiosculpterPod_EggRestorationCycle : CompProperties_BiosculpterPod_BaseCycle + { + public CompProperties_BiosculpterPod_EggRestorationCycle() + { + compClass = typeof(CompBiosculpterPod_EggRestorationCycle); + } + + public float yearsToRestore; + } + + public class CompBiosculpterPod_EggRestorationCycle : CompBiosculpterPod_Cycle + { + + public override void CycleCompleted(Pawn occupant) + { + foreach (HediffComp_Menstruation comp in occupant.GetMenstruationComps()) + comp.RestoreEggs(((CompProperties_BiosculpterPod_EggRestorationCycle)Props).yearsToRestore); + + Messages.Message(Translations.EggRestorationCompleted(occupant.Named("PAWN")), occupant, MessageTypeDefOf.PositiveEvent); + } + } +} 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 dc97bbf..78638ee 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 @@ -1792,6 +1792,16 @@ namespace RJW_Menstruation crampPain = original.crampPain; } + public int EggsRestoredPerBiosculptor(float yearsWorth) + { + return Math.Max(1, (int)((float)RaceCyclesPerYear() * yearsWorth)); + } + + public void RestoreEggs(float yearsWorth) + { + ovarypower += EggsRestoredPerBiosculptor(yearsWorth); + } + public class Egg : IExposable { public bool fertilized; 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 a6d34e2..708596c 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 @@ -1,4 +1,5 @@ using HarmonyLib; +using System; using System.Linq; using RimWorld; using Verse; @@ -132,7 +133,7 @@ namespace RJW_Menstruation if (pregnancy == null) continue; if (Earliest_Pregnancy == null || Earliest_Pregnancy.Severity > pregnancy.Severity) Earliest_Pregnancy = pregnancy; } - + return Earliest_Pregnancy; } @@ -176,4 +177,16 @@ namespace RJW_Menstruation return TryTerminatePregnancy_Patch.Transpiler(instructions); } } + + [HarmonyPatch(typeof(CompBiosculpterPod), nameof(CompBiosculpterPod.CannotUseNowPawnCycleReason), new Type[] { typeof(Pawn), typeof(Pawn), typeof(CompBiosculpterPod_Cycle), typeof(bool) } )] + public class CannotUseNowPawnCycleReason_Patch + { + private const string eggRestorationKey = "eggRestoration"; + public static void Postfix(ref string __result, Pawn biosculptee, CompBiosculpterPod_Cycle cycle) + { + if (__result != null) return; + if(cycle.Props.key == eggRestorationKey && !biosculptee.GetMenstruationComps().Any()) + __result = Translations.CannotNoWomb; + } + } } \ No newline at end of file diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj b/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj index 2de20d8..1a8b5e3 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj @@ -61,6 +61,7 @@ + diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Translations.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Translations.cs index 426991d..8534281 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Translations.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Translations.cs @@ -139,6 +139,9 @@ namespace RJW_Menstruation public static readonly string CannotNoEggs = "CannotNoEggs".Translate(); + public static readonly string CannotNoWomb = "CannotNoWomb".Translate(); + public static string EggRestorationCompleted(NamedArgument name) { return "EggRestorationCompleted".Translate(name); } + 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/About/Manifest.xml b/About/Manifest.xml index 72e60db..13e6eed 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@ RJW Menstruation - 1.0.8.4 + 1.0.8.5 diff --git a/changelogs.txt b/changelogs.txt index ddd0654..1f1c46f 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,3 +1,6 @@ +Version 1.0.8.5 + - Added biosculptor recipe to restore 1 year's worth of eggs. + Version 1.0.8.4 - Fix Biotech xenotype inheritance for single-child pregnancies. - Fix error in Traditional Chinese translation.