Skip to content
Snippets Groups Projects
Commit 7e30ebe6 authored by amevarashi's avatar amevarashi
Browse files

Optimized incest checks

parent 7107947c
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,11 @@ namespace RJWSexperience.Ideology
/// </summary>
public static BloodRelationDegree GetBloodRelationDegree(Pawn pawn, Pawn partner)
{
if (!pawn.relations.FamilyByBlood.Contains(partner))
{
return BloodRelationDegree.NotRelated;
}
PawnRelationDef closestBloodRelation = pawn
.GetRelations(partner)
?.Where(def => def.familyByBloodRelation)
......
......@@ -17,11 +17,10 @@ namespace RJWSexperience.Ideology
/// </summary>
public static float GetRomanceChanceFactor(Pawn pawn, Pawn partner)
{
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(partner).Where(def => def.familyByBloodRelation);
PreceptDef incestuousPrecept = pawn.Ideo?.PreceptsListForReading.Select(precept => precept.def).FirstOrFallback(def => def.issue == VariousDefOf.Incestuos);
float romanceChanceFactor = 1f;
if (!relations.Any())
if (!pawn.relations.FamilyByBlood.Contains(partner))
{
if (incestuousPrecept == RsiPreceptDefOf.Incestuos_IncestOnly)
{
......@@ -33,6 +32,7 @@ namespace RJWSexperience.Ideology
}
}
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(partner).Where(def => def.familyByBloodRelation);
foreach (PawnRelationDef relationDef in relations)
{
romanceChanceFactor *= GetRomanceChanceFactor(relationDef, incestuousPrecept);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment