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

namespace SCE
{
    // Requires the target to be of a specific def and gets the centre cell of that thing plus some offset
    public class RitualPosition_TargetThingOffset : RitualPosition_ThingDef
    {
        public ThingDef thingDef;
        public IntVec2 offset;

        protected override ThingDef ThingDef => thingDef;

        public override IEnumerable<Thing> CandidateThings(LordJob_Ritual ritual)
        {
            var thing = ritual.selectedTarget.Thing;
            if (thing?.def == thingDef)
            {
                yield return thing;
            }
        }

        public override IntVec3 PositionForThing(Thing t)
        {
            return t.Position + offset.ToIntVec3;
        }
    }
    
}