diff --git a/1.3/Assemblies/C0ffee's RJW Ideology Addons.dll b/1.3/Assemblies/C0ffee's RJW Ideology Addons.dll index fa82d9f..4106e9a 100644 Binary files a/1.3/Assemblies/C0ffee's RJW Ideology Addons.dll and b/1.3/Assemblies/C0ffee's RJW Ideology Addons.dll differ diff --git a/About/Manifest.xml b/About/Manifest.xml index a2ef9f6..5e18089 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,5 +1,5 @@ C0ffeeRIA - 0.0.2 + 0.0.3 diff --git a/C0ffee's RJW Ideology Addons.csproj b/C0ffee's RJW Ideology Addons.csproj index 82921a5..805da46 100644 --- a/C0ffee's RJW Ideology Addons.csproj +++ b/C0ffee's RJW Ideology Addons.csproj @@ -78,6 +78,7 @@ + diff --git a/CRIALactation/1.3/Assemblies/CRIALactation.dll b/CRIALactation/1.3/Assemblies/CRIALactation.dll index cd02947..b03cbe7 100644 Binary files a/CRIALactation/1.3/Assemblies/CRIALactation.dll and b/CRIALactation/1.3/Assemblies/CRIALactation.dll differ diff --git a/CRIALactation/CRIALactation.csproj b/CRIALactation/CRIALactation.csproj index 1310da5..f05328d 100644 --- a/CRIALactation/CRIALactation.csproj +++ b/CRIALactation/CRIALactation.csproj @@ -70,12 +70,16 @@ + + + + @@ -83,16 +87,20 @@ + + + + diff --git a/CRIALactation/Defs/AbilityDefs/Abilities_Hucow.xml b/CRIALactation/Defs/AbilityDefs/Abilities_Hucow.xml new file mode 100644 index 0000000..f16e646 --- /dev/null +++ b/CRIALactation/Defs/AbilityDefs/Abilities_Hucow.xml @@ -0,0 +1,42 @@ + + + + ConvertToHucow + + Multiply this pawn's lactation duration and amplify their production for as long as they are lactating. + CastAbilityOnThingMelee + UI/Abilities/WorkDrive + UI/Issues/Lactating + True + False + True + False + Misc12 + 4 + WorkDrive_Warmup + + 3000 + + + Verb_CastAbilityTouch + False + -1 + 3.0 + + false + true + false + false + true + + + +
  • + CompAbilityEffect_GiveHediff + Hucow + False +
  • +
  • + + + \ No newline at end of file diff --git a/CRIALactation/Defs/HediffDefs/Hediffs_Hucow.xml b/CRIALactation/Defs/HediffDefs/Hediffs_Hucow.xml new file mode 100644 index 0000000..4b4ee7b --- /dev/null +++ b/CRIALactation/Defs/HediffDefs/Hediffs_Hucow.xml @@ -0,0 +1,24 @@ + + + + Hucow + + 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. + HediffWithComps + +
  • +
  • + + false + +
  • + + 3.75 + 0.5 + 0.25 + 0.6 + +
  • + + +
    diff --git a/CRIALactation/Defs/MemeDefs/Memes_Hucow.xml b/CRIALactation/Defs/MemeDefs/Memes_Hucow.xml index ef4a33e..f70d22a 100644 --- a/CRIALactation/Defs/MemeDefs/Memes_Hucow.xml +++ b/CRIALactation/Defs/MemeDefs/Memes_Hucow.xml @@ -20,7 +20,7 @@
  • Lactating_Essential
  • -
  • IdeoRole_Hucow
  • +
  • IdeoRole_HucowHandler
  • diff --git a/CRIALactation/Defs/PreceptDefs/Precepts_Lactating_Role.xml b/CRIALactation/Defs/PreceptDefs/Precepts_Lactating_Role.xml index b604593..465ae3c 100644 --- a/CRIALactation/Defs/PreceptDefs/Precepts_Lactating_Role.xml +++ b/CRIALactation/Defs/PreceptDefs/Precepts_Lactating_Role.xml @@ -1,5 +1,6 @@  + + + IdeoRole_HucowHandler + + A special ideoligious status which can convert lactating pawns to hucows, increasing their lactation yield at the cost of their work and movement speed. + UI/Roles/SpecialistMelee + NamerRoleMoralist + +
  • HucowHandler
  • +
    + +
  • + RoleRequirementLabelSameIdeo +
  • +
    + +
  • + + +
  • UpperHead
  • +
  • FullHead
  • + + +
  • Apparel_Headwrap
  • +
    + + +
  • + + +
  • UpperHead
  • +
  • FullHead
  • + + +
  • Apparel_Broadwrap
  • +
    + + +
  • + + +
  • Torso
  • +
  • Neck
  • +
  • Shoulders
  • +
  • Arms
  • +
  • Legs
  • + + +
  • Apparel_Robe
  • +
    + + +
  • + + +
  • UpperHead
  • + + +
  • Apparel_HatHood
  • +
    + + +
  • + + +
  • UpperHead
  • + + +
  • Apparel_BowlerHat
  • +
    + + +
  • + + +
  • Torso
  • + + +
  • Cape
  • +
    + + +
    + + +
  • (0, 1)
  • +
  • (1, 1)
  • +
    +
    + +
  • Hucow
  • +
    + +
  • ConvertToHucow
  • +
    + 2 +
    +
    diff --git a/CRIALactation/Defs/StatDefs/Stats_Milk_Production.xml b/CRIALactation/Defs/StatDefs/Stats_Milk_Production.xml new file mode 100644 index 0000000..9dedbf6 --- /dev/null +++ b/CRIALactation/Defs/StatDefs/Stats_Milk_Production.xml @@ -0,0 +1,28 @@ + + + + MilkProductionSpeed + + 0.001 + BasicsPawn + PercentZero + 1 + 1 + false + false + 10000 + + + + MilkProductionYield + + PercentZero + 1 + BasicsPawn + 1 + 1 + false + false + 10001 + + diff --git a/CRIALactation/Source/CompProperties/CompAbilityEffects/CompProperties_AbilityConvertHucow.cs b/CRIALactation/Source/CompProperties/CompAbilityEffects/CompProperties_AbilityConvertHucow.cs new file mode 100644 index 0000000..0995d5c --- /dev/null +++ b/CRIALactation/Source/CompProperties/CompAbilityEffects/CompProperties_AbilityConvertHucow.cs @@ -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); + } + + } +} diff --git a/CRIALactation/Source/Comps/CompAbilityEffects/CompAbilityEffect_ConvertHucow.cs b/CRIALactation/Source/Comps/CompAbilityEffects/CompAbilityEffect_ConvertHucow.cs new file mode 100644 index 0000000..9d6d4cc --- /dev/null +++ b/CRIALactation/Source/Comps/CompAbilityEffects/CompAbilityEffect_ConvertHucow.cs @@ -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); + } + } +} diff --git a/CRIALactation/Source/Comps/CompInduceLactation.cs b/CRIALactation/Source/Comps/CompInduceLactation.cs index 30cd797..be442d2 100644 --- a/CRIALactation/Source/Comps/CompInduceLactation.cs +++ b/CRIALactation/Source/Comps/CompInduceLactation.cs @@ -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 } } diff --git a/CRIALactation/Source/HarmonyPatches/RJW/HarmonyPatch_Milk_HumanCompHasGatherableBodyResource.cs b/CRIALactation/Source/HarmonyPatches/RJW/HarmonyPatch_Milk_HumanCompHasGatherableBodyResource.cs index f2a9ed0..2294cf9 100644 --- a/CRIALactation/Source/HarmonyPatches/RJW/HarmonyPatch_Milk_HumanCompHasGatherableBodyResource.cs +++ b/CRIALactation/Source/HarmonyPatches/RJW/HarmonyPatch_Milk_HumanCompHasGatherableBodyResource.cs @@ -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 Transpiler(IEnumerable 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); } } } diff --git a/CRIALactation/Source/HediffDefOf/HediffDefOf_Milk.cs b/CRIALactation/Source/HediffDefOf/HediffDefOf_Milk.cs index 385dfd3..a722532 100644 --- a/CRIALactation/Source/HediffDefOf/HediffDefOf_Milk.cs +++ b/CRIALactation/Source/HediffDefOf/HediffDefOf_Milk.cs @@ -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; diff --git a/CRIALactation/Source/Hediffs/HediffCompProperties_StopOnceNotLactating.cs b/CRIALactation/Source/Hediffs/HediffCompProperties_StopOnceNotLactating.cs new file mode 100644 index 0000000..95a40bb --- /dev/null +++ b/CRIALactation/Source/Hediffs/HediffCompProperties_StopOnceNotLactating.cs @@ -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); + } + } +} diff --git a/CRIALactation/Source/Hediffs/HediffComp_StopOnceNotLactating.cs b/CRIALactation/Source/Hediffs/HediffComp_StopOnceNotLactating.cs new file mode 100644 index 0000000..2e1d409 --- /dev/null +++ b/CRIALactation/Source/Hediffs/HediffComp_StopOnceNotLactating.cs @@ -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); + + } + } + + } +} diff --git a/CRIALactation/Source/LactationUtility.cs b/CRIALactation/Source/LactationUtility.cs index f514441..ca967a5 100644 --- a/CRIALactation/Source/LactationUtility.cs +++ b/CRIALactation/Source/LactationUtility.cs @@ -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(); @@ -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().ticksToDisappear = 600000; + } + + var naturalLact = p.health.hediffSet.GetFirstHediffOfDef(HediffDefOf_Milk.Lactating_Natural); + if (naturalLact != null) + { + naturalLact.TryGetComp().ticksToDisappear = 600000; + } + + } } } diff --git a/CRIALactation/Source/PreceptDefOf/PreceptDefOf_Lactation.cs b/CRIALactation/Source/PreceptDefOf/PreceptDefOf_Lactation.cs index 9fd0b93..ac0a438 100644 --- a/CRIALactation/Source/PreceptDefOf/PreceptDefOf_Lactation.cs +++ b/CRIALactation/Source/PreceptDefOf/PreceptDefOf_Lactation.cs @@ -17,7 +17,7 @@ namespace CRIALactation } public static PreceptDef Lactating_Essential; - public static PreceptDef IdeoRole_Hucow; + //public static PreceptDef IdeoRole_Hucow; } } \ No newline at end of file diff --git a/CRIALactation/Source/StatDefOf/StatDefOf_Lactation.cs b/CRIALactation/Source/StatDefOf/StatDefOf_Lactation.cs new file mode 100644 index 0000000..32d94a0 --- /dev/null +++ b/CRIALactation/Source/StatDefOf/StatDefOf_Lactation.cs @@ -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; + + } +} diff --git a/Source/Base/SoftDependencyChecker.cs b/Source/Base/SoftDependencyChecker.cs index 8f7698d..f130c54 100644 --- a/Source/Base/SoftDependencyChecker.cs +++ b/Source/Base/SoftDependencyChecker.cs @@ -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; "; }