diff --git a/Common/Assemblies/Rjw-Genes.dll b/Common/Assemblies/Rjw-Genes.dll index 01ecf3c..db44229 100644 Binary files a/Common/Assemblies/Rjw-Genes.dll and b/Common/Assemblies/Rjw-Genes.dll differ diff --git a/Source/Common/patches/Patch_RJW_BestialityPregnancyUtility.cs b/Source/Common/patches/Patch_RJW_BestialityPregnancyUtility.cs new file mode 100644 index 0000000..0769366 --- /dev/null +++ b/Source/Common/patches/Patch_RJW_BestialityPregnancyUtility.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using HarmonyLib; +using RimWorld; +using Verse; +using rjw; + +namespace RJW_BGS +{ + [HarmonyPatch(typeof(ParentRelationUtility))] + public class patchGetParents + { + // Token: 0x0600000F RID: 15 + [HarmonyPostfix] + [HarmonyPatch("GetFather")] + private static void FatherPostfix(ref Pawn __result, Pawn pawn) + { + if (__result == null && pawn.RaceProps.IsFlesh && pawn.relations != null) + { + List directRelations = pawn.relations.DirectRelations; + bool flag = false; + for (int i = 0; i < directRelations.Count; i++) + { + DirectPawnRelation directPawnRelation = directRelations[i]; + if (directPawnRelation.def == PawnRelationDefOf.Parent) + { + if (flag) + { + __result = directPawnRelation.otherPawn; + return; + } + flag = true; + } + } + } + } + + // Token: 0x06000010 RID: 16 + [HarmonyPostfix] + [HarmonyPatch("GetMother")] + private static void MotherPostfix(ref Pawn __result, Pawn pawn) + { + if (__result == null && pawn.RaceProps.IsFlesh && pawn.relations != null) + { + List directRelations = pawn.relations.DirectRelations; + for (int i = 0; i < directRelations.Count; i++) + { + DirectPawnRelation directPawnRelation = directRelations[i]; + if (directPawnRelation.def == PawnRelationDefOf.Parent) + { + __result = directPawnRelation.otherPawn; + return; + } + } + } + } + + // Token: 0x0600001F RID: 31 + [HarmonyPostfix] + [HarmonyPatch("HasSameFather")] + private static void HasSameFatherPostfix(ref bool __result, Pawn pawn, Pawn other) + { + if (!__result && pawn.RaceProps.IsFlesh && pawn.relations != null) + { + Pawn parent = pawn.GetFather(); + Pawn parent2 = other.GetMother(); + Pawn parent3 = other.GetFather(); + Pawn parent4 = pawn.GetMother(); + if (parent != null && parent2 != null && parent == parent2) + { + __result = true; + return; + } + if (parent3 != null && parent4 != null && parent3 == parent4) + { + __result = true; + return; + } + if (parent != null && parent3 != null && parent == parent3) + { + __result = true; + return; + } + if (parent2 != null && parent4 != null && parent2 == parent4) + { + __result = true; + return; + } + } + } + + // Token: 0x06000020 RID: 32 + [HarmonyPostfix] + [HarmonyPatch("HasSameMother")] + private static void HasSameMotherPostfix(ref bool __result, Pawn pawn, Pawn other) + { + if (!__result && pawn.RaceProps.IsFlesh && pawn.relations != null) + { + Pawn parent = pawn.GetFather(); + Pawn parent2 = other.GetMother(); + Pawn parent3 = other.GetFather(); + Pawn parent4 = pawn.GetMother(); + if (parent != null && parent2 != null && parent == parent2) + { + __result = true; + return; + } + if (parent3 != null && parent4 != null && parent3 == parent4) + { + __result = true; + return; + } + if (parent != null && parent3 != null && parent == parent3) + { + __result = true; + return; + } + if (parent2 != null && parent4 != null && parent2 == parent4) + { + __result = true; + return; + } + } + } + } +} diff --git a/Source/Rjw-Genes.csproj b/Source/Rjw-Genes.csproj index b0f6349..83f61aa 100644 --- a/Source/Rjw-Genes.csproj +++ b/Source/Rjw-Genes.csproj @@ -44,6 +44,7 @@ + diff --git a/Source/Settings/RJW_Genes_Settings.cs b/Source/Settings/RJW_Genes_Settings.cs index f6e2f83..6f0171d 100644 --- a/Source/Settings/RJW_Genes_Settings.cs +++ b/Source/Settings/RJW_Genes_Settings.cs @@ -17,58 +17,12 @@ namespace RJW_Genes listing_Standard.ColumnWidth = rect.width / 2.05f; listing_Standard.Begin(rect); listing_Standard.Gap(24f); - listing_Standard.Label("Fertilin-Gain from Animals" + ": " + - Math.Round((double)(RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor * 100f), 0).ToString() + "%", -1f, "of fertilin gained (compared to human-baseline)."); - RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor = listing_Standard.Slider(RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor, 0f, 3f); - - listing_Standard.Gap(5f); - listing_Standard.CheckboxLabeled("Sexdemon Visits", ref rjw_genes_sexdemon_visit, "If enabled, incubi and succubi can spawn in through an event.", 0f, 1f); - if (rjw_genes_sexdemon_visit) - { - listing_Standard.Gap(3f); - listing_Standard.CheckboxLabeled(" Size matters", ref rjw_genes_sexdemon_join_size_matters, "Incubi and succubi will consider size/tightness of partners genital for deciding if they want to join", 0f, 1f); - listing_Standard.Gap(3f); - listing_Standard.CheckboxLabeled(" Sexdemon groups", ref rjw_genes_sexdemon_visit_groups, "Multiple sexdemons can spawn during a event", 0f, 1f); - listing_Standard.Gap(3f); - listing_Standard.CheckboxLabeled(" Succubi", ref rjw_genes_sexdemon_visit_succubi, "Allow incubi to spawn through this even", 0f, 1f); - listing_Standard.Gap(3f); - listing_Standard.CheckboxLabeled(" Incubi", ref rjw_genes_sexdemon_visit_incubi, "Allow incubi to spawn through this even", 0f, 1f); - - } - - listing_Standard.Gap(5f); - listing_Standard.CheckboxLabeled("generous-donor cheatmode", ref rjw_genes_generous_donor_cheatmode, "When enabled, pawns with the 'generous donor' are not drained and not fertilin exhausted. Hence they can fuel succubi and incubi non-stop. This makes them drastically easier to keep, and you should not do it.", 0f, 1f); - - listing_Standard.Gap(5f); listing_Standard.CheckboxLabeled("detailed-debug", ref rjw_genes_detailed_debug, "Adds detailed information to the log about interactions and genes.", 0f, 1f); listing_Standard.End(); } - public override void ExposeData() - { - base.ExposeData(); - Scribe_Values.Look(ref RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor, "rjw_genes_fertilin_from_animals_factor", RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor, true); - Scribe_Values.Look(ref RJW_Genes_Settings.rjw_genes_detailed_debug, "rjw_genes_detailed_debug", RJW_Genes_Settings.rjw_genes_detailed_debug, true); - - Scribe_Values.Look(ref RJW_Genes_Settings.rjw_genes_sexdemon_visit, "rjw_genes_sexdemon_visit", RJW_Genes_Settings.rjw_genes_sexdemon_visit, true); - Scribe_Values.Look(ref RJW_Genes_Settings.rjw_genes_sexdemon_join_size_matters, "rjw_genes_sexdemon_join_size_matters", RJW_Genes_Settings.rjw_genes_sexdemon_join_size_matters, true); - Scribe_Values.Look(ref RJW_Genes_Settings.rjw_genes_sexdemon_visit_groups, "rjw_genes_sexdemon_groups", RJW_Genes_Settings.rjw_genes_sexdemon_visit_groups, true); - Scribe_Values.Look(ref RJW_Genes_Settings.rjw_genes_sexdemon_visit_succubi, "rjw_genes_sexdemon_succubi", RJW_Genes_Settings.rjw_genes_sexdemon_visit_succubi, true); - Scribe_Values.Look(ref RJW_Genes_Settings.rjw_genes_sexdemon_visit_incubi, "rjw_genes_sexdemon_incubi", RJW_Genes_Settings.rjw_genes_sexdemon_visit_incubi, true); - - Scribe_Values.Look(ref RJW_Genes_Settings.rjw_genes_generous_donor_cheatmode, "rjw_genes_generous_donor_cheatmode", RJW_Genes_Settings.rjw_genes_generous_donor_cheatmode, true); - } public static bool rjw_genes_detailed_debug = false; - public static float rjw_genes_fertilin_from_animals_factor = 0.1f; - - public static bool rjw_genes_sexdemon_visit = true; - public static bool rjw_genes_sexdemon_join_size_matters = true; - public static bool rjw_genes_sexdemon_visit_groups = true; - public static bool rjw_genes_sexdemon_visit_succubi = true; - public static bool rjw_genes_sexdemon_visit_incubi = true; - - public static bool rjw_genes_generous_donor_cheatmode = false; } }