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

namespace SCE
{
    public class PreceptComp_KnowsBrokeTaboo : PreceptComp_NonParticipantMemory
    {
        public override void Notify_MemberWitnessedAction(HistoryEvent ev, Precept precept, Pawn member)
        {
            if (ev.def != eventDef)
            {
                return;
            }

            var doer = ev.args.GetArg<Pawn>(HistoryEventArgsNames.Doer);

            foreach (var comp in precept.def.comps.OfType<PreceptComp_Taboo>())
            {
                if (comp.eventDef == eventDef && comp.BrokeTaboo(doer, ev, precept))
                {
                    base.Notify_MemberWitnessedAction(ev, precept, member);
                    break;
                }
            }
        }
    }
}