rjw_menstruation/1.4/source/RJW_Menstruation/RJW_Menstruation/DrugOutcomeDoers.cs

97 lines
3.5 KiB
C#

using RimWorld;
using rjw;
using System.Collections.Generic;
using Verse;
namespace RJW_Menstruation
{
public class FertPillOutcomeDoer : IngestionOutcomeDoer
{
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{
foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps())
if (comp.curStage.Equals(HediffComp_Menstruation.Stage.Follicular)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.Luteal)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.Anestrus)
)
{
comp.SetEstrus();
comp.GoNextStage(HediffComp_Menstruation.Stage.Ovulatory);
comp.ovarypower--;
}
}
}
public class InduceOvulationOutcomeDoer : IngestionOutcomeDoer
{
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{
foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps())
if (comp.curStage.Equals(HediffComp_Menstruation.Stage.Follicular)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.Anestrus)
)
{
comp.SetEstrus();
comp.GoNextStage(HediffComp_Menstruation.Stage.Ovulatory);
comp.eggstack += ingested.stackCount - 1;
}
}
}
public class IngestionOutcomeDoer_AdjustSeverity : IngestionOutcomeDoer
{
public HediffDef hediffDef;
public float severity;
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{
Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(hediffDef);
if (hediff != null) hediff.Severity += severity;
}
}
public class OvaryPillOutcomeDoer : IngestionOutcomeDoer
{
public float effectOffset;
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{
foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps())
if (Configurations.EnableMenopause) comp.RecoverOvary(1 + effectOffset);
}
}
public class SuperOvulationOutcomeDoer : IngestionOutcomeDoer
{
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{
foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps())
comp.eggstack += Rand.Range(1, 4);
}
}
public class ContraceptiveOutcomeDoer : IngestionOutcomeDoer
{
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{
List<Thought_Memory> memories = pawn.needs?.mood?.thoughts?.memories?.Memories.FindAll(
x =>
x.def == VariousDefOf.CameInsideF
|| x.def == VariousDefOf.CameInsideFFetish
|| x.def == VariousDefOf.HaterCameInsideF);
if (memories.NullOrEmpty()) return;
foreach (Thought_Memory m in memories)
{
if (m.def == VariousDefOf.HaterCameInsideF) m.moodPowerFactor = 0.5f;
else m.moodPowerFactor = 0.3f;
}
if (pawn.WantsToGetPregnant()) pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.HateTookContraceptivePill);
else pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.TookContraceptivePill);
}
}
}