Orgasm Rush now adds a hediff

This commit is contained in:
Vegapnk 2023-01-06 09:45:03 +01:00
parent be36025325
commit aad8efa04e
4 changed files with 119 additions and 9 deletions

View file

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Genes
{
@ -14,6 +15,7 @@ namespace RJW_Genes
{
private const float REST_INCREASE = 0.05f;
private const float ORGASMS_NEEDED_FOR_SUPERCHARGE = 3.0f;
public static void Postfix(SexProps props)
{
@ -23,9 +25,37 @@ namespace RJW_Genes
if (props.pawn.genes != null && props.pawn.genes.HasGene(GeneDefOf.rjw_genes_orgasm_rush))
{
props.pawn.needs.rest.CurLevel += REST_INCREASE;
}
// Pump up Wake-Ness
if (props.pawn.needs.rest != null)
props.pawn.needs.rest.CurLevel += REST_INCREASE;
// Add or Update Hediff for Orgasm Rush
Hediff rush = GetOrgasmRushHediff(props.pawn);
float added_severity = props.orgasms / ORGASMS_NEEDED_FOR_SUPERCHARGE;
rush.Severity += added_severity;
// Severity should be capped to 1 by the XML logic
}
}
/// <summary>
/// Helps to get the Orgasm Rush Hediff of a Pawn. If it does not exist, one is added.
/// </summary>
/// <param name="orgasmed">The pawn that had the orgasm, for which a hediff is looked up or created.</param>
/// <returns></returns>
public static Hediff GetOrgasmRushHediff(Pawn orgasmed)
{
Hediff orgasmRushHediff = orgasmed.health.hediffSet.GetFirstHediffOfDef(GeneDefOf.rjw_genes_orgasm_rush_hediff);
if (orgasmRushHediff == null)
{
orgasmRushHediff = HediffMaker.MakeHediff(GeneDefOf.rjw_genes_orgasm_rush_hediff, orgasmed);
orgasmRushHediff.Severity = 0;
orgasmed.health.AddHediff(orgasmRushHediff);
}
return orgasmRushHediff;
}
}
}