Compare commits

...

10 commits

12 changed files with 102 additions and 75 deletions

Binary file not shown.

View file

@ -204,8 +204,9 @@ namespace RJW_Menstruation
{ {
// comp is used for Hydrogen's RJW Muscle Injury // comp is used for Hydrogen's RJW Muscle Injury
float totalleak = volume; float totalleak = volume;
float decayPerInterval = 1 - Mathf.Pow(1 - Configurations.CumDecayRatio, (float)comp.TickInterval / GenDate.TicksPerHour); float decayPerInterval = 1 - Mathf.Pow(1 - Configurations.CumDecayRatio, comp.SimulationsPerHour);
float fertilityDecayPerInterval = 1 - Mathf.Pow(1 - Configurations.CumFertilityDecayRatio, (float)comp.TickInterval / GenDate.TicksPerHour); float fertilityDecayPerInterval = 1 - Mathf.Pow(1 - Configurations.CumFertilityDecayRatio, comp.SimulationsPerHour);
antisperm *= comp.SimulationsPerHour;
volume *= Math.Max(0, 1 - decayPerInterval * (1 - DecayResist) * leakfactor); volume *= Math.Max(0, 1 - decayPerInterval * (1 - DecayResist) * leakfactor);
fertility *= Math.Max(0, 1 - (fertilityDecayPerInterval * (1 - DecayResist) + antisperm)); fertility *= Math.Max(0, 1 - (fertilityDecayPerInterval * (1 - DecayResist) + antisperm));
CutMinor(); CutMinor();

View file

@ -10,7 +10,10 @@ namespace RJW_Menstruation
private static void SetFollicular(Pawn p) private static void SetFollicular(Pawn p)
{ {
foreach (HediffComp_Menstruation comp in p.GetMenstruationComps()) foreach (HediffComp_Menstruation comp in p.GetMenstruationComps())
{
comp.GoNextStage(HediffComp_Menstruation.Stage.Follicular); comp.GoNextStage(HediffComp_Menstruation.Stage.Follicular);
comp.RemoveAllEggs();
}
Messages.Message($"{p} is now follicular", p, MessageTypeDefOf.NeutralEvent, false); Messages.Message($"{p} is now follicular", p, MessageTypeDefOf.NeutralEvent, false);
} }
@ -34,7 +37,10 @@ namespace RJW_Menstruation
private static void SetBleeding(Pawn p) private static void SetBleeding(Pawn p)
{ {
foreach (HediffComp_Menstruation comp in p.GetMenstruationComps()) foreach (HediffComp_Menstruation comp in p.GetMenstruationComps())
{
comp.GoNextStage(HediffComp_Menstruation.Stage.Bleeding); comp.GoNextStage(HediffComp_Menstruation.Stage.Bleeding);
comp.RemoveAllEggs();
}
Messages.Message($"{p} is now bleeding", p, MessageTypeDefOf.NeutralEvent, false); Messages.Message($"{p} is now bleeding", p, MessageTypeDefOf.NeutralEvent, false);
} }
/* /*
@ -57,6 +63,13 @@ namespace RJW_Menstruation
comp.RemoveAllCums(); comp.RemoveAllCums();
Messages.Message($"All cum removed from {p}'s womb", p, MessageTypeDefOf.NeutralEvent, false); Messages.Message($"All cum removed from {p}'s womb", p, MessageTypeDefOf.NeutralEvent, false);
} }
[DebugAction("RJW Menstruation", "Remove all eggs from pawn's womb", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)]
private static void RemoveEggs(Pawn p)
{
foreach (HediffComp_Menstruation comp in p.GetMenstruationComps())
comp.RemoveAllEggs();
Messages.Message($"All eggs removed from {p}'s womb", p, MessageTypeDefOf.NeutralEvent, false);
}
[DebugAction("RJW Menstruation", "Add egg to pawn's next ovulation", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)] [DebugAction("RJW Menstruation", "Add egg to pawn's next ovulation", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)]
private static void AddEgg(Pawn p) private static void AddEgg(Pawn p)
{ {

View file

@ -89,7 +89,7 @@ namespace RJW_Menstruation
else m.moodPowerFactor = 0.3f; else m.moodPowerFactor = 0.3f;
} }
if (pawn.WantsToGetPregnant()) pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.HateTookContraceptivePill); if (pawn.IsProPregnancy()) pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.HateTookContraceptivePill);
else pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.TookContraceptivePill); else pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.TookContraceptivePill);
} }
} }

View file

@ -75,9 +75,6 @@ namespace RJW_Menstruation
if (babyHalfAge <= 0) babyHalfAge = 1.2f / 2; // Default to human if (babyHalfAge <= 0) babyHalfAge = 1.2f / 2; // Default to human
if (RJWPregnancySettings.phantasy_pregnancy)
babyHalfAge /= GenDate.DaysPerYear;
return babyHalfAge; return babyHalfAge;
} }
} }
@ -140,10 +137,10 @@ namespace RJW_Menstruation
{ {
base.CompExposeData(); base.CompExposeData();
Scribe_Values.Look(ref ageOfLastBirth, "ageOfLastBirth", ageOfLastBirth, true); Scribe_Values.Look(ref ageOfLastBirth, "ageOfLastBirth", -1);
Scribe_Values.Look(ref maxBreastIncrement, "maxBreastIncrement", maxBreastIncrement, true); Scribe_Values.Look(ref maxBreastIncrement, "maxBreastIncrement", maxBreastIncrement, true);
Scribe_Values.Look(ref breastSizeIncreased, "breastSizeIncreased", breastSizeIncreased, true); Scribe_Values.Look(ref breastSizeIncreased, "breastSizeIncreased", 0.0f);
Scribe_Values.Look(ref nippleProgress, "nippleProgress", nippleProgress, true); Scribe_Values.Look(ref nippleProgress, "nippleProgress", 0.0f);
Scribe_Values.Look(ref baseAlpha, "baseAlpha", baseAlpha, true); Scribe_Values.Look(ref baseAlpha, "baseAlpha", baseAlpha, true);
Scribe_Values.Look(ref baseAreola, "baseAreola", baseAreola, true); Scribe_Values.Look(ref baseAreola, "baseAreola", baseAreola, true);
Scribe_Values.Look(ref baseNipple, "baseNipple", baseNipple, true); Scribe_Values.Look(ref baseNipple, "baseNipple", baseNipple, true);
@ -199,19 +196,19 @@ namespace RJW_Menstruation
protected long CalculateLastBirth() protected long CalculateLastBirth()
{ {
long youngestAge = (long)(BabyHalfAge * GenDate.TicksPerYear) * -2; // So a newborn isn't considered a new mother, either long youngestAge = -1;
if ((Pawn.relations == null)) return youngestAge; if ((Pawn.relations == null)) return youngestAge;
List<Hediff_BasePregnancy> pregnancies = new List<Hediff_BasePregnancy>(); List<Hediff_BasePregnancy> rjwPregnancies = new List<Hediff_BasePregnancy>();
Pawn.health.hediffSet.GetHediffs(ref pregnancies); Pawn.health.hediffSet.GetHediffs(ref rjwPregnancies);
bool hasChild = Pawn.relations.Children. bool hasChild = Pawn.relations.Children.
Where(child => !pregnancies.Any(preg => preg.babies.Contains(child))). // no fetuses Where(child => !rjwPregnancies.Any(preg => preg.babies.Contains(child))). // no fetuses
Where(child => child.GetMother() == Pawn). // not Dad Where(child => child.GetMother() == Pawn). // not Dad
TryMinBy(child => child.ageTracker.AgeBiologicalTicks, out Pawn youngest); TryMinBy(child => child.ageTracker.AgeBiologicalTicks, out Pawn youngest);
if (hasChild) youngestAge = Pawn.ageTracker.AgeBiologicalTicks - youngest.ageTracker.AgeBiologicalTicks; if (hasChild) youngestAge = Math.Max(Pawn.ageTracker.AgeBiologicalTicks - youngest.ageTracker.AgeBiologicalTicks, -1);
return youngestAge; return youngestAge;
} }
@ -224,7 +221,7 @@ namespace RJW_Menstruation
{ {
maxBreastIncrement = Utility.RandGaussianLike(0.088f, 0.202f); maxBreastIncrement = Utility.RandGaussianLike(0.088f, 0.202f);
} }
if (ageOfLastBirth == 0) if (ageOfLastBirth == 0 || ageOfLastBirth < -1)
{ {
ageOfLastBirth = CalculateLastBirth(); ageOfLastBirth = CalculateLastBirth();
} }
@ -253,7 +250,7 @@ namespace RJW_Menstruation
debugGrowthStatus = "Base size (ageless)"; debugGrowthStatus = "Base size (ageless)";
} }
// The youngest child is less than halfway into babyhood: Full size // The youngest child is less than halfway into babyhood: Full size
else if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks) else if (ageOfLastBirth > 0 && ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks)
{ {
debugGrowthStatus = "Full size due to young child"; debugGrowthStatus = "Full size due to young child";
if (breastSizeIncreased < MaxBreastIncrement) if (breastSizeIncreased < MaxBreastIncrement)
@ -299,7 +296,7 @@ namespace RJW_Menstruation
float newNippleProgress; float newNippleProgress;
if (Pawn.ageTracker.BiologicalTicksPerTick <= 0f) if (Pawn.ageTracker.BiologicalTicksPerTick <= 0f)
newNippleProgress = 0f; newNippleProgress = 0f;
else if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks) else if (ageOfLastBirth > 0 && ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks)
newNippleProgress = 1f; newNippleProgress = 1f;
else if (Pawn.IsRJWPregnant() || Pawn.IsBiotechPregnant()) else if (Pawn.IsRJWPregnant() || Pawn.IsBiotechPregnant())
newNippleProgress = nippleTransitions.Evaluate(Pawn.GetFarthestPregnancyProgress()); newNippleProgress = nippleTransitions.Evaluate(Pawn.GetFarthestPregnancyProgress());

View file

@ -160,7 +160,7 @@ namespace RJW_Menstruation
new CurvePoint(1.0f,0.5f) new CurvePoint(1.0f,0.5f)
}; };
public int TickInterval protected int TickInterval
{ {
get get
{ {
@ -169,13 +169,15 @@ namespace RJW_Menstruation
if (Pawn.IsAnimal()) tickInterval = Configurations.AnimalTickInterval; if (Pawn.IsAnimal()) tickInterval = Configurations.AnimalTickInterval;
else if (Pawn.IsColonist || Pawn.IsPrisonerOfColony || Pawn.IsSlaveOfColony) tickInterval = Configurations.ColonistTickInterval; else if (Pawn.IsColonist || Pawn.IsPrisonerOfColony || Pawn.IsSlaveOfColony) tickInterval = Configurations.ColonistTickInterval;
else tickInterval = Configurations.NonColonistTickInterval; else tickInterval = Configurations.NonColonistTickInterval;
if (tickInterval <= 0) tickInterval = 1; if (tickInterval <= Configurations.TickIntervalMinimum) tickInterval = Configurations.TickIntervalMinimum;
} }
return tickInterval; return tickInterval;
} }
set => tickInterval = value; set => tickInterval = value;
} }
public float SimulationsPerHour => (float)TickInterval / GenDate.TicksPerHour;
public Hediff Pregnancy { public Hediff Pregnancy {
get get
{ {
@ -336,8 +338,7 @@ namespace RJW_Menstruation
// Implant factor will be based solely on pawn age, plus any rollover from ovulation chance // Implant factor will be based solely on pawn age, plus any rollover from ovulation chance
StatPart_FertilityByGenderAge fertilityStatPart = StatDefOf.Fertility.GetStatPart<StatPart_FertilityByGenderAge>(); StatPart_FertilityByGenderAge fertilityStatPart = StatDefOf.Fertility.GetStatPart<StatPart_FertilityByGenderAge>();
fertilityStatPart?.TransformValue(StatRequest.For(Pawn), ref factor); fertilityStatPart?.TransformValue(StatRequest.For(Pawn), ref factor);
float ovulationOverflow = OvulationChance; if (OvulationChance > 1.0f) factor *= OvulationChance;
if (ovulationOverflow > 1.0f) factor *= ovulationOverflow;
return Props.baseImplantationChanceFactor * FertilityModifier * factor; return Props.baseImplantationChanceFactor * FertilityModifier * factor;
} }
else else
@ -630,6 +631,15 @@ namespace RJW_Menstruation
} }
} }
public float StageProgessNextUpdate
{
get
{
if (pregnancy != null) return StageProgress;
return Mathf.Clamp01((float)(curStageTicks + TickInterval * Configurations.CycleAcceleration) / currentIntervalTicks);
}
}
public Texture2D GetStageTexture public Texture2D GetStageTexture
{ {
get get
@ -1051,9 +1061,9 @@ namespace RJW_Menstruation
if (Pawn.CurJobDef == xxx.knotted) leakfactor = 0f; if (Pawn.CurJobDef == xxx.knotted) leakfactor = 0f;
foreach (Cum cum in cums) foreach (Cum cum in cums)
{ {
if (Rand.Chance((float)TickInterval / GenDate.TicksPerHour)) cum.CumEffects(Pawn); if (Rand.Chance(SimulationsPerHour)) cum.CumEffects(Pawn);
float vd = cum.DismishNatural(leakfactor, this, antisperm); float vd = cum.DismishNatural(leakfactor, this, antisperm);
cum.MakeThinner((float)Configurations.CycleAcceleration * TickInterval / GenDate.TicksPerHour); cum.MakeThinner((float)Configurations.CycleAcceleration * SimulationsPerHour);
totalleak += AbsorbCum(vd, absorber); totalleak += AbsorbCum(vd, absorber);
string tmp = "FilthLabelWithSource".Translate(cum.FilthDef.label, cum.pawn?.LabelShort ?? "Unknown", 1.ToString()); string tmp = "FilthLabelWithSource".Translate(cum.FilthDef.label, cum.pawn?.LabelShort ?? "Unknown", 1.ToString());
filthlabels.Add(tmp.Replace(" x1", "")); filthlabels.Add(tmp.Replace(" x1", ""));
@ -1135,6 +1145,11 @@ namespace RJW_Menstruation
cums.Clear(); cums.Clear();
} }
public void RemoveAllEggs()
{
eggs.Clear();
}
/// <summary> /// <summary>
/// Fertilize eggs and return the result /// Fertilize eggs and return the result
@ -1353,7 +1368,7 @@ namespace RJW_Menstruation
//float fertFailChancePerHour = Mathf.Pow(1.0f - Configurations.FertilizeChance, totalFertPower * Props.basefertilizationChanceFactor); //float fertFailChancePerHour = Mathf.Pow(1.0f - Configurations.FertilizeChance, totalFertPower * Props.basefertilizationChanceFactor);
//float fertFailChancePerInterval = Mathf.Pow(fertFailChancePerHour, (float)TickInterval / GenDate.TicksPerHour); //float fertFailChancePerInterval = Mathf.Pow(fertFailChancePerHour, (float)TickInterval / GenDate.TicksPerHour);
float fertFailChancePerInterval = Mathf.Pow(1.0f - Configurations.FertilizeChance, totalFertPower * Props.basefertilizationChanceFactor * TickInterval / GenDate.TicksPerHour); float fertFailChancePerInterval = Mathf.Pow(1.0f - Configurations.FertilizeChance, totalFertPower * Props.basefertilizationChanceFactor * SimulationsPerHour);
if (Rand.Chance(fertFailChancePerInterval)) return null; if (Rand.Chance(fertFailChancePerInterval)) return null;
@ -1496,7 +1511,7 @@ namespace RJW_Menstruation
protected void BleedOut() protected void BleedOut()
{ {
// ~1.5 per hour times acceleration // ~1.5 per hour times acceleration
float bledAmount = 0.03f * Configurations.BleedingAmount * Configurations.CycleAcceleration * Rand.Range(0.5f, 1.5f) * TickInterval / GenDate.TicksPerHour; float bledAmount = 0.03f * Configurations.BleedingAmount * Configurations.CycleAcceleration * Rand.Range(0.5f, 1.5f) * SimulationsPerHour;
CumIn(Pawn, bledAmount, Translations.Menstrual_Blood, -5.0f, Pawn.RaceProps?.BloodDef ?? ThingDefOf.Filth_Blood); CumIn(Pawn, bledAmount, Translations.Menstrual_Blood, -5.0f, Pawn.RaceProps?.BloodDef ?? ThingDefOf.Filth_Blood);
Cum blood = GetNotCum(Translations.Menstrual_Blood); Cum blood = GetNotCum(Translations.Menstrual_Blood);
if (blood != null) blood.Color = BloodColor; if (blood != null) blood.Color = BloodColor;
@ -1633,10 +1648,9 @@ namespace RJW_Menstruation
eggnum *= ovulationFactor; eggnum *= ovulationFactor;
int toOvulate = (int)eggnum + eggstack; int toOvulate = (int)eggnum + eggstack;
float ovulationChance = OvulationChance;
int ovulated = 0; int ovulated = 0;
for (int i = 0; i < toOvulate; i++) for (int i = 0; i < toOvulate; i++)
if (i < eggstack || Rand.Chance(ovulationChance)) // eggstack comes from drugs and are guaranteed ovulated if (i < eggstack || Rand.Chance(OvulationChance)) // eggstack comes from drugs and are guaranteed ovulated
{ {
eggs.Add(new Egg((int)(EggLifespanTicks / CycleFactor))); eggs.Add(new Egg((int)(EggLifespanTicks / CycleFactor)));
++ovulated; ++ovulated;
@ -1644,7 +1658,7 @@ namespace RJW_Menstruation
ovarypower -= ovulated; ovarypower -= ovulated;
eggstack = 0; eggstack = 0;
if (Configurations.Debug && ovulated != toOvulate) if (Configurations.Debug && ovulated != toOvulate)
Log.Message($"{Pawn} ovulated {ovulated}/{toOvulate} eggs ({ovulationChance.ToStringPercent()} chance)"); Log.Message($"{Pawn} ovulated {ovulated}/{toOvulate} eggs ({OvulationChance.ToStringPercent()} chance)");
GoNextStage(Stage.Luteal); GoNextStage(Stage.Luteal);
} }
@ -1783,8 +1797,7 @@ namespace RJW_Menstruation
if (!xxx.is_human(Pawn) || !xxx.is_human(cummer)) return; if (!xxx.is_human(Pawn) || !xxx.is_human(cummer)) return;
if ((cummer.HasQuirk(QuirkUtility.Quirks.Teratophile) != (Pawn.GetStatValue(StatDefOf.PawnBeauty) >= 0)) || if ((cummer.HasQuirk(QuirkUtility.Quirks.Teratophile) != (Pawn.GetStatValue(StatDefOf.PawnBeauty) >= 0)) ||
cummer.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || cummer.IsProPregnancy())
cummer.HasQuirk(QuirkUtility.Quirks.Breeder))
{ {
if (cummer.relations.OpinionOf(Pawn) <= -25) if (cummer.relations.OpinionOf(Pawn) <= -25)
{ {
@ -1798,7 +1811,7 @@ namespace RJW_Menstruation
if (IsDangerDay) if (IsDangerDay)
{ {
if (Pawn.WantsToGetPregnant()) if (Pawn.IsProPregnancy())
{ {
Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetish, cummer); Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetish, cummer);
} }
@ -1821,7 +1834,7 @@ namespace RJW_Menstruation
} }
else else
{ {
if (Pawn.WantsToGetPregnant()) if (Pawn.IsProPregnancy())
{ {
Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetishSafe, cummer); Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetishSafe, cummer);
} }

View file

@ -79,15 +79,12 @@ namespace RJW_Menstruation
protected override void BleedingAction() protected override void BleedingAction()
{ {
if (curStageTicks >= currentIntervalTicks) base.BleedingAction();
if (curStage != Stage.Bleeding)
{ {
Hediff hediff = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_MenstrualCramp);
if (hediff != null && !Pawn.GetMenstruationComps().Any(comp => comp != this && comp.curStage == Stage.Bleeding)) Pawn.health.RemoveHediff(hediff);
estrusflag = false; estrusflag = false;
GoNextStage(Stage.Anestrus); GoNextStage(Stage.Anestrus);
return;
} }
else base.BleedingAction();
} }
protected override void PregnantAction() protected override void PregnantAction()

View file

@ -3,6 +3,7 @@ using RimWorld.Planet;
using rjw; using rjw;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.Eventing.Reader;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using Verse; using Verse;
@ -217,35 +218,36 @@ namespace RJW_Menstruation
return wombtex; return wombtex;
} }
public static Texture2D GetOvaryIcon(this HediffComp_Menstruation comp)
{
const float ovaryChanceToShow_01 = 0.2f;
const float ovaryChanceToShow_02 = 0.8f;
float ovulatoryProgress;
bool isInduced = comp is HediffComp_InducedOvulator;
if (comp.curStage == HediffComp_Menstruation.Stage.Follicular &&
isInduced &&
comp.Pawn.jobs.curDriver is JobDriver_Sex job &&
job.Sexprops != null &&
!job.Sexprops.usedCondom &&
(job.Sexprops.sexType == xxx.rjwSextype.Vaginal || job.Sexprops.sexType == xxx.rjwSextype.DoublePenetration))
ovulatoryProgress = 0.0f;
else if (comp.curStage == HediffComp_Menstruation.Stage.Ovulatory) ovulatoryProgress = isInduced ? Mathf.Max(ovaryChanceToShow_01, comp.StageProgessNextUpdate) : comp.StageProgessNextUpdate;
// else if (comp.curStage == HediffComp_Menstruation.Stage.Luteal && comp.IsEggExist) return ContentFinder<Texture2D>.Get("Ovaries/Ovary_02", true);
else return ContentFinder<Texture2D>.Get("Womb/Empty", true);
float combinedAppearance = ovulatoryProgress * comp.OvulationChance;
if (combinedAppearance >= ovaryChanceToShow_02 && comp.OvulationChance >= 1.0f) return ContentFinder<Texture2D>.Get("Ovaries/Ovary_02", true);
else if (combinedAppearance >= ovaryChanceToShow_01) return ContentFinder<Texture2D>.Get("Ovaries/Ovary_01", true);
else return ContentFinder<Texture2D>.Get("Ovaries/Ovary_00", true);
}
public static Texture2D GetEggIcon(this HediffComp_Menstruation comp, bool includeOvary) public static Texture2D GetEggIcon(this HediffComp_Menstruation comp, bool includeOvary)
{ {
float ovulationChance = comp.OvulationChance;
const float ovaryChanceToShow_01 = 0.4f;
const float ovaryChanceToShow_02 = 1.0f;
switch (comp.CurrentVisibleStage) switch (comp.CurrentVisibleStage)
{ {
case HediffComp_Menstruation.Stage.Follicular: case HediffComp_Menstruation.Stage.Follicular:
if (!includeOvary) break;
if (comp is HediffComp_InducedOvulator)
{
if (comp.Pawn.jobs.curDriver is JobDriver_Sex job &&
job.Sexprops != null &&
!job.Sexprops.usedCondom &&
(job.Sexprops.sexType == xxx.rjwSextype.Vaginal || job.Sexprops.sexType == xxx.rjwSextype.DoublePenetration))
return ContentFinder<Texture2D>.Get((ovulationChance >= ovaryChanceToShow_01) ? "Ovaries/Ovary_01" : "Ovaries/Ovary_00", true);
else break;
}
if (comp.curStageTicks > comp.CurStageIntervalTicks - 30 * GenDate.TicksPerHour) // Approximate time for ovulation to occur
return ContentFinder<Texture2D>.Get((ovulationChance >= ovaryChanceToShow_01) ? "Ovaries/Ovary_01" : "Ovaries/Ovary_00", true);
else break;
case HediffComp_Menstruation.Stage.Ovulatory: case HediffComp_Menstruation.Stage.Ovulatory:
if (!includeOvary) break; if (!includeOvary) break;
if (ovulationChance >= ovaryChanceToShow_02) else return GetOvaryIcon(comp);
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_02", true);
else if (ovulationChance >= ovaryChanceToShow_01)
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_01", true);
else
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_00", true);
case HediffComp_Menstruation.Stage.Luteal: case HediffComp_Menstruation.Stage.Luteal:
if (!comp.IsEggExist) break; if (!comp.IsEggExist) break;
int fertTime = comp.EggFertilizedTime; int fertTime = comp.EggFertilizedTime;
@ -256,6 +258,10 @@ namespace RJW_Menstruation
else if (fertTime <= 54 * GenDate.TicksPerHour) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized01", true); else if (fertTime <= 54 * GenDate.TicksPerHour) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized01", true);
else return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized02", true); else return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized02", true);
} }
else if (includeOvary && comp.curStageTicks <= comp.Props.ovulationIntervalHours * 0.4f * GenDate.TicksPerHour) // Total about as long as it spent in Ovary_01
{
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_02", true);
}
else if (comp.IsEggFertilizing) else if (comp.IsEggFertilizing)
{ {
if (comp.GetFertilityChance() < 0.5f) if (comp.GetFertilityChance() < 0.5f)
@ -401,7 +407,7 @@ namespace RJW_Menstruation
return false; return false;
} }
public static bool WantsToGetPregnant(this Pawn pawn) public static bool IsProPregnancy(this Pawn pawn)
{ {
if (pawn.HasQuirk(QuirkUtility.Quirks.Breeder) || if (pawn.HasQuirk(QuirkUtility.Quirks.Breeder) ||
pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish)) pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish))

View file

@ -27,7 +27,7 @@ namespace RJW_Menstruation
(pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Spouse) || (pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Spouse) ||
x.def.Equals(PawnRelationDefOf.Fiance))) != null) x.def.Equals(PawnRelationDefOf.Fiance))) != null)
return; return;
if (pawn.WantsToGetPregnant() || pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Lover)) != null) if (pawn.IsProPregnancy() || pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Lover)) != null)
{ {
pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.UnwantedPregnancyMild); pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.UnwantedPregnancyMild);
} }

View file

@ -43,7 +43,7 @@ namespace RJW_Menstruation
private static Gizmo CreateGizmo_WombStatus(Pawn pawn, HediffComp_Menstruation comp) private static Gizmo CreateGizmo_WombStatus(Pawn pawn, HediffComp_Menstruation comp)
{ {
Texture2D icon, icon_overay; Texture2D icon, icon_overlay;
StringBuilder description = new StringBuilder(); StringBuilder description = new StringBuilder();
if (Configurations.Debug) if (Configurations.Debug)
{ {
@ -69,15 +69,15 @@ namespace RJW_Menstruation
float gestationProgress = comp.StageProgress; float gestationProgress = comp.StageProgress;
if (hediff is Hediff_BasePregnancy || hediff is HediffWithParents) if (hediff is Hediff_BasePregnancy || hediff is HediffWithParents)
{ {
if (gestationProgress < 0.2f) icon_overay = comp.GetCumIcon(); if (gestationProgress < 0.2f) icon_overlay = comp.GetCumIcon();
else icon_overay = ContentFinder<Texture2D>.Get(("Womb/Empty"), true); else icon_overlay = ContentFinder<Texture2D>.Get(("Womb/Empty"), true);
} }
else icon_overay = ContentFinder<Texture2D>.Get(("Womb/Empty"), true); else icon_overlay = ContentFinder<Texture2D>.Get(("Womb/Empty"), true);
} }
else else
{ {
icon = comp.GetWombIcon(); icon = comp.GetWombIcon();
icon_overay = comp.GetCumIcon(); icon_overlay = comp.GetCumIcon();
} }
} }
else else
@ -91,7 +91,7 @@ namespace RJW_Menstruation
{ {
icon = comp.GetWombIcon(); icon = comp.GetWombIcon();
} }
icon_overay = comp.GetCumIcon(); icon_overlay = comp.GetCumIcon();
} }
foreach (string s in comp.GetCumsInfo) description.AppendFormat("{0}\n", s); foreach (string s in comp.GetCumsInfo) description.AppendFormat("{0}\n", s);
@ -103,7 +103,7 @@ namespace RJW_Menstruation
defaultLabel = pawn.LabelShort, defaultLabel = pawn.LabelShort,
defaultDesc = description.ToString(), defaultDesc = description.ToString(),
icon = icon, icon = icon,
icon_overay = icon_overay, icon_overlay = icon_overlay,
shrinkable = Configurations.AllowShrinkIcon, shrinkable = Configurations.AllowShrinkIcon,
cumcolor = c, cumcolor = c,
comp = comp, comp = comp,

View file

@ -462,8 +462,8 @@ namespace RJW_Menstruation
statvalue = Configurations.ImplantationChance * comp.ImplantChance; statvalue = Configurations.ImplantationChance * comp.ImplantChance;
float fertchance = comp.GetFertilityChance(); float fertchance = comp.GetFertilityChance();
FillableBarLabeled(lineRect, " " + xxx.reproduction.LabelCap.CapitalizeFirst() + " " + statvalue.ToStringPercent(), statvalue, TextureCache.LutealTexture, Texture2D.blackTexture, Translations.FertilityDesc(string.Format("{0:0.##}", fertchance * 100))); FillableBarLabeled(lineRect, " " + xxx.reproduction.LabelCap.CapitalizeFirst() + " " + statvalue.ToStringPercent(), statvalue, TextureCache.LutealTexture, Texture2D.blackTexture, Translations.FertilityDesc(string.Format("{0:0.##}", fertchance * 100)));
Rect overayRect = new Rect(lineRect.x, lineRect.y, lineRect.width * Math.Min(1.0f, fertchance), lineRect.height); Rect overlayRect = new Rect(lineRect.x, lineRect.y, lineRect.width * Math.Min(1.0f, fertchance), lineRect.height);
GUI.DrawTexture(overayRect, TextureCache.FertChanceTex); GUI.DrawTexture(overlayRect, TextureCache.FertChanceTex);
lineRect.y += height; lineRect.y += height;
} }

View file

@ -5,7 +5,7 @@ namespace RJW_Menstruation
{ {
public class Gizmo_Womb : Command_Action public class Gizmo_Womb : Command_Action
{ {
public Texture2D icon_overay; public Texture2D icon_overlay;
public Color cumcolor; public Color cumcolor;
public HediffComp_Menstruation comp; public HediffComp_Menstruation comp;
@ -14,23 +14,23 @@ namespace RJW_Menstruation
public override void DrawIcon(Rect rect, Material buttonMat, GizmoRenderParms parms) public override void DrawIcon(Rect rect, Material buttonMat, GizmoRenderParms parms)
{ {
Texture badTex = icon; Texture badTex = icon;
Texture2D overay = icon_overay; Texture2D overlay = icon_overlay;
Color color = cumcolor; Color color = cumcolor;
if (badTex == null) if (badTex == null)
{ {
badTex = BaseContent.BadTex; badTex = BaseContent.BadTex;
} }
if (overay == null) if (overlay == null)
{ {
overay = BaseContent.BadTex; overlay = BaseContent.BadTex;
} }
if (color == null) color = Color.white; if (color == null) color = Color.white;
rect.position += new Vector2(iconOffset.x * rect.size.x, iconOffset.y * rect.size.y); rect.position += new Vector2(iconOffset.x * rect.size.x, iconOffset.y * rect.size.y);
GUI.color = IconDrawColor; GUI.color = IconDrawColor;
Widgets.DrawTextureFitted(rect, badTex, this.iconDrawScale * 0.85f, this.iconProportions, this.iconTexCoords, this.iconAngle, buttonMat); Widgets.DrawTextureFitted(rect, badTex, this.iconDrawScale * 0.85f, this.iconProportions, this.iconTexCoords, this.iconAngle, buttonMat);
GUI.color = color; GUI.color = color;
Widgets.DrawTextureFitted(rect, overay, iconDrawScale * 0.85f, iconProportions, iconTexCoords, iconAngle, buttonMat); Widgets.DrawTextureFitted(rect, overlay, iconDrawScale * 0.85f, iconProportions, iconTexCoords, iconAngle, buttonMat);
GUI.color = Color.white; GUI.color = Color.white;
if (Configurations.DrawEggOverlay) comp.DrawEggOverlay(rect, false); if (Configurations.DrawEggOverlay) comp.DrawEggOverlay(rect, false);
Rect progressRect = new Rect(rect.x + 2f, rect.y, rect.width - 4f, progressbarHeight); Rect progressRect = new Rect(rect.x + 2f, rect.y, rect.width - 4f, progressbarHeight);