Cumeater gene, fertilin craving hediff and thought

hediff and thought are just reflavored hemogen hediffs, in the future could customize them some more
This commit is contained in:
Shabakur 2023-01-17 16:44:08 +01:00
parent 5c0af8a430
commit 49cdc09e5f
22 changed files with 246 additions and 109 deletions

View file

@ -28,16 +28,21 @@ namespace RJW_Genes
{
float old_value = drain.Resource.Value;
drain.Resource.Value += offset;
//PostOffSetLifeForce(drain, old_value);
PostOffSetLifeForce(drain, old_value);
}
public static void PostOffSetLifeForce(IGeneResourceDrain drain, float old_value)
{
if (old_value > 0.2f && drain.Resource.Value <= 0.2f)
{
//Mood debuff
}
else if (old_value > 0f && drain.Resource.Value <= 0f)
{
Pawn pawn = drain.Pawn;
//Do things
if (!drain.Pawn.health.hediffSet.HasHediff(HediffDefOf.rjw_genes_fertilin_craving))
{
drain.Pawn.health.AddHediff(HediffDefOf.rjw_genes_fertilin_craving);
}
}
}

View file

@ -46,32 +46,19 @@ namespace RJW_Genes
{
yield return gizmo;
}
foreach (Gizmo gizmo2 in GeneResourceDrainUtility.GetResourceDrainGizmos(this))
{
yield return gizmo2;
}
yield break;
}
//Depending on how low the value is it will increase sexdrive and if it reaches zero it will create a mental break which will make the pawn rape others.
//Not using base.Tick() as it is used to start mental breaks, but we have another way to do it.
//every tick it decreases fertilin value and everyday if fertilin is below alert minimum there a ~50 chance for mental break
public override void Tick()
{
//base.Tick();
base.Tick();
if (this.CanOffset && this.Resource != null)
{
GeneUtility.OffsetLifeForce(this, -this.ResourceLossPerDay / 60000f);
//this.Resource.Value -= this.ResourceLossPerDay / 60000;
if (this.Resource.Value <= 0 && this.pawn.IsHashIntervalTick(300))
{
if (ModsConfig.BiotechActive && this.def.mentalBreakDef != null &&
this.pawn.Spawned && !this.pawn.InMentalState && !this.pawn.Downed &&
this.def.mentalBreakDef.Worker.BreakCanOccur(this.pawn))
{
this.def.mentalBreakDef.Worker.TryStart(this.pawn, "MentalStateReason_Gene".Translate() + ": " + this.LabelCap, false);
}
}
}
}
}
public bool StoredCumAllowed = true;

View file

@ -60,17 +60,6 @@ namespace RJW_Genes
}
}
public override IEnumerable<Gizmo> GetGizmos()
{
foreach (Gizmo gizmo in GeneResourceDrainUtility.GetResourceDrainGizmos(this))
{
yield return gizmo;
}
IEnumerator<Gizmo> enumerator = null;
yield break;
yield break;
}
[Unsaved(false)]
private Gene_LifeForce cachedLifeForceGene;

View file

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
namespace RJW_Genes
{
public class HediffCompProperties_SeverityFromFertilin : HediffCompProperties
{
public HediffCompProperties_SeverityFromFertilin()
{
this.compClass = typeof(HediffComp_SeverityFromFertilin);
}
// Token: 0x04001162 RID: 4450
public float severityPerHourEmpty;
// Token: 0x04001163 RID: 4451
public float severityPerHourHemogen;
}
}

View file

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
namespace RJW_Genes
{
public class HediffComp_SeverityFromFertilin : HediffComp
{
public HediffCompProperties_SeverityFromFertilin Props
{
get
{
return (HediffCompProperties_SeverityFromFertilin)this.props;
}
}
public override bool CompShouldRemove
{
get
{
Pawn_GeneTracker genes = base.Pawn.genes;
return ((genes != null) ? genes.GetFirstGeneOfType<Gene_LifeForce>() : null) == null;
}
}
private Gene_LifeForce LifeForce
{
get
{
if (this.cachedLifeForceGene == null)
{
this.cachedLifeForceGene = base.Pawn.genes.GetFirstGeneOfType<Gene_LifeForce>();
}
return this.cachedLifeForceGene;
}
}
public override void CompPostTick(ref float severityAdjustment)
{
base.CompPostTick(ref severityAdjustment);
severityAdjustment += ((this.LifeForce.Value > 0f) ? this.Props.severityPerHourHemogen : this.Props.severityPerHourEmpty) / 2500f;
this.MentalBreak();
}
public void MentalBreak()
{
if (cachedLifeForceGene.Resource.Value <= cachedLifeForceGene.Resource.MinLevelForAlert && this.Pawn.IsHashIntervalTick(2500) && Rand.Chance(0.03f)) //~50% chance each day for mental break
{
if (this.Pawn.genes.HasGene(GeneDefOf.rjw_genes_cum_eater)
|| this.Pawn.genes.HasGene(GeneDefOf.rjw_genes_vaginal_absorber) || this.Pawn.genes.HasGene(GeneDefOf.rjw_genes_anal_absorber) || this.Pawn.genes.HasGene(GeneDefOf.rjw_genes_drainer))
{
MentalBreakDef randomrape = GeneDefOf.rjw_genes_lifeforce_randomrape;
if (ModsConfig.BiotechActive &&
this.Pawn.Spawned && !this.Pawn.InMentalState && !this.Pawn.Downed &&
randomrape.Worker.BreakCanOccur(this.Pawn))
{
randomrape.Worker.TryStart(this.Pawn, "MentalBreakNoFertilin".Translate(), false);
}
}
}
}
private Gene_LifeForce cachedLifeForceGene;
}
}

View file

@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld;
using Verse;
namespace RJW_Genes
{
internal class HediffWithComps_tank : HediffWithComps
{
public override string LabelInBrackets
{
get
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append(base.LabelInBrackets);
stringBuilder.Append(this.Severity.ToStringPercent());
return stringBuilder.ToString();
}
}
}
}

View file

@ -12,7 +12,7 @@ namespace RJW_Genes
{
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{
if (GeneUtility.HasLifeForce(pawn))
if (GeneUtility.HasLifeForce(pawn) && GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_cum_eater))
{
float num = ingested.stackCount * this.FertilinPerUnit / 100;
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(pawn), num);

View file

@ -64,29 +64,29 @@ namespace RJW_Genes
//If we remove this check fertelin is always lost, but the succubus doesn't always gain any
if (absorb_factor != 0f)
{
AbsorbFertilin(props, absorb_factor);
TransferFertilin(props, absorb_factor);
}
if (GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_drainer) && !props.pawn.health.hediffSet.HasHediff(HediffDefOf.Succubus_Drained))
if (GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_drainer) && !props.pawn.health.hediffSet.HasHediff(HediffDefOf.rjw_genes_succubus_drained))
{
props.pawn.health.AddHediff(HediffDefOf.Succubus_Drained);
props.pawn.health.AddHediff(HediffDefOf.rjw_genes_succubus_drained);
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(succubus), 0.25f);
}
}
}
public static void AbsorbFertilin(SexProps props, float absorb_factor = 1f)
public static void TransferFertilin(SexProps props, float absorb_percentage = 1f)
{
Pawn_GeneTracker genes = props.partner.genes;
Gene_LifeForce gene = genes.GetFirstGeneOfType<Gene_LifeForce>();
Hediff fertilin_lost = props.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Fertilin_Lost);
Hediff fertilin_lost = props.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_fertilin_lost);
//Around quarter get ejected everytime pawn cums
float multiplier = Rand.Range(0.10f, 0.40f);
//Create a new ferilin_lost hediff or reduce multiplier
//Create a new ferilin_lost hediff or increase it
if (fertilin_lost == null)
{
Hediff new_fertilin_lost = HediffMaker.MakeHediff(HediffDefOf.Fertilin_Lost, props.pawn);
Hediff new_fertilin_lost = HediffMaker.MakeHediff(HediffDefOf.rjw_genes_fertilin_lost, props.pawn);
props.pawn.health.AddHediff(new_fertilin_lost);
new_fertilin_lost.Severity = multiplier;
}
@ -95,22 +95,35 @@ namespace RJW_Genes
multiplier *= 1 - fertilin_lost.Severity;
fertilin_lost.Severity += multiplier;
}
//More in the tank means more to give
if (props.pawn.Has(Quirk.Messy))
{
multiplier *= 2;
}
multiplier *= absorb_percentage;
//Currently taking the sum of all penises, maybe I should just consider one at random
float valuechange = CumUtility.GetTotalFluidAmount(props.pawn) / 100 * absorb_factor * multiplier;
float valuechange = TotalFertilinAmount(props, multiplier);
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(props.partner), valuechange);
//gene.Resource.Value += CumUtility.GetTotalFluidAmount(props.pawn) / 100 * absorb_factor * multiplier;
}
public static float TotalFertilinAmount(SexProps props, float multiplier)
{
float total_fluid = CumUtility.GetTotalFluidAmount(props.pawn) / 100;
//More in the tank means more to give
if (props.pawn.Has(Quirk.Messy))
{
total_fluid *= 2;
}
if (props.pawn.RaceProps.Animal)
{
total_fluid *= 0.1f; //Should make this settable in settings
}
return total_fluid;
}
public static float BaseDom(SexProps props, Pawn succubus)
{
float absorb_factor = 0f;
if (props.sexType == xxx.rjwSextype.Sixtynine)
if (props.sexType == xxx.rjwSextype.Sixtynine && GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_cum_eater))
{
absorb_factor += 1f;
}
@ -120,7 +133,8 @@ namespace RJW_Genes
public static float BaseSub(SexProps props, Pawn succubus)
{
float absorb_factor = 0f;
if (props.sexType == xxx.rjwSextype.Oral || props.sexType == xxx.rjwSextype.Fellatio || props.sexType == xxx.rjwSextype.Sixtynine)
if ((props.sexType == xxx.rjwSextype.Oral || props.sexType == xxx.rjwSextype.Fellatio || props.sexType == xxx.rjwSextype.Sixtynine)
&& GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_cum_eater))
{
absorb_factor += 1f;
}

View file

@ -24,7 +24,7 @@ namespace RJW_Genes
Pawn pawn2 = target as Pawn;
if (pawn2 != null)
{
//We need who the pawn on top is and if reverse we need to make the sub the pawn on top
//We need to know who the pawn on top is and if reverse we need to make the sub the pawn on top
if (__instance.Sexprops.isRevese)
{
@ -44,7 +44,7 @@ namespace RJW_Genes
public static void DrinkCumflation(Pawn dom, Pawn sub)
{
if (GeneUtility.HasLifeForce(sub) && dom.health.hediffSet.HasHediff(HediffDef.Named("Cumflation")))
if (GeneUtility.HasLifeForce(sub) && GeneUtility.HasGeneNullCheck(sub,GeneDefOf.rjw_genes_cum_eater)&& dom.health.hediffSet.HasHediff(HediffDef.Named("Cumflation")))
{
Hediff cumflation = dom.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Cumflation"));
Gene_LifeForce gene_LifeForce = sub.genes.GetFirstGeneOfType<Gene_LifeForce>();

View file

@ -12,7 +12,8 @@ namespace RJW_Genes
{
public override ThinkResult TryIssueJobPackage(Pawn pawn, JobIssueParams jobParams)
{
Pawn new_target = ValidTargets(pawn, pawn.Map).RandomElement();
List<Pawn> validTargets = ValidTargets(pawn, pawn.Map).ToList();
Pawn new_target = validTargets.NullOrEmpty() ? null : validTargets.RandomElement();
if (new_target != null)
{
pawn.mindState.duty.focus = new_target;

View file

@ -48,7 +48,7 @@ namespace RJW_Genes
//Applies or renews a hediff which increases sexdrive for 1 hours
private void InduceAphrodisiac(Pawn pawn, float sexfrequency)
{
Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Aphrodisiac_Pheromone);
Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_aphrodisiac_pheromone);
if (hediff != null)
{
@ -56,7 +56,7 @@ namespace RJW_Genes
}
else
{
Hediff aphrodisiac = HediffMaker.MakeHediff(HediffDefOf.Aphrodisiac_Pheromone, pawn);
Hediff aphrodisiac = HediffMaker.MakeHediff(HediffDefOf.rjw_genes_aphrodisiac_pheromone, pawn);
foreach (StatModifier stat in aphrodisiac.CurStage.statFactors)
{
if (stat.stat.defName == "SexFrequency")