Example #1
0
        public override bool WillUseMove(Monster monster, Entity target)
        {
            Los los = new Los(monster.Dungeon, monster.Position, target.Position);

            // don't try if the target is too far away
            if (!Vec.IsDistanceWithin(target.Position, monster.Position, Info.Radius))
            {
                return(false);
            }

            // see if we can see a clear path to the target
            return(los.HitsEntity(target, true));
        }
Example #2
0
        protected override IEnumerable <ActionResult> OnProcessEnumerable()
        {
            Los los = new Los(Dungeon, Entity.Position, mTarget);

            Vec lastPos = Entity.Position;

            foreach (Vec pos in los)
            {
                // see which direction it stepped
                Direction direction = Direction.Towards(pos - lastPos);
                lastPos = pos;

                // stop if the derived bolt says to
                if (OnEffect(pos, direction))
                {
                    break;
                }

                // keep going
                yield return(ActionResult.NotDone);
            }
        }