mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Added an Unbreakable Gene
This commit is contained in:
parent
75891ca0b3
commit
8e63e69385
6 changed files with 136 additions and 7 deletions
|
@ -11,4 +11,18 @@
|
||||||
<displayOrderInCategory>1</displayOrderInCategory>
|
<displayOrderInCategory>1</displayOrderInCategory>
|
||||||
</GeneDef>
|
</GeneDef>
|
||||||
|
|
||||||
|
<GeneDef >
|
||||||
|
<defName>rjw_genes_unbreakable</defName>
|
||||||
|
<label>Unbreakable</label>
|
||||||
|
<displayCategory>rjw_genes_damage</displayCategory>
|
||||||
|
<description>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.</description>
|
||||||
|
<iconPath>UI/Icons/Rituals/TrialDefend</iconPath>
|
||||||
|
<displayOrderInCategory>2</displayOrderInCategory>
|
||||||
|
<!-- Note: This Gene is mostly handled by patching XMLs -->
|
||||||
|
<geneClass>RJW_Genes.Gene_Unbreakable</geneClass>
|
||||||
|
<hediffGiversCannotGive>
|
||||||
|
<li>FeelingBroken</li>
|
||||||
|
</hediffGiversCannotGive>
|
||||||
|
</GeneDef>
|
||||||
|
|
||||||
</Defs>
|
</Defs>
|
68
Common/Patches/Genes/Patch_Unbreakable.xml
Normal file
68
Common/Patches/Genes/Patch_Unbreakable.xml
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<Patch>
|
||||||
|
|
||||||
|
<Operation Class="PatchOperationAdd">
|
||||||
|
<xpath>Defs/ThoughtDef[defName="FeelingBroken"]</xpath>
|
||||||
|
<value>
|
||||||
|
<nullifyingGenes>
|
||||||
|
<li>rjw_genes_unbreakable</li>
|
||||||
|
</nullifyingGenes>
|
||||||
|
</value>
|
||||||
|
</Operation>
|
||||||
|
|
||||||
|
|
||||||
|
<Operation Class="PatchOperationAdd">
|
||||||
|
<xpath>Defs/ThoughtDef[defName="GotRaped"]</xpath>
|
||||||
|
<value>
|
||||||
|
<nullifyingGenes>
|
||||||
|
<li>rjw_genes_unbreakable</li>
|
||||||
|
</nullifyingGenes>
|
||||||
|
</value>
|
||||||
|
</Operation>
|
||||||
|
|
||||||
|
<Operation Class="PatchOperationAdd">
|
||||||
|
<xpath>Defs/ThoughtDef[defName="GotAnalRaped"]</xpath>
|
||||||
|
<value>
|
||||||
|
<nullifyingGenes>
|
||||||
|
<li>rjw_genes_unbreakable</li>
|
||||||
|
</nullifyingGenes>
|
||||||
|
</value>
|
||||||
|
</Operation>
|
||||||
|
|
||||||
|
<Operation Class="PatchOperationAdd">
|
||||||
|
<xpath>Defs/ThoughtDef[defName="GotAnalRapedByFemale"]</xpath>
|
||||||
|
<value>
|
||||||
|
<nullifyingGenes>
|
||||||
|
<li>rjw_genes_unbreakable</li>
|
||||||
|
</nullifyingGenes>
|
||||||
|
</value>
|
||||||
|
</Operation>
|
||||||
|
|
||||||
|
<Operation Class="PatchOperationAdd">
|
||||||
|
<xpath>Defs/ThoughtDef[defName="GotRapedUnconscious"]</xpath>
|
||||||
|
<value>
|
||||||
|
<nullifyingGenes>
|
||||||
|
<li>rjw_genes_unbreakable</li>
|
||||||
|
</nullifyingGenes>
|
||||||
|
</value>
|
||||||
|
</Operation>
|
||||||
|
|
||||||
|
<Operation Class="PatchOperationAdd">
|
||||||
|
<xpath>Defs/ThoughtDef[defName="HateMyRapist"]</xpath>
|
||||||
|
<value>
|
||||||
|
<nullifyingGenes>
|
||||||
|
<li>rjw_genes_unbreakable</li>
|
||||||
|
</nullifyingGenes>
|
||||||
|
</value>
|
||||||
|
</Operation>
|
||||||
|
|
||||||
|
<Operation Class="PatchOperationAdd">
|
||||||
|
<xpath>Defs/ThoughtDef[defName="AllowedMeToGetRaped"]</xpath>
|
||||||
|
<value>
|
||||||
|
<nullifyingGenes>
|
||||||
|
<li>rjw_genes_unbreakable</li>
|
||||||
|
</nullifyingGenes>
|
||||||
|
</value>
|
||||||
|
</Operation>
|
||||||
|
|
||||||
|
</Patch>
|
|
@ -67,6 +67,7 @@ namespace RJW_Genes
|
||||||
|
|
||||||
// Damage & Side Effects
|
// Damage & Side Effects
|
||||||
[MayRequire("LustLicentia.RJWLabs")] public static readonly GeneDef rjw_genes_elasticity;
|
[MayRequire("LustLicentia.RJWLabs")] public static readonly GeneDef rjw_genes_elasticity;
|
||||||
|
public static readonly GeneDef rjw_genes_unbreakable;
|
||||||
|
|
||||||
// Special
|
// Special
|
||||||
public static readonly GeneDef rjw_genes_orgasm_rush;
|
public static readonly GeneDef rjw_genes_orgasm_rush;
|
||||||
|
|
|
@ -10,8 +10,6 @@ namespace RJW_Genes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Gene_Elasticity : Gene
|
public class Gene_Elasticity : Gene
|
||||||
{
|
{
|
||||||
|
|
||||||
private int ticksToReset = RESET_INTERVAL;
|
|
||||||
private const int RESET_INTERVAL = 60000; // 60k should be 1 day
|
private const int RESET_INTERVAL = 60000; // 60k should be 1 day
|
||||||
|
|
||||||
public override void PostAdd()
|
public override void PostAdd()
|
||||||
|
@ -26,11 +24,8 @@ namespace RJW_Genes
|
||||||
public override void Tick()
|
public override void Tick()
|
||||||
{
|
{
|
||||||
base.Tick();
|
base.Tick();
|
||||||
--this.ticksToReset;
|
if (pawn.IsHashIntervalTick(RESET_INTERVAL))
|
||||||
if (this.ticksToReset > 0)
|
ResetSeverity();
|
||||||
return;
|
|
||||||
this.ticksToReset = RESET_INTERVAL;
|
|
||||||
ResetSeverity();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PostRemove()
|
public override void PostRemove()
|
||||||
|
|
41
Source/Genes/Damage/Gene_Unbreakable.cs
Normal file
41
Source/Genes/Damage/Gene_Unbreakable.cs
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
using LicentiaLabs;
|
||||||
|
using rjw;
|
||||||
|
using Verse;
|
||||||
|
|
||||||
|
namespace RJW_Genes
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This Gene regularly removes the broken hediff of a pawn.
|
||||||
|
/// Blocking / Removing thoughts are done in an XML Patch.
|
||||||
|
/// </summary>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -67,5 +67,15 @@ namespace RJW_Genes
|
||||||
}
|
}
|
||||||
return pawn.genes.HasGene(GeneDefOf.rjw_genes_generous_donor);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue