Compare commits

...

2 commits

Author SHA1 Message Date
lutepickle
ff22e534d1 Encapsulate calculatingOvulationChance 2023-05-18 22:37:31 -07:00
lutepickle
924dc73024 Apply cramps to the comp's parent part instead of going through RJW to find it 2023-05-14 19:25:12 -07:00
2 changed files with 4 additions and 3 deletions

View file

@ -296,7 +296,8 @@ namespace RJW_Menstruation
} }
// I hate doing this, but it's the least bad option // I hate doing this, but it's the least bad option
public bool calculatingOvulationChance = false; private bool calculatingOvulationChance = false;
public bool CalculatingOvulationChance { get => calculatingOvulationChance; }
protected float CalcuatedOvulationChance() protected float CalcuatedOvulationChance()
{ {
@ -1596,7 +1597,7 @@ namespace RJW_Menstruation
hediff.Severity = crampPain * Rand.Range(0.9f, 1.1f); hediff.Severity = crampPain * Rand.Range(0.9f, 1.1f);
HediffCompProperties_SeverityPerDay Prop = (HediffCompProperties_SeverityPerDay)hediff.TryGetComp<HediffComp_SeverityPerDay>().props; HediffCompProperties_SeverityPerDay Prop = (HediffCompProperties_SeverityPerDay)hediff.TryGetComp<HediffComp_SeverityPerDay>().props;
Prop.severityPerDay = -hediff.Severity / (currentIntervalTicks / GenDate.TicksPerDay) * Configurations.CycleAcceleration; Prop.severityPerDay = -hediff.Severity / (currentIntervalTicks / GenDate.TicksPerDay) * Configurations.CycleAcceleration;
Pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(Pawn)); Pawn.health.AddHediff(hediff, parent.Part);
} }
protected virtual void FollicularAction() protected virtual void FollicularAction()

View file

@ -378,7 +378,7 @@ namespace RJW_Menstruation
private static float GetFertilityStatOrOne(Thing thing, StatDef stat, bool applyPostProcess, int cacheStaleAfterTicks) private static float GetFertilityStatOrOne(Thing thing, StatDef stat, bool applyPostProcess, int cacheStaleAfterTicks)
{ {
Pawn pawn = (Pawn)thing; Pawn pawn = (Pawn)thing;
if (pawn.GetMenstruationComps().Any(comp => comp.calculatingOvulationChance)) if (pawn.GetMenstruationComps().Any(comp => comp.CalculatingOvulationChance))
return 1.0f; return 1.0f;
else return thing.GetStatValue(stat, applyPostProcess, cacheStaleAfterTicks); else return thing.GetStatValue(stat, applyPostProcess, cacheStaleAfterTicks);
} }