mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Redo the quirk API to make the rest of the code a bit cleaner
This commit is contained in:
parent
40b23fc9c9
commit
546d121cde
7 changed files with 18 additions and 14 deletions
Binary file not shown.
|
@ -290,7 +290,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
get
|
||||
{
|
||||
if (QuirkUtility.HasQuirk(Pawn, QuirkUtility.Quirks.Breeder)) return 0.5f;
|
||||
if (Pawn.IsBreeder()) return 0.5f;
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ namespace RJW_Menstruation
|
|||
StatDefOf.Fertility.GetStatPart<StatPart_FertilityByGenderAge>()?.TransformValue(StatRequest.For(Pawn), ref ageFactor);
|
||||
if (ageFactor <= 0.0f) return 0.0f; // Too young or too old
|
||||
|
||||
if (Pawn.HasQuirk(QuirkUtility.Quirks.Breeder)) ovulationChance *= 10.0f;
|
||||
if (Pawn.IsBreeder()) ovulationChance *= 10.0f;
|
||||
try
|
||||
{
|
||||
calculatingOvulationChance = true;
|
||||
|
@ -886,8 +886,8 @@ namespace RJW_Menstruation
|
|||
if (!precum && fertility > 0 && IsDangerDay && cummer.relations.GetPregnancyApproachForPartner(Pawn) == PregnancyApproach.AvoidPregnancy)
|
||||
{
|
||||
float successChance = pulloutSuccessRate;
|
||||
if (cummer.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish)) successChance *= fetishPulloutSuccessModifier;
|
||||
if (Pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish)) successChance *= fetishPulloutSuccessModifier;
|
||||
if (cummer.HasImpregnationFetish()) successChance *= fetishPulloutSuccessModifier;
|
||||
if (Pawn.HasImpregnationFetish()) successChance *= fetishPulloutSuccessModifier;
|
||||
if (Rand.Chance(successChance)) return;
|
||||
}
|
||||
if (Pawn.HasIUD()) fertility /= 100f;
|
||||
|
@ -1798,7 +1798,7 @@ namespace RJW_Menstruation
|
|||
MemoryThoughtHandler cummerMemories = cummer.needs.mood.thoughts.memories;
|
||||
MemoryThoughtHandler pawnMemories = Pawn.needs.mood.thoughts.memories;
|
||||
|
||||
if (cummer.IsProPregnancy(out Precept preceptm) || (cummer.HasQuirk(QuirkUtility.Quirks.Teratophile) != (Pawn.GetStatValue(StatDefOf.PawnBeauty) >= 0)))
|
||||
if (cummer.IsProPregnancy(out Precept preceptm) || (cummer.IsTeratophile() != (Pawn.GetStatValue(StatDefOf.PawnBeauty) >= 0)))
|
||||
{
|
||||
if (cummer.relations.OpinionOf(Pawn) <= -5)
|
||||
cummerMemories.TryGainMemory(VariousDefOf.HaterCameInsideM, Pawn);
|
||||
|
|
|
@ -453,8 +453,8 @@ namespace RJW_Menstruation
|
|||
}
|
||||
if (precept != null) return true;
|
||||
|
||||
else return pawn.HasQuirk(QuirkUtility.Quirks.Breeder) ||
|
||||
pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish);
|
||||
else return pawn.IsBreeder() ||
|
||||
pawn.HasImpregnationFetish();
|
||||
}
|
||||
|
||||
public static float DamagePants(this Pawn pawn, float fluidAmount)
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
if (is_discovered ||
|
||||
!xxx.is_human(pawn) ||
|
||||
pawn.HasQuirk(QuirkUtility.Quirks.Breeder) || (pawn.Ideo?.HasPrecept(VariousDefOf.Pregnancy_Required) ?? false) ||
|
||||
pawn.IsBreeder() || (pawn.Ideo?.HasPrecept(VariousDefOf.Pregnancy_Required) ?? false) ||
|
||||
(pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Spouse) ||
|
||||
x.def.Equals(PawnRelationDefOf.Fiance))) != null)
|
||||
return;
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace RJW_Menstruation
|
|||
List<Hediff> pawnparts = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn));
|
||||
|
||||
HediffComp_Menstruation comp;
|
||||
if (pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || partner.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || partner.IsInEstrus())
|
||||
if (pawn.HasImpregnationFetish() || partner.HasImpregnationFetish() || partner.IsInEstrus())
|
||||
comp = partner.GetFertileMenstruationComp();
|
||||
else comp = partner.GetRandomMenstruationComp();
|
||||
if (comp == null) return true;
|
||||
|
@ -102,7 +102,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
if (!partner.ShouldCycle()) return true;
|
||||
HediffComp_Menstruation comp;
|
||||
if (pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || partner.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || partner.IsInEstrus())
|
||||
if (pawn.HasImpregnationFetish() || partner.HasImpregnationFetish() || partner.IsInEstrus())
|
||||
comp = partner.GetFertileMenstruationComp();
|
||||
else comp = partner.GetRandomMenstruationComp();
|
||||
if (comp == null)
|
||||
|
@ -179,7 +179,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
// Awkward, but it'll have to do
|
||||
Pawn pawn = props.pawn;
|
||||
if (__result == 0 || !pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || !props.hasPartner()) return;
|
||||
if (__result == 0 || !pawn.HasImpregnationFetish() || !props.hasPartner()) return;
|
||||
|
||||
// Check if the existing code would have added the count
|
||||
Pawn partner = props.partner;
|
||||
|
|
|
@ -6,14 +6,14 @@ namespace RJW_Menstruation
|
|||
public static class QuirkUtility
|
||||
{
|
||||
// All quirks used in Menstruation
|
||||
public enum Quirks
|
||||
private enum Quirks
|
||||
{
|
||||
Breeder,
|
||||
ImpregnationFetish,
|
||||
Messy,
|
||||
Teratophile,
|
||||
}
|
||||
public static bool HasQuirk(this Pawn pawn, Quirks quirk)
|
||||
private static bool HasQuirk(Pawn pawn, Quirks quirk)
|
||||
{
|
||||
switch (quirk)
|
||||
{
|
||||
|
@ -29,5 +29,9 @@ namespace RJW_Menstruation
|
|||
return false;
|
||||
}
|
||||
}
|
||||
public static bool IsBreeder(this Pawn pawn) => HasQuirk(pawn, Quirks.Breeder);
|
||||
public static bool HasImpregnationFetish(this Pawn pawn) => HasQuirk(pawn, Quirks.ImpregnationFetish);
|
||||
public static bool IsMessy(this Pawn pawn) => HasQuirk(pawn, Quirks.Messy);
|
||||
public static bool IsTeratophile(this Pawn pawn) => HasQuirk(pawn, Quirks.Teratophile);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
res = 0.0f;
|
||||
}
|
||||
if (pawn.HasQuirk(QuirkUtility.Quirks.Messy)) res *= Rand.Range(4.0f, 8.0f);
|
||||
if (pawn.IsMessy()) res *= Rand.Range(4.0f, 8.0f);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue