mirror of
https://gitgud.io/c0ffeeeeeeee/coffees-rjw-ideology-addons.git
synced 2024-08-14 23:57:38 +00:00
Hucow role and balancing
This commit is contained in:
parent
47291f333c
commit
e2d5daf97b
11 changed files with 143 additions and 12 deletions
|
@ -17,6 +17,36 @@ namespace CRIALactation
|
|||
public static class HarmonyPatch_Milk_HumanCompHasGatherableBodyResource
|
||||
{
|
||||
|
||||
public static void Prefix(HumanCompHasGatherableBodyResource __instance)
|
||||
{
|
||||
if (!__instance.parent.IsHashIntervalTick(100))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!(__instance.parent is Pawn)) return;
|
||||
|
||||
Pawn p = __instance.parent as Pawn;
|
||||
if (p?.health?.hediffSet == null) return;
|
||||
|
||||
if (p.Ideo?.GetRole(p) != null && p.Ideo.GetRole(p).def == PreceptDefOf_Lactation.IdeoRole_Hucow)
|
||||
{
|
||||
|
||||
if(p.health.hediffSet.HasHediff(HediffDef.Named("Lactating_Natural"), false))
|
||||
{
|
||||
p.health.RemoveHediff(p.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Lactating_Natural"), false));
|
||||
}
|
||||
if (p.health.hediffSet.HasHediff(HediffDef.Named("Lactating_Drug"), false))
|
||||
{
|
||||
p.health.RemoveHediff(p.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Lactating_Drug"), false));
|
||||
}
|
||||
if(!(p.health.hediffSet.HasHediff(HediffDef.Named("Lactating_Permanent"), false) ||
|
||||
p.health.hediffSet.HasHediff(HediffDef.Named("Heavy_Lactating_Permanent"), false)))
|
||||
{
|
||||
p.health.AddHediff(HediffDef.Named("Lactating_Permanent"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> codeInstructions)
|
||||
{
|
||||
|
||||
|
@ -52,7 +82,9 @@ namespace CRIALactation
|
|||
Pawn pawn = __instance.parent as Pawn;
|
||||
if(pawn.Ideo.HasPrecept(PreceptDefOf_Lactation.Lactating_Essential))
|
||||
{
|
||||
return resourcesIntervalDays * 0.666f; //1.5x normal rate
|
||||
|
||||
|
||||
return resourcesIntervalDays * 0.666f * ((pawn?.Ideo?.GetRole(pawn) != null && pawn.Ideo.GetRole(pawn).def == PreceptDefOf_Lactation.IdeoRole_Hucow) ? 0.5f : 1f); //1.5x normal rate
|
||||
}
|
||||
|
||||
return resourcesIntervalDays;
|
||||
|
@ -60,4 +92,30 @@ namespace CRIALactation
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(CompHyperMilkableHuman), "ResourceAmount", MethodType.Getter)]
|
||||
public static class HarmonyPatch_IncreaseYieldForHucowHyperMilkable
|
||||
{
|
||||
public static void Postfix(CompHyperMilkableHuman __instance, ref float __result)
|
||||
{
|
||||
Pawn p = __instance.parent as Pawn;
|
||||
if (p.Ideo.GetRole(p).def == PreceptDefOf_Lactation.IdeoRole_Hucow)
|
||||
{
|
||||
__result = 65;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(CompMilkableHuman), "ResourceAmount", MethodType.Getter)]
|
||||
public static class HarmonyPatch_IncreaseYieldForHucowMilkable
|
||||
{
|
||||
public static void Postfix(CompHyperMilkableHuman __instance, ref float __result)
|
||||
{
|
||||
Pawn p = __instance.parent as Pawn;
|
||||
if (p?.Ideo?.GetRole(p) != null && p.Ideo.GetRole(p).def == PreceptDefOf_Lactation.IdeoRole_Hucow)
|
||||
{
|
||||
__result = 45;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace CRIALactation
|
|||
}
|
||||
|
||||
public static PreceptDef Lactating_Essential;
|
||||
public static PreceptDef IdeoRole_Hucow;
|
||||
|
||||
}
|
||||
}
|
25
CRIALactation/Source/RoleEffects/RoleEffect_Hucow.cs
Normal file
25
CRIALactation/Source/RoleEffects/RoleEffect_Hucow.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using Milk;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace CRIALactation
|
||||
{
|
||||
public class RoleEffect_Hucow : RoleEffect
|
||||
{
|
||||
public override string Label(Pawn pawn, Precept_Role role)
|
||||
{
|
||||
return "Greatly increased milk yield, permenant lactation, slower speed";
|
||||
}
|
||||
|
||||
public RoleEffect_Hucow()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
using Milk;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace CRIALactation
|
||||
{
|
||||
public class RoleRequirement_Lactating : RoleRequirement
|
||||
{
|
||||
|
||||
public override string GetLabel(Precept_Role role)
|
||||
{
|
||||
return "must be lactating";
|
||||
}
|
||||
|
||||
public override bool Met(Pawn p, Precept_Role role)
|
||||
{
|
||||
if(LactationUtility.IsLactating(p))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue