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

namespace SCE
{
    public class PreceptComp_SomeoneRapedThought : PreceptComp_ConditionalMemoryThought
    {
        public int minRelationImportance;

        public bool allowComfortPawns;

        protected override Thought_Memory TryMakeMemory(HistoryEvent ev, Precept precept, Pawn member)
        {
            if (ev.args.GetArg<Pawn>(HistoryEventArgsNames.Doer) == member)
            {
                return null;
            }

            if (!ev.args.TryGetArg(HistoryEventArgsNames.Victim, out Pawn victim))
            {
                return null;
            }

            if (xxx.is_animal(victim) && !member.Ideo.HasMeme(DefDatabase<MemeDef>.GetNamed("AnimalPersonhood")))
            {
                return null;
            }

            if (member.relations.OpinionOf(victim) < 0)
            {
                return null;
            }

            if (victim.GetMostImportantRelation(member).importance < minRelationImportance)
            {
                return null;
            }

            return ThoughtMaker.MakeThought(thought, precept);
        }
    }
}