diff --git a/CHANGELOG.md b/CHANGELOG.md index b087e0e..ab1db00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ Most of the genes so far were positive or neutral, so I got some fair requests to introduce negative genes to keep xenotypes balanced. I know that this is some overlap with the STD mod, but well ... you are free to turn things off? +In theory, you can specify and gene of any kind to be spreadable by sex, not only ones written by this mod. + **Genetic Infectors**: These Genes can apply a genetic disease, but are not genetic diseases themselves. @@ -80,12 +82,20 @@ but they are meant mostly to have infectors immune against their own diseases. - Gene: Hardwired Progenity. Pawns with this get a malus on having no-children, and bonus on having a lot. - Gene: Sexual Genetic Swap. Pawns have a chance to switch a random gene with their sexpartner. - (Archite) Gene: Sexual Genetic Thief. Pawns have a chance to steal a gene from their sexpartner. Genetic Disease Immunity shields against this. +- Gene: Sperm Displacement. Pawns might overwrite an existing pregnancy, becoming the new father. The pregnancy will stay in its gestation progress. - Pawns will have negative thoughts about pawns with more genetic diseases than themselves. - Faction Penalties for spreading diseases, stealing genes and aging pawns with age transfer +- Patch for [Imphilee Xeno](https://steamcommunity.com/sharedfiles/filedetails/?id=2990674516) by @Bunuffin + +**Changes**:: + +- Cum-Amount-Changing genes now are XML Adjustable and share a single `.cs`-class +- Incubi are now Bisexual too, as they should be. **Fixes:** - Fixed an Issue where pawns would always get the Pheromone social boost, unless they had the pheromone (#113) +- Fixed two hidden dependencies on Ideology and Royalty (#115) **Internal:** @@ -93,6 +103,18 @@ but they are meant mostly to have infectors immune against their own diseases. - Introduced a `ModLog.Debug` Function that checks for the settings before printing - trying to spread it over the whole project. - Removed TODO File. I have enough to do. +**Notes:** + +The changes to the cum-gene will give a 1-time warning on loading the save. The warning looks like this: +``` +Could not find class RJW_Genes.Gene_MuchCum while resolving node li. Trying to use Verse.Gene instead. Full node:
  • rjw_genes_much_cumThing_Human697null82
  • +UnityEngine.StackTraceUtility:ExtractStackTrace () +Verse.Log:Error (string) +... +``` + +This is not dangerous. + # 2.1.0 (27-06-2024) **Additions**: diff --git a/Common/Defs/GeneDefs/GeneDefs_Breeding.xml b/Common/Defs/GeneDefs/GeneDefs_Breeding.xml index 832621a..463046f 100644 --- a/Common/Defs/GeneDefs/GeneDefs_Breeding.xml +++ b/Common/Defs/GeneDefs/GeneDefs_Breeding.xml @@ -153,15 +153,4 @@ 0 - - rjw_genes_pregnancy_overwrite - - Carriers of this gene can 'overwrite' an existing pregnancy, keeping the progress but effectively replacing the father. - Genes/Icons/RJW_Genes_PheromoneSpit - 75 - - 4 - -2 - - \ No newline at end of file diff --git a/Common/Defs/GeneDefs/GeneDefs_Cum.xml b/Common/Defs/GeneDefs/GeneDefs_Cum.xml index 32ac80c..95580a8 100644 --- a/Common/Defs/GeneDefs/GeneDefs_Cum.xml +++ b/Common/Defs/GeneDefs/GeneDefs_Cum.xml @@ -21,10 +21,15 @@ Males of these species have no fluid. Genes/Icons/No_Cum - RJW_Genes.Gene_NoCum + RJW_Genes.Gene_ChangeCumAmount 533 0 1 + +
  • + 0.0 +
  • +
    @@ -32,10 +37,15 @@ Males of this species produce a lot of fluid. Genes/Icons/Much_Cum - RJW_Genes.Gene_MuchCum + RJW_Genes.Gene_ChangeCumAmount 534 1 - -1 + 0 + +
  • + 3.0 +
  • +
    @@ -44,10 +54,15 @@ Males of this species produce a whole lot of fluid. They are like fountains basically. Genes/Icons/Very_Much_Cum - RJW_Genes.Gene_VeryMuchCum + RJW_Genes.Gene_ChangeCumAmount 535 1 - -2 + -1 + +
  • + 15.0 +
  • +
    \ No newline at end of file diff --git a/Common/Defs/GeneDefs/GeneDefs_Reproduction.xml b/Common/Defs/GeneDefs/GeneDefs_Reproduction.xml index 7c305d4..1c37ba3 100644 --- a/Common/Defs/GeneDefs/GeneDefs_Reproduction.xml +++ b/Common/Defs/GeneDefs/GeneDefs_Reproduction.xml @@ -115,7 +115,6 @@ -
  • rjw_genes_homosexuality_trait_giver
  • rjw_genes_sexual_orientation
  • @@ -144,7 +143,7 @@ -
  • rjw_genes_sexual_orientation
  • +
  • rjw_genes_sexual_orientation
  • rjw_genes_bisexuality_trait_giver
  • @@ -207,4 +206,28 @@ + + rjw_genes_pregnancy_overwrite + + Reproduction + Carriers of this gene can 'overwrite' an existing pregnancy, keeping the + progress but effectively replacing the father. + Genes/Icons/RJW_Genes_PheromoneSpit + 120 + + 4 + -2 + + +
  • + 0.5 +
  • +
  • + Genes/Icons/RJW_Genes_Endogene_Background + Genes/Icons/RJW_Genes_Xenogene_Background +
  • +
    +
    + \ No newline at end of file diff --git a/Common/Defs/GeneDefs/Xenotype_Lifeforce.xml b/Common/Defs/GeneDefs/Xenotype_Lifeforce.xml index bc0c54b..f28f160 100644 --- a/Common/Defs/GeneDefs/Xenotype_Lifeforce.xml +++ b/Common/Defs/GeneDefs/Xenotype_Lifeforce.xml @@ -75,6 +75,7 @@
  • rjw_genes_hypersexual
  • +
  • rjw_genes_bisexual
  • rjw_genes_male_only
  • rjw_genes_lifeforce
  • rjw_genes_lifeforce_drain
  • diff --git a/Common/Defs/HediffDefs/Hediffs_Fertilin.xml b/Common/Defs/HediffDefs/Hediffs_Fertilin.xml index fdca8d4..5b56717 100644 --- a/Common/Defs/HediffDefs/Hediffs_Fertilin.xml +++ b/Common/Defs/HediffDefs/Hediffs_Fertilin.xml @@ -1,6 +1,6 @@ - + - + rjw_genes_fertilin_lost Hediff_HemogenCraving @@ -19,12 +19,13 @@ - + rjw_genes_succubus_drained HediffWithComps - The vitality of this pawn has been drained. Cannot be drained again until fully recovered. + The vitality of this pawn has been drained. Cannot be drained again until fully + recovered. (1,0,0.5) 1.0 1.0 @@ -74,13 +75,13 @@ -0.2 - 0.4 + 0.4 0.1 0.35 - + rjw_genes_fertilin_craving @@ -90,77 +91,78 @@ 1.0 0.01 -
  • - - 0.05 - -
  • - Consciousness - 0.9 -
  • - - -
  • - - 0.35 - 0.1 - -
  • - Consciousness - 0.8 -
  • - - -
  • - - 0.7 - 0.15 - -
  • - Consciousness - 0.5 -
  • - - +
  • + + 0.05 + +
  • + Consciousness + 0.9 +
  • + + +
  • + + 0.35 + 0.1 + +
  • + Consciousness + 0.8 +
  • + + +
  • + + 0.7 + 0.15 + +
  • + Consciousness + 0.5 +
  • + +
    -
  • - 0.05 - -0.1 -
  • +
  • + 0.05 + -0.1 +
  • - - rjw_genes_naked_prowess - - Driven by fertilin, this person has greatly increased strength and resilience. - HediffWithComps - -
  • - - - 0.5 - 0.5 - 0.5 - - - - 0.5 - 1.5 - -
  • -
    - -
  • - True - 5000 -
  • -
  • - - - false - + + rjw_genes_naked_prowess + (0.52, 1, 0.95) + + Driven by fertilin, this person has greatly increased strength and resilience. + HediffWithComps + +
  • + + + 0.5 + 0.5 + 0.5 + + + 0.5 + 1.5 + +
  • + + +
  • + True + 5000 +
  • +
  • + + + false + - + \ No newline at end of file diff --git a/Common/Defs/HediffDefs/Scrambler.xml b/Common/Defs/HediffDefs/Scrambler.xml index a84299d..4ab6071 100644 --- a/Common/Defs/HediffDefs/Scrambler.xml +++ b/Common/Defs/HediffDefs/Scrambler.xml @@ -13,7 +13,7 @@
  • 0 - 0.40 + 0.40 3.0 diff --git a/Common/Defs/HistoryEventDefs/SpecialHistoryEventDefs.xml b/Common/Defs/HistoryEventDefs/SpecialHistoryEventDefs.xml index c5668ad..ded422c 100644 --- a/Common/Defs/HistoryEventDefs/SpecialHistoryEventDefs.xml +++ b/Common/Defs/HistoryEventDefs/SpecialHistoryEventDefs.xml @@ -10,4 +10,9 @@ + + rjw_genes_GoodwillChangedReason_OverwritePregnancy + + + \ No newline at end of file diff --git a/Common/Patches/Xenotypes/PatchImphileeXeno.xml b/Common/Patches/Xenotypes/PatchImphileeXeno.xml new file mode 100644 index 0000000..4a8655f --- /dev/null +++ b/Common/Patches/Xenotypes/PatchImphileeXeno.xml @@ -0,0 +1,36 @@ + + + + +
  • + +
  • Imphilee Xeno
  • + + + Defs/XenotypeDef[defName="LD_Imphilee"]/genes + +
  • rjw_genes_tight_female_genitalia
  • +
  • rjw_genes_small_breasts
  • +
  • rjw_genes_elasticity
  • +
  • rjw_genes_demonic_genitalia
  • +
    +
    + +
  • + +
  • Imphilee Xeno
  • + + + Defs/XenotypeDef[defName="LD_Imphilee_Overlord"]/genes + +
  • rjw_genes_tight_female_genitalia
  • +
  • rjw_genes_small_breasts
  • +
  • rjw_genes_elasticity
  • +
  • rjw_genes_demonic_genitalia
  • +
  • rjw_genes_rapist
  • +
    +
    + + + + diff --git a/Source/Common/Defs/MultiplierExtension.cs b/Source/Common/Defs/MultiplierExtension.cs new file mode 100644 index 0000000..5be194e --- /dev/null +++ b/Source/Common/Defs/MultiplierExtension.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; + +namespace RJW_Genes +{ + public class MultiplierExtension : DefModExtension + { + public float multiplier; + } +} diff --git a/Source/Genes/Cum/CumUtility.cs b/Source/Genes/Cum/CumUtility.cs index b483aed..dba96b1 100644 --- a/Source/Genes/Cum/CumUtility.cs +++ b/Source/Genes/Cum/CumUtility.cs @@ -34,8 +34,23 @@ namespace RJW_Genes } - //Get total fluidamount a person has. - public static float GetTotalFluidAmount(Pawn pawn, float multiplier = 1f) + /// + /// Looks up the "MultiplierExtensions" Value for a given Gene, with a fall back. + /// Returns the fallback if there is no Extension, or if the Multiplier is smaller than 0. + /// + + public static float LookupCumMultiplier(Gene gene, float FALLBACK = 3.0f) => LookupCumMultiplier(gene.def,FALLBACK); + public static float LookupCumMultiplier(GeneDef def, float FALLBACK = 3.0f) + { + MultiplierExtension multiplier = def.GetModExtension(); + if (multiplier == null || multiplier.multiplier < 0) + return FALLBACK; + else return multiplier.multiplier; + } + + + //Get total fluidamount a person has. + public static float GetTotalFluidAmount(Pawn pawn, float multiplier = 1f) { var partBPR = Genital_Helper.get_genitalsBPR(pawn); var parts = Genital_Helper.get_PartsHediffList(pawn, partBPR); diff --git a/Source/Genes/Cum/Gene_MuchCum.cs b/Source/Genes/Cum/Gene_ChangeCumAmount.cs similarity index 51% rename from Source/Genes/Cum/Gene_MuchCum.cs rename to Source/Genes/Cum/Gene_ChangeCumAmount.cs index e88ac3f..dc10ba4 100644 --- a/Source/Genes/Cum/Gene_MuchCum.cs +++ b/Source/Genes/Cum/Gene_ChangeCumAmount.cs @@ -1,36 +1,38 @@ namespace RJW_Genes { - public class Gene_MuchCum : RJW_Gene + public class Gene_ChangeCumAmount : RJW_Gene { bool has_been_fired = false; - float multiplier_much_cum = 3f; public override void PostMake() { base.PostMake(); - CumUtility.MultiplyFluidAmountBy(pawn, multiplier_much_cum); + float multipier = CumUtility.LookupCumMultiplier(this); + CumUtility.MultiplyFluidAmountBy(pawn, multipier); has_been_fired = true; } public override void PostAdd() { base.PostAdd(); - if (!has_been_fired) { - CumUtility.MultiplyFluidAmountBy(pawn, multiplier_much_cum); + if (!has_been_fired) + { + float multipier = CumUtility.LookupCumMultiplier(this); + CumUtility.MultiplyFluidAmountBy(pawn, multipier); has_been_fired = true; } } - public override void PostRemove() { base.PostAdd(); if (has_been_fired) { - CumUtility.MultiplyFluidAmountBy(pawn, 1/multiplier_much_cum); + float multipier = CumUtility.LookupCumMultiplier(this); + CumUtility.MultiplyFluidAmountBy(pawn, 1/ multipier); has_been_fired = false; } } diff --git a/Source/Genes/Cum/Gene_NoCum.cs b/Source/Genes/Cum/Gene_NoCum.cs deleted file mode 100644 index 0c3e888..0000000 --- a/Source/Genes/Cum/Gene_NoCum.cs +++ /dev/null @@ -1,34 +0,0 @@ -namespace RJW_Genes -{ - public class Gene_NoCum : RJW_Gene - { - bool has_been_fired = false; - - - public override void PostMake() - { - base.PostMake(); - - CumUtility.MultiplyFluidAmountBy(pawn, 0f); - has_been_fired = true; - } - - public override void PostAdd() - { - base.PostAdd(); - if (!has_been_fired) { - CumUtility.MultiplyFluidAmountBy(pawn, 0f); - has_been_fired = true; - } - } - - - public override void PostRemove() - { - // Cum Removal does not do at the moment :/ I would need to safe the old cum amount but I don't want to at the moment - base.PostAdd(); - - } - - } -} diff --git a/Source/Genes/Cum/Gene_VeryMuchCum.cs b/Source/Genes/Cum/Gene_VeryMuchCum.cs deleted file mode 100644 index 21faecc..0000000 --- a/Source/Genes/Cum/Gene_VeryMuchCum.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace RJW_Genes -{ - public class Gene_VeryMuchCum : RJW_Gene - { - bool has_been_fired = false; - - float multiplier_much_cum = 10f; - - public override void PostMake() - { - base.PostMake(); - - CumUtility.MultiplyFluidAmountBy(pawn, multiplier_much_cum); - has_been_fired = true; - } - - public override void PostAdd() - { - base.PostAdd(); - if (!has_been_fired) { - CumUtility.MultiplyFluidAmountBy(pawn, multiplier_much_cum); - has_been_fired = true; - } - } - - - public override void PostRemove() - { - base.PostAdd(); - - if (has_been_fired) - { - CumUtility.MultiplyFluidAmountBy(pawn, 1/multiplier_much_cum); - has_been_fired = false; - } - } - - } -} diff --git a/Source/Genes/Special/Patches/Patch_PregnancyOverwrite.cs b/Source/Genes/Special/Patches/Patch_PregnancyOverwrite.cs index b7b35a6..704a2bd 100644 --- a/Source/Genes/Special/Patches/Patch_PregnancyOverwrite.cs +++ b/Source/Genes/Special/Patches/Patch_PregnancyOverwrite.cs @@ -40,8 +40,6 @@ namespace RJW_Genes if (!pawn.IsPregnant() && !partner.IsPregnant()) return; - ModLog.Debug("Firing Pregnancy Overwrite Patch - Passed Simple NullChecks"); - if (pawn.IsPregnant() && GeneUtility.HasGeneNullCheck(partner, GeneDefOf.rjw_genes_pregnancy_overwrite)) TryReplacePregnancy(partner, pawn); @@ -51,29 +49,52 @@ namespace RJW_Genes TryReplacePregnancy(pawn, partner); } + /// + /// Tries to replace an existing pregnancy with a new pregnancy at the same gestation process. + /// The new pregnancy will have the same mother, but a new father and a new set of genes. + /// + /// There is a check for pregnancy that checks for the general fertility (using Vanilla Functions) and multiplies it with a xml-configurable chance. + /// If anything is replaced, there will be a faction penalty applied. + /// + /// + /// public static void TryReplacePregnancy(Pawn replacer, Pawn pregnant) { - // TODO: This mostly works, but needs some more checks. - // - Check if there is a pregnancy occurring - // - Check for Disease Immunity - // - Add Faction Penalties - - ModLog.Debug($"Firing Pregnancy Overwrite for {replacer} and {pregnant}"); - - // The "CanImpregnate" does not work as I want, as the pawn is already pregnant, so it wont allow to be pregnated. - //PregnancyHelper.CanImpregnate(pawn, partner, props.sexType) + // DevNote: + // There are some issues with just checking PregnancyUtility.PregnancyChanceForPartners or rjw.PregnancyHelper.CanImpregnate + // Both do give 0.0 chance when the pawn is already pregnant, which does not help me :/ Hediff pregnancyHediff = PregnancyUtility.GetPregnancyHediff(pregnant); if (pregnancyHediff == null) return; - float gestationProgress = pregnancyHediff.Severity; + if (DiseaseHelper.IsImmuneAgainstGeneticDisease(pregnant, GeneDefOf.rjw_genes_pregnancy_overwrite)) + { + ModLog.Debug($"{pregnant} is immune against rjw_genes_pregnancy_overwrite from {replacer}"); + return; + } - PregnancyUtility.ForceEndPregnancy(pregnant); + ChanceExtension chanceExt = GeneDefOf.rjw_genes_pregnancy_overwrite.GetModExtension(); + float chance = chanceExt != null ? chanceExt.chance : 0.25f; + float replacerFert = replacer.GetStatValueForPawn(StatDefOf.Fertility, replacer); + chance *= replacerFert ; + double roll = (new Random()).NextDouble(); + if (roll < chance) + { + ModLog.Debug($"Pregnancy-Overwrite for {replacer} and {pregnant}."); + float gestationProgress = pregnancyHediff.Severity; - PregnancyHelper.StartVanillaPregnancy(pregnant, replacer); - Hediff replacementPregnancyHediff = PregnancyUtility.GetPregnancyHediff(pregnant); - replacementPregnancyHediff.Severity = gestationProgress; + PregnancyUtility.ForceEndPregnancy(pregnant); + + PregnancyHelper.StartVanillaPregnancy(pregnant, replacer); + Hediff replacementPregnancyHediff = PregnancyUtility.GetPregnancyHediff(pregnant); + replacementPregnancyHediff.Severity = gestationProgress; + + FactionUtility.HandleFactionGoodWillPenalties(replacer, pregnant, "rjw_genes_GoodwillChangedReason_OverwritePregnancy", FACTION_GOODWILL_CHANGE); + } else + { + ModLog.Debug($"Did not Pregnancy-Overwrite for {replacer} and {pregnant}. Failed: Rolled {roll} <({chanceExt.chance}[XML-Chance] x {replacerFert} [Fert:{replacer}])"); + } } } diff --git a/Source/Rjw-Genes.csproj b/Source/Rjw-Genes.csproj index 8354632..dabb692 100644 --- a/Source/Rjw-Genes.csproj +++ b/Source/Rjw-Genes.csproj @@ -59,6 +59,7 @@ + @@ -105,9 +106,7 @@ - - - +