Compare commits

..

No commits in common. "a72dc01d739576efee1f0ff1f393427b2d81e2c5" and "2380db1ce6e6567bc51477062bd08e74294b5d35" have entirely different histories.

10 changed files with 145 additions and 62 deletions

View file

@ -5,6 +5,7 @@
<randomChosen>true</randomChosen> <randomChosen>true</randomChosen>
<exclusionTags> <exclusionTags>
<li>Wing</li> <li>Wing</li>
<li>Wings</li>
</exclusionTags> </exclusionTags>
<graphicData> <graphicData>
<drawLoc>Tailbone</drawLoc> <drawLoc>Tailbone</drawLoc>

View file

@ -85,8 +85,6 @@ namespace RJW_Genes
public static readonly GeneDef rjw_genes_vaginal_absorber; public static readonly GeneDef rjw_genes_vaginal_absorber;
public static readonly GeneDef rjw_genes_anal_absorber; public static readonly GeneDef rjw_genes_anal_absorber;
public static readonly GeneDef rjw_genes_drainer; public static readonly GeneDef rjw_genes_drainer;
public static readonly GeneDef rjw_genes_seduce;
public static readonly GeneDef rjw_genes_paralysingkiss;
// Cosmetic // Cosmetic
public static readonly GeneDef rjw_genes_succubus_tail; public static readonly GeneDef rjw_genes_succubus_tail;
@ -98,5 +96,4 @@ namespace RJW_Genes
public static readonly MentalBreakDef rjw_genes_lifeforce_randomrape; public static readonly MentalBreakDef rjw_genes_lifeforce_randomrape;
} }
} }

View file

@ -6,6 +6,15 @@ namespace RJW_Genes
{ {
public class GeneUtility public class GeneUtility
{ {
//Instead of seperate functions this should be simpeler
public static bool HasGeneNullCheck(Pawn pawn, GeneDef genedef)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(genedef);
}
//Split function so I can offsetlifeforce from gene without needing to look for the gene agian (for the constant drain tick) //Split function so I can offsetlifeforce from gene without needing to look for the gene agian (for the constant drain tick)
public static Gene_LifeForce GetLifeForceGene(Pawn pawn) public static Gene_LifeForce GetLifeForceGene(Pawn pawn)
@ -26,11 +35,10 @@ namespace RJW_Genes
{ {
if (old_value > 0.2f && drain.Resource.Value <= 0.2f) if (old_value > 0.2f && drain.Resource.Value <= 0.2f)
{ {
//TODO: Mood debuff //Mood debuff
} }
else if (old_value > 0f && drain.Resource.Value <= 0f) else if (old_value > 0f && drain.Resource.Value <= 0f)
{ {
Pawn pawn = drain.Pawn;
if (!drain.Pawn.health.hediffSet.HasHediff(HediffDefOf.rjw_genes_fertilin_craving)) if (!drain.Pawn.health.hediffSet.HasHediff(HediffDefOf.rjw_genes_fertilin_craving))
{ {
drain.Pawn.health.AddHediff(HediffDefOf.rjw_genes_fertilin_craving); drain.Pawn.health.AddHediff(HediffDefOf.rjw_genes_fertilin_craving);
@ -38,6 +46,24 @@ namespace RJW_Genes
} }
} }
public static bool IsMechbreeder(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_mechbreeder);
}
public static bool HasLifeForce(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_lifeforce);
}
public static bool HasLowLifeForce(Pawn pawn) public static bool HasLowLifeForce(Pawn pawn)
{ {
if (HasLifeForce(pawn)) if (HasLifeForce(pawn))
@ -64,6 +90,42 @@ namespace RJW_Genes
return false; return false;
} }
public static bool IsInsectIncubator(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_insectincubator);
}
public static bool IsYouthFountain(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_youth_fountain);
}
public static bool IsAgeDrainer(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_sex_age_drain);
}
public static bool IsInsectBreeder(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_insectbreeder);
}
public static float MaxEggSizeMul(Pawn pawn) public static float MaxEggSizeMul(Pawn pawn)
{ {
float MaxEggSize = 1; float MaxEggSize = 1;
@ -73,6 +135,51 @@ namespace RJW_Genes
} }
return MaxEggSize; return MaxEggSize;
} }
internal static bool IsElastic(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_elasticity);
}
public static bool IsCumflationImmune(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_cumflation_immunity);
}
public static bool IsGenerousDonor(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_generous_donor);
}
public static bool isPussyHealer(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_pussyhealing);
}
public static bool IsUnbreakable(Pawn pawn)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(GeneDefOf.rjw_genes_unbreakable);
}
public static List<Gene_GenitaliaResizingGene> GetGenitaliaResizingGenes(Pawn pawn) public static List<Gene_GenitaliaResizingGene> GetGenitaliaResizingGenes(Pawn pawn)
{ {
var ResizingGenes = new List<Gene_GenitaliaResizingGene>(); var ResizingGenes = new List<Gene_GenitaliaResizingGene>();
@ -87,36 +194,5 @@ namespace RJW_Genes
return ResizingGenes; return ResizingGenes;
} }
/// <summary>
/// Unified small check for a pawn if it has a specified Gene.
/// Handles some errors and returns false as default.
/// </summary>
/// <param name="pawn">The pawn for which to look up a gene.</param>
/// <param name="genedef">The gene to look up.</param>
/// <returns></returns>
public static bool HasGeneNullCheck(Pawn pawn, GeneDef genedef)
{
if (pawn.genes == null)
{
return false;
}
return pawn.genes.HasGene(genedef);
}
public static bool HasLifeForce(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_lifeforce); }
public static bool IsMechbreeder(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_mechbreeder); }
public static bool IsInsectIncubator(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_insectincubator); }
public static bool IsYouthFountain(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_youth_fountain); }
public static bool IsAgeDrainer(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_sex_age_drain); }
public static bool IsInsectBreeder(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_insectbreeder); }
public static bool IsElastic(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_elasticity); }
public static bool IsCumflationImmune(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_cumflation_immunity); }
public static bool IsGenerousDonor(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_generous_donor); }
public static bool IsPussyHealer(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_pussyhealing); }
public static bool IsUnbreakable(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_unbreakable); }
public static bool HasParalysingKiss(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_paralysingkiss); }
public static bool HasSeduce(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_seduce); }
public static bool IsSexualDrainer(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_drainer); }
} }
} }

View file

@ -23,11 +23,11 @@ namespace RJW_Genes
FloatRange tendQualityRange; FloatRange tendQualityRange;
tendQualityRange.min = 0.4f; tendQualityRange.min = 0.4f;
tendQualityRange.max = 0.8f; tendQualityRange.max = 0.8f;
if (GeneUtility.IsPussyHealer(pawn)) if (GeneUtility.isPussyHealer(pawn))
{ {
Heal(partner, tendQualityRange); Heal(partner, tendQualityRange);
} }
if (GeneUtility.IsPussyHealer(partner)) if (GeneUtility.isPussyHealer(partner))
{ {
Heal(pawn, tendQualityRange); Heal(pawn, tendQualityRange);
} }

View file

@ -1,4 +1,9 @@
using Verse; using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using Verse;
using Verse.AI; using Verse.AI;
using RimWorld; using RimWorld;
namespace RJW_Genes namespace RJW_Genes

View file

@ -55,14 +55,6 @@ namespace RJW_Genes
} }
return false; return false;
} }
else if (GeneUtility.HasSeduce(pawn))
{
if (throwMessages)
{
Messages.Message(pawn.Name + " cannot be seduced, as they also have the Seduce-Ability", pawn, MessageTypeDefOf.RejectInput, false);
}
return false;
}
else if (pawn.Downed) else if (pawn.Downed)
{ {
if (throwMessages) if (throwMessages)

View file

@ -1,4 +1,10 @@
using System.Collections.Generic; using HarmonyLib;
using rjw;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse; using Verse;
using RimWorld; using RimWorld;
@ -7,13 +13,13 @@ namespace RJW_Genes
public class Gene_Aphrodisiac_Pheromones : Gene public class Gene_Aphrodisiac_Pheromones : Gene
{ {
// Summary: once every one hour check for all pawns nearby and in line of sight (same room) and add/renew a hediff which lasts for 1 hour. //Summary once every one hour check for all pawns nearby and in line of sight (same room) and add/renew a hediff which lasts for 1 hour.
public override void Tick() public override void Tick()
{ {
base.Tick(); base.Tick();
if (this.pawn.IsHashIntervalTick(2500) && this.pawn.Map != null) if (this.pawn.IsHashIntervalTick(2500) && this.pawn.Map != null)
{ {
// Only spread pheromones if sexdrive above 1 //Only spread pheromones if sexdrive above 1
float sexfrequency = this.pawn.GetStatValue(StatDef.Named("SexFrequency")); float sexfrequency = this.pawn.GetStatValue(StatDef.Named("SexFrequency"));
if(sexfrequency > 1f) if(sexfrequency > 1f)
{ {
@ -25,23 +31,21 @@ namespace RJW_Genes
} }
} }
// Creates an IEnumerable of all pawns which are closeby and in lineofsight, self and other pawns with aphrodisiac pheromones gene are skipped (to prevent loops). //Creatus an IEnumerable of all pawns which are closeby and in lineofsight, self and other pawns with aphrodisiac pheromones gene are skipped (to prevent loops).
private IEnumerable<Pawn> AffectedPawns(IntVec3 pos, Map map) private IEnumerable<Pawn> AffectedPawns(IntVec3 pos, Map map)
{ {
foreach (Pawn pawn in map.mapPawns.AllPawns) foreach (Pawn pawn in map.mapPawns.AllPawns)
{ {
if (pawn != null && this.pawn != null && pawn != this.pawn if (pawn != null && this.pawn != null && pawn != this.pawn && pos.DistanceTo(pawn.Position) < 5 && GenSight.LineOfSight(pos, pawn.Position, pawn.Map) && !GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_aphrodisiac_pheromones))
&& pos.DistanceTo(pawn.Position) < 5 && GenSight.LineOfSight(pos, pawn.Position, pawn.Map)
&& !GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_aphrodisiac_pheromones))
{ {
yield return pawn; yield return pawn;
} }
} }
//IEnumerator<Pawn> enumerator = null;
yield break; yield break;
} }
// Applies or renews a hediff which increases sexdrive for 6 hours //Applies or renews a hediff which increases sexdrive for 1 hours
private void InduceAphrodisiac(Pawn pawn, float sexfrequency) private void InduceAphrodisiac(Pawn pawn, float sexfrequency)
{ {
Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_aphrodisiac_pheromone); Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_aphrodisiac_pheromone);
@ -64,7 +68,7 @@ namespace RJW_Genes
} }
} }
// Function to modify aphrodisiac strength, currently has no effect, but provides an easy hook for other modders and patches. //Function to modify aphrodisiac strength, currently has no effect, but it's an easy hook for other modders.
public float ModifySexfrequency(Pawn pawn, float sexfrequency) public float ModifySexfrequency(Pawn pawn, float sexfrequency)
{ {
return sexfrequency; return sexfrequency;

View file

@ -1,9 +1,17 @@
using Verse; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
using rjw.Modules.Interactions; using rjw.Modules.Interactions;
using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Internals.Implementation;
using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Objects;
using rjw;
using rjw.Modules.Interactions.Enums;
//Modified code based of RJW-AI code at https://gitgud.io/Ed86/rjw-ia/-/tree/master/ //Modefied code based of RJW-AI code at https://gitgud.io/Ed86/rjw-ia/-/tree/master/
namespace RJW_Genes namespace RJW_Genes
{ {
[StaticConstructorOnStartup] [StaticConstructorOnStartup]
@ -17,6 +25,7 @@ namespace RJW_Genes
} }
} }
static SubSuccubusTailCustomRequirementHandler() static SubSuccubusTailCustomRequirementHandler()
{ {
Register(); Register();
@ -41,4 +50,3 @@ namespace RJW_Genes
//public static readonly StringListDef filter = DefDatabase<StringListDef>.GetNamed("SubSuccubusTailFilter"); //public static readonly StringListDef filter = DefDatabase<StringListDef>.GetNamed("SubSuccubusTailFilter");
} }
} }

View file

@ -162,7 +162,7 @@
<Compile Include="Genes\Life_Force\Gene_LifeForce.cs" /> <Compile Include="Genes\Life_Force\Gene_LifeForce.cs" />
<Compile Include="Genes\RJW_Gene.cs" /> <Compile Include="Genes\RJW_Gene.cs" />
<Compile Include="Genes\Genitalia\GenitaliaUtility.cs" /> <Compile Include="Genes\Genitalia\GenitaliaUtility.cs" />
<Compile Include="Genes\Special\Gene_Aphrodisiac_Pheromones.cs" /> <Compile Include="Genes\Special\Gene_Aphrodisiac_Pheromones_.cs" />
<Compile Include="Genes\Life_Force\Patch_LifeForce.cs" /> <Compile Include="Genes\Life_Force\Patch_LifeForce.cs" />
<Compile Include="Genes\Special\Patch_OrgasmRush.cs" /> <Compile Include="Genes\Special\Patch_OrgasmRush.cs" />
<Compile Include="Genes\Special\Patch_Youth_Fountain.cs" /> <Compile Include="Genes\Special\Patch_Youth_Fountain.cs" />