using RimWorld; using rjw; using rjw.Modules.Attraction; using rjw.Modules.Attraction.StandardPreferences; using UnityEngine; using Verse; namespace RJWSexperience.Ideology { public class IncestIdeology : AttractionPreference { [StandardPreference] public static void ApplyTo(ref AttractionRequest request) { Pawn pawn = request.Pawn; if (!xxx.is_human(pawn) || !xxx.is_human(request.Target)) { return; } foreach (var precept in RsiDefOf.AllIncestPrecepts) { if (pawn.Ideo?.HasPrecept(precept) == true) { request.SetPreference(new IncestIdeology()); return; } } } private IncestIdeology() : base( AttractionMode.Social, nameof(IncestIdeology), FactorOperation.Multiply) { Priority = 200; } protected override float GetOperand(ref AttractionRequest request, float factor) { Pawn pawn = request.Pawn; Pawn partner = request.Target; BloodRelationDegree relation = RelationHelpers.GetBloodRelationDegree(pawn, partner); bool isSpouse = request.Relations.Contains(PawnRelationDefOf.Spouse); if (pawn.Ideo.HasPrecept(RsiDefOf.Precept.Incestuos_IncestOnly)) { if (relation == BloodRelationDegree.NotRelated) { return 0.1f; } else { return 1f; } } else if (pawn.Ideo.HasPrecept(RsiDefOf.Precept.Incestuos_Disapproved_CloseOnly)) { if (relation == BloodRelationDegree.CloseRelative && !isSpouse) { return 0.5f; } else { return 1f; } } else if (pawn.Ideo.HasPrecept(RsiDefOf.Precept.Incestuos_Disapproved)) { if ((relation == BloodRelationDegree.CloseRelative || relation == BloodRelationDegree.FarRelative) && !isSpouse) { return 0.5f; } else { return 1f; } } else if (pawn.Ideo.HasPrecept(RsiDefOf.Precept.Incestuos_Forbidden)) { if ((relation == BloodRelationDegree.CloseRelative || relation == BloodRelationDegree.FarRelative) && !isSpouse) { return 0.1f; } else { return 1f; } } return 1f; } } }