Hucow role and balancing

This commit is contained in:
c0ffee12 2021-07-28 18:45:25 -07:00
parent 47291f333c
commit e2d5daf97b
11 changed files with 143 additions and 12 deletions

View File

@ -77,6 +77,8 @@
<Compile Include="Source\LactationUtility.cs" />
<Compile Include="Source\PreceptDefOf\PreceptDefOf_Lactation.cs" />
<Compile Include="Source\Precepts\Precept_Lactation.cs" />
<Compile Include="Source\RoleEffects\RoleEffect_Hucow.cs" />
<Compile Include="Source\RoleRequirements\RoleRequirement_Lactating.cs" />
<Compile Include="Source\Thoughts\ThoughtWorker_Precept_Lactating_Essential.cs" />
<Compile Include="Source\Thoughts\ThoughtWorker_Precept_Lactating_Essential_Social.cs" />
</ItemGroup>

View File

@ -1,30 +1,34 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<!--
<MemeGroupDef>
<defName>Sexuality</defName>
<drawOffset>(0.09, 0.33)</drawOffset>
<maxRows>1</maxRows>
</MemeGroupDef>
</MemeGroupDef>-->
<MemeDef>
<defName>Hucow</defName>
<label>hucow</label>
<description>Breast milk should be produced for and consumed by all.</description>
<iconPath>UI/Memes/PrimacyHuman</iconPath>
<groupDef>Sexuality</groupDef>
<groupDef>Misc</groupDef>
<impact>3</impact>
<renderOrder>50</renderOrder>
<requireOne>
<li>
<li>Lactating_Essential</li>
</li>
<li>
<li>IdeoRole_Hucow</li>
</li>
</requireOne>
<generalRules>
<rulesStrings>
<li>memeAdjective->ranch</li>
<li>memeAdjective->bovine</li>
<li>memeHyphenPrefix->lacto</li>
<li>memeConcept->human lactation</li>
<li>memeConcept->milk expression</li>
<li>memeLeaderNoun->rancher</li>
<li>memeLeaderNoun->hand</li>
<li>memeLeaderNoun->herder</li>

View File

@ -37,26 +37,26 @@
<stages>
<li>
<label>producing milk</label>
<description>Expressing milk for fills me with maternal pride.</description>
<baseMoodEffect>6</baseMoodEffect>
<description>Expressing milk fills me with maternal pride.</description>
<baseMoodEffect>3</baseMoodEffect>
</li>
<li>
<label>not producing milk</label>
<description>We live in such difficult times. I wish I could be producing milk right now.</description>
<baseMoodEffect>-6</baseMoodEffect>
<description>We live in such difficult times. It's wishful thinking, but I'd like to be producing milk right now.</description>
<baseMoodEffect>-2</baseMoodEffect>
</li>
<li>
<label>not producing milk</label>
<description>I'm as useless as a dry well. A healthy supply of my milk can benefit the colony, but I'm failing to deliver.</description>
<baseMoodEffect>-10</baseMoodEffect>
<baseMoodEffect>-5</baseMoodEffect>
</li>
<li>
<label>not producing milk</label>
<description>Producing milk is a basic responsibility. I'm embarrassed and ashamed to be dry.</description>
<baseMoodEffect>-16</baseMoodEffect>
<baseMoodEffect>-8</baseMoodEffect>
</li>
</stages>
</ThoughtDef>

View File

@ -3,13 +3,24 @@
<PreceptDef ParentName="PreceptRoleMultiBase">
<defName>IdeoRole_Hucow</defName>
<label>hucow</label>
<description>A special ideoligious status focusing on the production of breast milk. This specialized role gives greatly increased breast milk production speed and yield, at the cost of decreased global work speed.</description>
<description>A special ideoligious status focusing on the production of breast milk. This specialized role can only be given to lactating pawns and gives greatly increased breast milk production yield, at the cost of decreased work speed and movement speed.</description>
<iconPath>UI/Roles/SpecialistMelee</iconPath>
<nameMaker>NamerRoleMoralist</nameMaker>
<roleRequirements>
<li Class="CRIALactation.RoleRequirement_Lactating" />
</roleRequirements>
<requiredMemes>
<li>Hucow</li>
</requiredMemes>
<roleEffects>
<li Class="CRIALactation.RoleEffect_Hucow" />
<li Class="RoleEffect_PawnStatOffset">
<statDef>WorkSpeedGlobal</statDef>
<modifier>1.5</modifier>
<modifier>-0.5</modifier>
</li>
<li Class="RoleEffect_PawnStatFactor">
<statDef>MoveSpeed</statDef>
<modifier>-0.35</modifier>
</li>
</roleEffects>
<displayOrderInImpact>2</displayOrderInImpact>

View File

@ -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;
}
}
}
}

View File

@ -17,6 +17,7 @@ namespace CRIALactation
}
public static PreceptDef Lactating_Essential;
public static PreceptDef IdeoRole_Hucow;
}
}

View 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()
{
}
}
}

View File

@ -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;
}
}
}

Binary file not shown.