rjw_menstruation/1.2/source/RJW_Menstruation/RJW_Menstruation/DrugOutcomDoers.cs

87 lines
2.8 KiB
C#
Raw Normal View History

2021-07-17 09:15:56 +00:00
using System;
using System.Collections.Generic;
2021-06-16 12:53:52 +00:00
using RimWorld;
2021-02-01 11:29:29 +00:00
using Verse;
2021-06-16 12:53:52 +00:00
using rjw;
2021-02-01 11:29:29 +00:00
namespace RJW_Menstruation
{
public class FertPillOutcomDoer : IngestionOutcomeDoer
{
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{
2021-07-17 09:15:56 +00:00
HediffComp_Menstruation comp = pawn.GetMenstruationComp();
2021-03-06 13:32:33 +00:00
if (comp != null && (comp.curStage.Equals(HediffComp_Menstruation.Stage.Follicular)
2021-02-07 07:53:46 +00:00
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.Luteal)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.ClimactericFollicular)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.ClimactericLuteal)
2021-06-12 15:51:34 +00:00
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.Anestrus)
2021-02-12 15:24:54 +00:00
))
2021-02-07 07:53:46 +00:00
{
2021-02-25 09:09:24 +00:00
comp.SetEstrus(comp.Props.eggLifespanDays);
2021-02-07 07:53:46 +00:00
comp.curStage = HediffComp_Menstruation.Stage.Ovulatory;
comp.ovarypower--;
}
2021-02-01 11:29:29 +00:00
}
}
2021-02-07 07:53:46 +00:00
public class OvaryPillOutcomDoer : IngestionOutcomeDoer
{
public float effectOffset;
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{
2021-07-17 09:15:56 +00:00
HediffComp_Menstruation comp = pawn.GetMenstruationComp();
if (Configurations.EnableMenopause && comp != null)
2021-02-07 07:53:46 +00:00
{
2021-07-17 09:15:56 +00:00
comp.RecoverOvary(1 + effectOffset);
2021-02-07 07:53:46 +00:00
}
}
}
2021-02-12 15:24:54 +00:00
public class SuperOvulationOutcomDoer : IngestionOutcomeDoer
{
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{
2021-07-17 09:15:56 +00:00
HediffComp_Menstruation comp = pawn.GetMenstruationComp();
2021-02-12 15:24:54 +00:00
if (comp != null)
{
2021-03-06 13:32:33 +00:00
comp.eggstack += Rand.Range(1, 4);
2021-02-12 15:24:54 +00:00
}
}
}
2021-02-07 07:53:46 +00:00
2021-06-16 12:53:52 +00:00
public class ContraptiveOutcomDoer : 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())
{
foreach (Thought_Memory m in memories)
{
if (m.def == VariousDefOf.HaterCameInsideF) m.moodPowerFactor = 0.5f;
else m.moodPowerFactor = 0.3f;
}
if (pawn.Has(Quirk.Breeder)) pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.HateTookContraptivePill);
else pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.TookContraptivePill);
}
}
}
2021-02-07 07:53:46 +00:00
2021-02-01 11:29:29 +00:00
}