using System.Collections.Generic;
using System.Linq;
using Verse;
using RimWorld;
using rjw;

namespace SCE
{
    public static class RapeUtility
    {
        public static bool IsProRape(this Ideo ideo) => ideo.HasPrecept(SCEPreceptDefOf.Rape_Honourable);

        public static bool AcceptsRape(this Ideo ideo, Pawn pawn, Pawn victim)
        {
            if (ideo == null || ideo.HasPrecept(SCEPreceptDefOf.Rape_Abhorred))
            {
                return false;
            }

            if (ideo.IsProRape())
            {
                return true;
            }

            if (victim.HostileTo(pawn))
            {
                return true;
            }

            if (PawnDesignations_Comfort.IsDesignatedComfort(victim))
            {
                return true;
            }

            if (ideo.HasPrecept(SCEPreceptDefOf.Rape_DontCare))
            {
                return true;
            }

            if ((victim.gender == Gender.Male && ideo.HasPrecept(SCEPreceptDefOf.Rape_MaleOnly))
                || (victim.gender == Gender.Female && ideo.HasPrecept(SCEPreceptDefOf.Rape_FemaleOnly)))
            {
                return true;
            }

            if (ideo.HasPrecept(SCEPreceptDefOf.Rape_SlavesOnly) && (victim.IsSlave || victim.IsPrisoner) && victim.guest.HostFaction == pawn.Faction)
            {
                return true;
            }

            return false;
        }

    }
}