mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Merge branch 'dev' into main
This commit is contained in:
commit
f3cc5e7ee2
39 changed files with 763 additions and 232 deletions
40
Source/Genes/Special/Patch_AgeDrain.cs
Normal file
40
Source/Genes/Special/Patch_AgeDrain.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using HarmonyLib;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RJW_Genes.Genes.Special
|
||||
{
|
||||
[HarmonyPatch(typeof(SexUtility), "Aftersex")]
|
||||
public static class Patch_AgeDrain
|
||||
{
|
||||
|
||||
const long AGE_TRANSFERED = 120000; // 120k == 2 days
|
||||
// 20 Years * 60 Days / Year * 60k Ticks/Day + 1 for safety
|
||||
const long MINIMUM_AGE = 20 * 60 * 60000 + 1;
|
||||
|
||||
// Comment Below in for debugging, changes years
|
||||
// const long AGE_TRANSFERED = 12000000;
|
||||
public static void Postfix(SexProps props)
|
||||
{
|
||||
if (props == null || props.pawn == null || props.partner == null || props.partner.IsAnimal() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (GeneUtility.IsAgeDrainer(props.pawn))
|
||||
{
|
||||
var pawnAge = props.pawn.ageTracker.AgeBiologicalTicks;
|
||||
//ModLog.Error($"Firing Age Drain \nMinimum Age is \t{MINIMUM_AGE} \nPawn Age is \t{pawnAge} \nTransferred \t{AGE_TRANSFERED}\nResulting in \t{pawnAge - AGE_TRANSFERED}");
|
||||
|
||||
// Make Partner older
|
||||
props.partner.ageTracker.AgeBiologicalTicks += AGE_TRANSFERED;
|
||||
// Make Pawn younger
|
||||
props.pawn.ageTracker.AgeBiologicalTicks = Math.Max(MINIMUM_AGE, (pawnAge - AGE_TRANSFERED));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
44
Source/Genes/Special/Patch_Youth_Fountain.cs
Normal file
44
Source/Genes/Special/Patch_Youth_Fountain.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
using HarmonyLib;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RJW_Genes.Genes.Special
|
||||
{
|
||||
[HarmonyPatch(typeof(SexUtility), "Aftersex")]
|
||||
public static class Patch_Youth_Fountain
|
||||
{
|
||||
|
||||
const long AGE_REDUCTION = 60000; // 60k == 1 day
|
||||
// 20 Years * 60 Days / Year * 60k Ticks/Day + 1 for safety
|
||||
const long MINIMUM_AGE = 20 * 60 * 60000 + 1;
|
||||
|
||||
// Comment Below in for debugging
|
||||
// const long AGE_REDUCTION = 6000000; // 6000k == 100 days
|
||||
public static void Postfix(SexProps props)
|
||||
{
|
||||
if (props == null || props.pawn == null || props.partner == null || props.partner.IsAnimal())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (GeneUtility.IsYouthFountain(props.pawn))
|
||||
{
|
||||
var partnerAge = props.partner.ageTracker.AgeBiologicalTicks;
|
||||
|
||||
//ModLog.Error($"Firing Youth Fountain \nMinimum Age is \t{MINIMUM_AGE}\t{ticksToYears(MINIMUM_AGE)}y\nPawn Age is \t{partnerAge}\t{ticksToYears(partnerAge)}y \nTransferred \t {AGE_REDUCTION}\t{ticksToYears(AGE_REDUCTION)}y\nResulting in \t{partnerAge - AGE_REDUCTION}\t{ticksToYears(partnerAge - AGE_REDUCTION)}y");
|
||||
|
||||
props.partner.ageTracker.AgeBiologicalTicks = Math.Max(MINIMUM_AGE, partnerAge - AGE_REDUCTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static float ticksToYears(long ticks)
|
||||
{
|
||||
return (ticks / 60000f) / 60f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue