diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7f25417..3f19243 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -66,6 +66,33 @@ Any gene can give immunity against any genetic disease using an extension:
These extensions can be slapped on any gene,
but they are meant mostly to have infectors immune against their own diseases.
+**Twinkification / Feminization**:
+
+Both approaches follow the same general logic.
+
+- Pawn `A` has Twinkifier Gene and fucks Pawn `B`
+- `B` receives a `twinkification progress` hediff with some effects
+- Upon having ANY sex, `B` can gain genes from a relevant genepool.
+- Genes can be minor or major, depending on the progress of twinkification.
+
+Pawn `B` might be immune against twinkifier as normal immunity logic against diseases.
+But once the hediff is there, the twinkification can happen unless you wait for it to cool down.
+Gene additions are subject to an application chance (25% for minor, 10% for major)
+and might try to add a gene that already exists - then nothing happens.
+
+*Twink Genepool*:
+- (Minor) Body_Thin
+- (Minor) Homosexual
+- (Minor) Beard_NoBeardOnly
+- (Minor) Small male genitalia
+- (Major) Minor Vulnerability
+- (Major) Infectious Homosexuality
+- (Major) Delicate
+- (Major) Beauty Pretty
+- (Major) Fertile Anus
+
+These are currently hardcoded but I can change them on popular demand.
+
## Changelog
**Additions:**
@@ -83,6 +110,7 @@ but they are meant mostly to have infectors immune against their own diseases.
- 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.
+- Gene: Twinkification. Pawns turn their (male) sexual partners into breedable twinks.
- 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
diff --git a/Common/Defs/GeneDefs/GeneDefs_SexSpecial.xml b/Common/Defs/GeneDefs/GeneDefs_SexSpecial.xml
index 001b765..462cece 100644
--- a/Common/Defs/GeneDefs/GeneDefs_SexSpecial.xml
+++ b/Common/Defs/GeneDefs/GeneDefs_SexSpecial.xml
@@ -224,7 +224,7 @@
false
diff --git a/Source/Genes/Special/Patches/Patch_Twinkifier.cs b/Source/Genes/Special/Patches/Patch_Twinkifier.cs
index 53c9d46..87b43bc 100644
--- a/Source/Genes/Special/Patches/Patch_Twinkifier.cs
+++ b/Source/Genes/Special/Patches/Patch_Twinkifier.cs
@@ -35,44 +35,87 @@ namespace RJW_Genes
if (pawn == null) return;
Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_twinkification_progress);
if (hediff == null) return;
-
+
var Random = new Random();
- switch (hediff.SeverityLabel)
+ // DevNote: I first had a switch (hediff.SeverityLabel) but SeverityLabel was null.
+ // So now I have this approach which feels a bit more robust.
+ // I was thinking about looking for strings in the label, but I think that will break the logic in case of translations.
+ switch (hediff.Severity)
{
- case "severe":
- case "critical":
+ case float f when f > 0.8f:
{
if (Random.NextDouble() < MAJOR_APPLICATION_CHANCE)
- majorChange(pawn);
+ MajorChange(pawn);
} break;
- case "minor":
+ case float f when f > 0.6f:
{
if (Random.NextDouble() < MINOR_APPLICATION_CHANCE)
- minorChange(pawn);
+ MinorChange(pawn);
+ } break;
+ default:
+ {
+ ModLog.Debug($"Tried to twinkify {pawn} - severity of twinkification was too low ({hediff.def} @ {hediff.Severity} - {hediff.Label})") ;
} break;
}
}
- private static void minorChange(Pawn pawn)
+ private static void MinorChange(Pawn pawn)
{
- // Minor Infectious Vulnerability
- // Smaller Genitalia
- // Remove Beard
- // Thin Body Type
+ List possibleGenes = new List() {
+ GeneDefOf.rjw_genes_small_male_genitalia,
+ DefDatabase.GetNamed("Beard_NoBeardOnly"),
+ DefDatabase.GetNamed("Body_Thin"),
+ GeneDefOf.rjw_genes_homosexual
+ };
+
+ GeneDef chosen = possibleGenes.RandomElement();
+ if (chosen == null)
+ {
+ ModLog.Warning($"Error in retrieving a minor-twinkification gene for twinkifying {pawn}");
+ return;
+ }
+
+ // DevNote: I could do "hasActiveGene" but that could lead to the gene being there but not active.
+ if (!pawn.genes.GenesListForReading.Any(p => p.def == chosen))
+ {
+ ModLog.Debug($"{pawn} experienced a minor twinkification change; {pawn} got new gene {chosen}.");
+ pawn.genes.AddGene(chosen, !RJW_Genes_Settings.rjw_genes_genetic_disease_as_endogenes);
+ } else
+ {
+ ModLog.Debug($"Tryed a minor twinkification for {pawn} - {pawn} already had {chosen}");
+ }
}
- private static void majorChange(Pawn pawn)
+ private static void MajorChange(Pawn pawn)
{
- // Final Gene-Pool should have:
- // - Fragile (?)
- // - Infectious Vulnerability
- // - Infectious Homosexuality
- // - Beauty
- // - Fertile Anus
+ List possibleGenes = new List() {
+ GeneDefOf.rjw_genes_fertile_anus,
+ DefDatabase.GetNamed("Beauty_Pretty"),
+ DefDatabase.GetNamed("Delicate"),
+ GeneDefOf.rjw_genes_minor_vulnerability,
+ GeneDefOf.rjw_genes_infectious_homosexuality
+ };
- pawn.genes.AddGene(GeneDefOf.rjw_genes_fertile_anus, !RJW_Genes_Settings.rjw_genes_genetic_disease_as_endogenes);
- pawn.genes.AddGene(GeneDefOf.rjw_genes_infectious_homosexuality, !RJW_Genes_Settings.rjw_genes_genetic_disease_as_endogenes);
+ GeneDef chosen = possibleGenes.RandomElement();
+ if (chosen == null)
+ {
+ ModLog.Warning($"Error in retrieving a minor-twinkification gene for twinkifying {pawn}");
+ return;
+ }
+
+ // DevNote: I could do "hasActiveGene" but that could lead to the gene being there but not active.
+ if (!pawn.genes.GenesListForReading.Any(p => p.def == chosen))
+ {
+ ModLog.Debug($"{pawn} experienced a major twinkification change; {pawn} got new gene {chosen}.");
+ pawn.genes.AddGene(chosen, !RJW_Genes_Settings.rjw_genes_genetic_disease_as_endogenes);
+ }
+ else
+ {
+ ModLog.Debug($"Tryed a major twinkification for {pawn} - {pawn} already had {chosen}");
+ ModLog.Debug($"Trying minor twinkification for {pawn} instead ...");
+ MinorChange(pawn);
+ }
}
}
}