RJW-Sexperience/RJWSexperience/IdeologyAddon/Ideology/IdeoUtility.cs

38 lines
879 B
C#
Raw Normal View History

2022-02-25 14:15:48 +00:00
using RimWorld;
2021-08-21 16:29:59 +00:00
using Verse;
namespace RJWSexperience.Ideology
{
2022-02-25 14:15:48 +00:00
public static class IdeoUtility
{
public static bool IsSubmissive(this Pawn pawn)
{
Ideo ideo = pawn.Ideo;
2022-06-18 08:54:29 +00:00
if (ideo == null)
return false;
if (ideo.HasPrecept(VariousDefOf.Submissive_Female) && pawn.gender == Gender.Female)
return true;
else if (ideo.HasPrecept(VariousDefOf.Submissive_Male) && pawn.gender == Gender.Male)
return true;
2021-08-21 16:29:59 +00:00
2022-02-25 14:15:48 +00:00
return false;
}
2021-08-21 16:29:59 +00:00
public static float GetPreceptsMtbMultiplier<T>(Ideo ideo) where T : Precepts.DefExtension_ModifyMtb
{
float finalMultiplier = 1f;
for (int i = 0; i < ideo.PreceptsListForReading.Count; i++)
{
T defExtension = ideo.PreceptsListForReading[i].def.GetModExtension<T>();
if (defExtension == null)
continue;
finalMultiplier *= defExtension.multiplier;
}
return finalMultiplier;
}
2022-02-25 14:15:48 +00:00
}
2021-08-21 16:29:59 +00:00
}