diff --git a/Common/Defs/Genes/GeneDefs_Damage.xml b/Common/Defs/Genes/GeneDefs_Damage.xml index b3c21ef..8c8f87d 100644 --- a/Common/Defs/Genes/GeneDefs_Damage.xml +++ b/Common/Defs/Genes/GeneDefs_Damage.xml @@ -11,4 +11,18 @@ 1 + + rjw_genes_unbreakable + + rjw_genes_damage + This Gene makes the Carrier unable to get mood or social penalties from being raped and they cannot be broken for a long period of time. + UI/Icons/Rituals/TrialDefend + 2 + + RJW_Genes.Gene_Unbreakable + +
  • FeelingBroken
  • +
    +
    + \ No newline at end of file diff --git a/Common/Patches/Genes/Patch_Unbreakable.xml b/Common/Patches/Genes/Patch_Unbreakable.xml new file mode 100644 index 0000000..a2d674a --- /dev/null +++ b/Common/Patches/Genes/Patch_Unbreakable.xml @@ -0,0 +1,68 @@ + + + + + Defs/ThoughtDef[defName="FeelingBroken"] + + +
  • rjw_genes_unbreakable
  • +
    +
    +
    + + + + Defs/ThoughtDef[defName="GotRaped"] + + +
  • rjw_genes_unbreakable
  • +
    +
    +
    + + + Defs/ThoughtDef[defName="GotAnalRaped"] + + +
  • rjw_genes_unbreakable
  • +
    +
    +
    + + + Defs/ThoughtDef[defName="GotAnalRapedByFemale"] + + +
  • rjw_genes_unbreakable
  • +
    +
    +
    + + + Defs/ThoughtDef[defName="GotRapedUnconscious"] + + +
  • rjw_genes_unbreakable
  • +
    +
    +
    + + + Defs/ThoughtDef[defName="HateMyRapist"] + + +
  • rjw_genes_unbreakable
  • +
    +
    +
    + + + Defs/ThoughtDef[defName="AllowedMeToGetRaped"] + + +
  • rjw_genes_unbreakable
  • +
    +
    +
    + +
    \ No newline at end of file diff --git a/Source/GeneDefOf.cs b/Source/GeneDefOf.cs index 631602f..4a499ea 100644 --- a/Source/GeneDefOf.cs +++ b/Source/GeneDefOf.cs @@ -67,6 +67,7 @@ namespace RJW_Genes // Damage & Side Effects [MayRequire("LustLicentia.RJWLabs")] public static readonly GeneDef rjw_genes_elasticity; + public static readonly GeneDef rjw_genes_unbreakable; // Special public static readonly GeneDef rjw_genes_orgasm_rush; diff --git a/Source/Genes/Damage/Gene_Elasticity.cs b/Source/Genes/Damage/Gene_Elasticity.cs index 603a18d..5d92b51 100644 --- a/Source/Genes/Damage/Gene_Elasticity.cs +++ b/Source/Genes/Damage/Gene_Elasticity.cs @@ -10,8 +10,6 @@ namespace RJW_Genes /// public class Gene_Elasticity : Gene { - - private int ticksToReset = RESET_INTERVAL; private const int RESET_INTERVAL = 60000; // 60k should be 1 day public override void PostAdd() @@ -26,11 +24,8 @@ namespace RJW_Genes public override void Tick() { base.Tick(); - --this.ticksToReset; - if (this.ticksToReset > 0) - return; - this.ticksToReset = RESET_INTERVAL; - ResetSeverity(); + if (pawn.IsHashIntervalTick(RESET_INTERVAL)) + ResetSeverity(); } public override void PostRemove() diff --git a/Source/Genes/Damage/Gene_Unbreakable.cs b/Source/Genes/Damage/Gene_Unbreakable.cs new file mode 100644 index 0000000..2ebdad3 --- /dev/null +++ b/Source/Genes/Damage/Gene_Unbreakable.cs @@ -0,0 +1,41 @@ +using LicentiaLabs; +using rjw; +using Verse; + +namespace RJW_Genes +{ + /// + /// This Gene regularly removes the broken hediff of a pawn. + /// Blocking / Removing thoughts are done in an XML Patch. + /// + public class Gene_Unbreakable : Gene + { + /// DevNote: I first tried to Harmony-Postfix the AfterSexUtility and never add it - but that failed? + + private const int RESET_INTERVAL = 30000; // 30k should be 0.5 day + public override void PostAdd() + { + base.PostAdd(); + RemoveBrokenHediff(); + } + + public override void Tick() + { + base.Tick(); + if (pawn.IsHashIntervalTick(RESET_INTERVAL)) + RemoveBrokenHediff(); + } + + + + private void RemoveBrokenHediff() + { + // Clean-Up of existing feeling brokens + var maybeBrokenHediff = pawn.health.hediffSet.GetFirstHediffOfDef(xxx.feelingBroken); + if (maybeBrokenHediff != null) + { + pawn.health.RemoveHediff(maybeBrokenHediff); + } + } + } +} diff --git a/Source/Genes/GeneUtility.cs b/Source/Genes/GeneUtility.cs index ce022ba..c4150ad 100644 --- a/Source/Genes/GeneUtility.cs +++ b/Source/Genes/GeneUtility.cs @@ -67,5 +67,15 @@ namespace RJW_Genes } return pawn.genes.HasGene(GeneDefOf.rjw_genes_generous_donor); } + + public static bool IsUnbreakable(Pawn pawn) + { + if (pawn.genes == null) + { + return false; + } + return pawn.genes.HasGene(GeneDefOf.rjw_genes_unbreakable); + } + } } \ No newline at end of file