hucow changes

This commit is contained in:
c0ffee12 2021-08-02 11:55:46 -07:00
parent 064871641c
commit 5e807217bc
21 changed files with 373 additions and 23 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>C0ffeeRIA</identifier>
<version>0.0.2</version>
<version>0.0.3</version>
</Manifest>

View File

@ -78,6 +78,7 @@
<Folder Include="About\" />
</ItemGroup>
<ItemGroup>
<Content Include="CRIALactation\Defs\PreceptDefs\Precepts_Lactating_Role.xml" />
<Content Include="LoadFolders.xml" />
<Content Include="Textures\UI\Issues\Lactating.png" />
<Content Include="Textures\UI\Memes\Hucow.png" />

View File

@ -70,12 +70,16 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Source\CompProperties\CompAbilityEffects\CompProperties_AbilityConvertHucow.cs" />
<Compile Include="Source\CompProperties\CompProperties_InduceLactation.cs" />
<Compile Include="Source\Comps\CompAbilityEffects\CompAbilityEffect_ConvertHucow.cs" />
<Compile Include="Source\Comps\CompInduceLactation.cs" />
<Compile Include="Source\HarmonyPatches\HarmonyPatch_Ideo.cs" />
<Compile Include="Source\HarmonyPatches\Harmony_PatchAll.cs" />
<Compile Include="Source\HarmonyPatches\RJW\HarmonyPatch_Milk_HumanCompHasGatherableBodyResource.cs" />
<Compile Include="Source\HediffDefOf\HediffDefOf_Milk.cs" />
<Compile Include="Source\Hediffs\HediffCompProperties_StopOnceNotLactating.cs" />
<Compile Include="Source\Hediffs\HediffComp_StopOnceNotLactating.cs" />
<Compile Include="Source\JobDefOf\JobDefOf_CRIALactation.cs" />
<Compile Include="Source\JobDrivers\JobDriver_MassageBreasts.cs" />
<Compile Include="Source\LactationUtility.cs" />
@ -83,16 +87,20 @@
<Compile Include="Source\Precepts\Precept_Lactation.cs" />
<Compile Include="Source\RoleEffects\RoleEffect_Hucow.cs" />
<Compile Include="Source\RoleRequirements\RoleRequirement_Lactating.cs" />
<Compile Include="Source\StatDefOf\StatDefOf_Lactation.cs" />
<Compile Include="Source\Thoughts\ThoughtWorker_Precept_Lactating_Essential.cs" />
<Compile Include="Source\Thoughts\ThoughtWorker_Precept_Lactating_Essential_Social.cs" />
<Compile Include="Source\WorkGivers\WorkGiver_MassageBreasts.cs" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="Defs\AbilityDefs\Abilities_Hucow.xml" />
<Content Include="Defs\HediffDefs\Hediffs_Hucow.xml" />
<Content Include="Defs\JobDefs\Jobs_CRIALactation.xml" />
<Content Include="Defs\MemeDefs\Memes_Hucow.xml" />
<Content Include="Defs\PreceptDefs\Precepts_Lactating.xml" />
<Content Include="Defs\PreceptDefs\Precepts_Lactating_Role.xml" />
<Content Include="Defs\StatDefs\Stats_Milk_Production.xml" />
<Content Include="Defs\WorkGiverDefs\WorkGiver_MassageBreasts.xml" />
<Content Include="Patches\Patch_LactationInduction.xml" />
<Content Include="UI\Issues\Lactating.png" />

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<AbilityDef>
<defName>ConvertToHucow</defName>
<label>convert to hucow</label>
<description>Multiply this pawn's lactation duration and amplify their production for as long as they are lactating.</description>
<jobDef>CastAbilityOnThingMelee</jobDef>
<iconPath>UI/Abilities/WorkDrive</iconPath>
<warmupMoteSocialSymbol>UI/Issues/Lactating</warmupMoteSocialSymbol>
<stunTargetWhileCasting>True</stunTargetWhileCasting>
<showPsycastEffects>False</showPsycastEffects>
<displayGizmoWhileUndrafted>True</displayGizmoWhileUndrafted>
<disableGizmoWhileUndrafted>False</disableGizmoWhileUndrafted>
<hotKey>Misc12</hotKey>
<uiOrder>4</uiOrder>
<warmupStartSound>WorkDrive_Warmup</warmupStartSound>
<statBases>
<Ability_Duration>3000</Ability_Duration>
</statBases>
<verbProperties>
<verbClass>Verb_CastAbilityTouch</verbClass>
<drawAimPie>False</drawAimPie>
<range>-1</range>
<warmupTime>3.0</warmupTime>
<targetParams>
<canTargetAnimals>false</canTargetAnimals>
<canTargetSelf>true</canTargetSelf>
<canTargetBuildings>false</canTargetBuildings>
<canTargetMechs>false</canTargetMechs>
<onlyTargetColonists>true</onlyTargetColonists>
</targetParams>
</verbProperties>
<comps>
<li Class="CompProperties_AbilityGiveHediff">
<compClass>CompAbilityEffect_GiveHediff</compClass>
<hediffDef>Hucow</hediffDef>
<applicableToMechs>False</applicableToMechs>
</li>
<li Class="CRIALactation.CompProperties_AbilityConvertHucow" />
</comps>
</AbilityDef>
</Defs>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<HediffDef ParentName="RoleStatBuff">
<defName>Hucow</defName>
<label>Hucow</label>
<description>This person has been converted to a hucow thanks to someone using the convert to hucow ability. As a result, lactation production speed and yield have been increased, but work and movement speed have been decreased.</description>
<hediffClass>HediffWithComps</hediffClass>
<comps>
<li Class="HediffCompProperties_DisappearsOnDeath" />
<li Class="CRIALactation.HediffCompProperties_StopOnceNotLactating" />
</comps>
<isBad>false</isBad>
<stages>
<li>
<statFactors>
<MilkProductionYield>3.75</MilkProductionYield>
<MilkProductionSpeed>0.5</MilkProductionSpeed>
<WorkSpeedGlobal>0.25</WorkSpeedGlobal>
<MoveSpeed>0.6</MoveSpeed>
</statFactors>
</li>
</stages>
</HediffDef>
</Defs>

View File

@ -20,7 +20,7 @@
<li>Lactating_Essential</li>
</li>
<li>
<li>IdeoRole_Hucow</li>
<li>IdeoRole_HucowHandler</li>
</li>
</requireOne>
<generalRules>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<!--
<PreceptDef ParentName="PreceptRoleMultiBase">
<defName>IdeoRole_Hucow</defName>
<label>hucow</label>
@ -28,4 +29,102 @@
<li>Hucow</li>
</roleTags>
</PreceptDef>
-->
<PreceptDef ParentName="PreceptRoleSingleBase">
<defName>IdeoRole_HucowHandler</defName>
<label>hucow handler</label>
<description>A special ideoligious status which can convert lactating pawns to hucows, increasing their lactation yield at the cost of their work and movement speed.</description>
<iconPath>UI/Roles/SpecialistMelee</iconPath>
<nameMaker>NamerRoleMoralist</nameMaker>
<roleTags>
<li>HucowHandler</li>
</roleTags>
<roleRequirements>
<li Class="RoleRequirement_SameIdeo">
<labelKey>RoleRequirementLabelSameIdeo</labelKey>
</li>
</roleRequirements>
<roleApparelRequirements>
<li>
<requirement>
<bodyPartGroupsMatchAny>
<li>UpperHead</li>
<li>FullHead</li>
</bodyPartGroupsMatchAny>
<requiredDefs>
<li>Apparel_Headwrap</li>
</requiredDefs>
</requirement>
</li>
<li>
<requirement>
<bodyPartGroupsMatchAny>
<li>UpperHead</li>
<li>FullHead</li>
</bodyPartGroupsMatchAny>
<requiredDefs>
<li>Apparel_Broadwrap</li>
</requiredDefs>
</requirement>
</li>
<li>
<requirement>
<bodyPartGroupsMatchAny>
<li>Torso</li>
<li>Neck</li>
<li>Shoulders</li>
<li>Arms</li>
<li>Legs</li>
</bodyPartGroupsMatchAny>
<requiredDefs>
<li>Apparel_Robe</li>
</requiredDefs>
</requirement>
</li>
<li>
<requirement>
<bodyPartGroupsMatchAny>
<li>UpperHead</li>
</bodyPartGroupsMatchAny>
<requiredDefs>
<li>Apparel_HatHood</li>
</requiredDefs>
</requirement>
</li>
<li>
<requirement>
<bodyPartGroupsMatchAny>
<li>UpperHead</li>
</bodyPartGroupsMatchAny>
<requiredDefs>
<li>Apparel_BowlerHat</li>
</requiredDefs>
</requirement>
</li>
<li MayRequire="Ludeon.RimWorld.Royalty">
<requirement>
<bodyPartGroupsMatchAny>
<li>Torso</li>
</bodyPartGroupsMatchAny>
<requiredTags>
<li>Cape</li>
</requiredTags>
</requirement>
</li>
</roleApparelRequirements>
<roleApparelRequirementCountCurve>
<points>
<li>(0, 1)</li>
<li>(1, 1)</li>
</points>
</roleApparelRequirementCountCurve>
<requiredMemes>
<li>Hucow</li>
</requiredMemes>
<grantedAbilities>
<li>ConvertToHucow</li>
</grantedAbilities>
<displayOrderInImpact>2</displayOrderInImpact>
</PreceptDef>
</Defs>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<StatDef>
<defName>MilkProductionSpeed</defName>
<label>milk production speed multiplier</label>
<minValue>0.001</minValue>
<category>BasicsPawn</category>
<toStringStyle>PercentZero</toStringStyle>
<hideAtValue>1</hideAtValue>
<defaultBaseValue>1</defaultBaseValue>
<showOnAnimals>false</showOnAnimals>
<showOnMechanoids>false</showOnMechanoids>
<displayPriorityInCategory>10000</displayPriorityInCategory>
</StatDef>
<StatDef>
<defName>MilkProductionYield</defName>
<label>milk production yield multiplier</label>
<toStringStyle>PercentZero</toStringStyle>
<minValue>1</minValue>
<category>BasicsPawn</category>
<hideAtValue>1</hideAtValue>
<defaultBaseValue>1</defaultBaseValue>
<showOnAnimals>false</showOnAnimals>
<showOnMechanoids>false</showOnMechanoids>
<displayPriorityInCategory>10001</displayPriorityInCategory>
</StatDef>
</Defs>

View File

@ -0,0 +1,23 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
using rjw;
using Milk;
using UnityEngine;
namespace CRIALactation
{
public class CompProperties_AbilityConvertHucow : CompProperties_AbilityEffect
{
public CompProperties_AbilityConvertHucow()
{
this.compClass = typeof(CompAbilityEffect_ConvertHucow);
}
}
}

View File

@ -0,0 +1,35 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
using rjw;
using Milk;
using UnityEngine;
namespace CRIALactation
{
public class CompAbilityEffect_ConvertHucow : CompAbilityEffect
{
public override bool Valid(LocalTargetInfo target, bool throwMessages = false)
{
Pawn pawn = target.Pawn;
return pawn != null && AbilityUtility.ValidateMustBeHuman(pawn, throwMessages) &&
AbilityUtility.ValidateNoMentalState(pawn, throwMessages) &&
AbilityUtility.ValidateSameIdeo(this.parent.pawn, pawn, throwMessages) &&
LactationUtility.IsLactating(pawn) &&
!LactationUtility.IsHucow(pawn);
}
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
{
base.Apply(target, dest);
Pawn pawn = target.Pawn;
LactationUtility.ExtendLactationDuration(pawn);
}
}
}

View File

@ -24,21 +24,20 @@ namespace CRIALactation
base.CompTick();
Pawn p = this.parent as Pawn;
if (!isActive)
{
return;
}
if (!p.IsHashIntervalTick(100))
{
return;
}
if (LactationUtility.IsLactating(p))
{
InductionCompletionPercent = 0.8f;
isActive = false;
return;
}
if (!isActive)
{
return;
}
if(TicksSinceLastMassage + OneDayInTicks / Props.TimesMassagedADay < GenTicks.TicksGame)
{
CanMassage = true;
@ -53,7 +52,7 @@ namespace CRIALactation
LactationUtility.StartLactating(p, true);
isActive = false;
InductionCompletionPercent = 0.6f; //start at 60% in case they ever lose lactating again
InductionCompletionPercent = 0.80f; //start at 80% in case they ever lose lactating again
}
}

View File

@ -16,7 +16,7 @@ namespace CRIALactation
[HarmonyPatch(typeof(HumanCompHasGatherableBodyResource), "CompTick")]
public static class HarmonyPatch_Milk_HumanCompHasGatherableBodyResource
{
/*
public static void Prefix(HumanCompHasGatherableBodyResource __instance)
{
if (!__instance.parent.IsHashIntervalTick(100))
@ -45,7 +45,7 @@ namespace CRIALactation
p.health.AddHediff(HediffDef.Named("Lactating_Permanent"));
}
}
}
}*/
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> codeInstructions)
{
@ -84,7 +84,7 @@ namespace CRIALactation
{
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 * 0.666f * pawn.GetStatValue(StatDefOf_Lactation.MilkProductionSpeed); //1.5x normal rate
}
return resourcesIntervalDays;
@ -99,10 +99,7 @@ namespace CRIALactation
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 = 45;
}
__result *= p.GetStatValue(StatDefOf_Lactation.MilkProductionYield);
}
}
@ -112,10 +109,7 @@ namespace CRIALactation
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;
}
__result *= p.GetStatValue(StatDefOf_Lactation.MilkProductionYield);
}
}
}

View File

@ -19,6 +19,7 @@ namespace CRIALactation
public static HediffDef Lactating_Permanent;
public static HediffDef Heavy_Lactating_Permanent;
public static HediffDef Lactating_Natural;
public static HediffDef Hucow;

View File

@ -0,0 +1,19 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace CRIALactation
{
public class HediffCompProperties_StopOnceNotLactating : HediffCompProperties
{
public HediffCompProperties_StopOnceNotLactating()
{
this.compClass = typeof(HediffComp_StopOnceNotLactating);
}
}
}

View File

@ -0,0 +1,26 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace CRIALactation
{
public class HediffComp_StopOnceNotLactating : HediffComp
{
public override void CompPostTick(ref float severityAdjustment)
{
base.CompPostTick(ref severityAdjustment);
if(!LactationUtility.IsLactating(Pawn))
{
LactationUtility.StopBeingHucow(Pawn);
}
}
}
}

View File

@ -41,6 +41,16 @@ namespace CRIALactation
p.health.AddHediff(lactating, Genital_Helper.get_breastsBPR(p));
}
public static void StopBeingHucow(Pawn p)
{
p.health.RemoveHediff(p.health.hediffSet.GetFirstHediffOfDef(HediffDefOf_Milk.Hucow, false));
}
public static bool IsHucow(Pawn p)
{
return p.health.hediffSet.HasHediff(HediffDefOf_Milk.Hucow);
}
public static bool isMassageable(Pawn p)
{
CompInduceLactation c = p.TryGetComp<CompInduceLactation>();
@ -52,5 +62,22 @@ namespace CRIALactation
return false;
}
public static void ExtendLactationDuration(Pawn p)
{
var drugLact = p.health.hediffSet.GetFirstHediffOfDef(HediffDefOf_Milk.Lactating_Drug);
if(drugLact != null)
{
drugLact.TryGetComp<HediffComp_Disappears>().ticksToDisappear = 600000;
}
var naturalLact = p.health.hediffSet.GetFirstHediffOfDef(HediffDefOf_Milk.Lactating_Natural);
if (naturalLact != null)
{
naturalLact.TryGetComp<HediffComp_Disappears>().ticksToDisappear = 600000;
}
}
}
}

View File

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

View File

@ -0,0 +1,24 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace CRIALactation
{
[DefOf]
public static class StatDefOf_Lactation
{
static StatDefOf_Lactation()
{
DefOfHelper.EnsureInitializedInCtor(typeof(StatDefOf_Lactation));
}
public static StatDef MilkProductionSpeed;
public static StatDef MilkProductionYield;
}
}

View File

@ -18,11 +18,11 @@ namespace C0ffee_s_RJW_Ideology_Addons
string missingSoftDependencies = "";
if (LoadedModManager.RunningModsListForReading.Any((ModContentPack x) => x.PackageId == "c0ffee.rjw.events"))
if (!LoadedModManager.RunningModsListForReading.Any((ModContentPack x) => x.PackageId == "c0ffee.rjw.events"))
{
missingSoftDependencies += "missing RJW Events, orgies will NOT be included; ";
}
if (LoadedModManager.RunningModsListForReading.Any((ModContentPack x) => x.PackageId == "rjw.milk.humanoid"))
if (!LoadedModManager.RunningModsListForReading.Any((ModContentPack x) => x.PackageId == "rjw.milk.humanoid"))
{
missingSoftDependencies += "missing RJW Milkable Colonists, hucow and lactation will NOT be included; ";
}