mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Merge branch 'dev' into dev
This commit is contained in:
commit
6f2c4dc374
19 changed files with 444 additions and 77 deletions
|
@ -14,9 +14,8 @@ namespace RJW_Genes
|
|||
/// Normal Egg-Pregnancy logic is in https://gitgud.io/Ed86/rjw/-/blob/master/1.4/Source/Modules/Pregnancy/Pregnancy_Helper.cs
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(SexUtility), "Aftersex")]
|
||||
static class PatchEggFertilizationHelper
|
||||
static class Patch_EggFertilization
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
public static void Postfix(SexProps props)
|
||||
{
|
||||
// Only Fertilize on vaginal / anal sex
|
||||
|
@ -59,7 +58,7 @@ namespace RJW_Genes
|
|||
}
|
||||
|
||||
|
||||
private static Boolean canDoEggFertilization(Pawn a, Pawn b)
|
||||
private static bool canDoEggFertilization(Pawn a, Pawn b)
|
||||
{
|
||||
|
||||
// No Partner / Other Errors
|
||||
|
|
|
@ -10,8 +10,6 @@ namespace RJW_Genes
|
|||
/// </summary>
|
||||
public class Gene_Elasticity : Gene
|
||||
{
|
||||
|
||||
private int ticksToReset = RESET_INTERVAL;
|
||||
private const int RESET_INTERVAL = 60000; // 60k should be 1 day
|
||||
|
||||
public override void PostAdd()
|
||||
|
@ -26,11 +24,8 @@ namespace RJW_Genes
|
|||
public override void Tick()
|
||||
{
|
||||
base.Tick();
|
||||
--this.ticksToReset;
|
||||
if (this.ticksToReset > 0)
|
||||
return;
|
||||
this.ticksToReset = RESET_INTERVAL;
|
||||
ResetSeverity();
|
||||
if (pawn.IsHashIntervalTick(RESET_INTERVAL))
|
||||
ResetSeverity();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -86,6 +86,24 @@ namespace RJW_Genes
|
|||
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);
|
||||
}
|
||||
|
||||
internal 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)
|
||||
|
@ -139,5 +157,14 @@ namespace RJW_Genes
|
|||
}
|
||||
return pawn.genes.HasGene(GeneDefOf.rjw_genes_pussyhealer);
|
||||
}
|
||||
|
||||
public static bool IsUnbreakable(Pawn pawn)
|
||||
{
|
||||
if (pawn.genes == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return pawn.genes.HasGene(GeneDefOf.rjw_genes_unbreakable);
|
||||
}
|
||||
}
|
||||
}
|
38
Source/Genes/Special/Patch_AgeDrain.cs
Normal file
38
Source/Genes/Special/Patch_AgeDrain.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
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
|
||||
|
||||
// Comment Below in for debugging, changes years
|
||||
// const long AGE_TRANSFERED = 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.IsAgeDrainer(props.pawn))
|
||||
{
|
||||
var pawnAge = props.pawn.ageTracker.AgeBiologicalTicks;
|
||||
var pawnMinAge = props.pawn.ageTracker.AdultMinAgeTicks;
|
||||
|
||||
// Make Partner older
|
||||
props.partner.ageTracker.AgeBiologicalTicks += AGE_TRANSFERED;
|
||||
// Make Pawn younger
|
||||
props.pawn.ageTracker.AgeBiologicalTicks = Math.Max(pawnMinAge, 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
36
Source/Genes/Special/Patch_Youth_Fountain.cs
Normal file
36
Source/Genes/Special/Patch_Youth_Fountain.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
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
|
||||
|
||||
// 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;
|
||||
var minAge = props.partner.ageTracker.AdultMinAgeTicks;
|
||||
|
||||
props.partner.ageTracker.AgeBiologicalTicks = Math.Max(minAge, partnerAge - AGE_REDUCTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue