mirror of
https://gitgud.io/amevarashi/rjw-sexperience-ideology.git
synced 2024-08-15 00:43:19 +00:00
Optimized incest checks
This commit is contained in:
parent
7107947cac
commit
7e30ebe68e
2 changed files with 7 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue