Ejemplo n.º 1
0
        /// <summary>
        ///     Follow the Monsters target to it's position.
        /// </summary>
        /// <param name="targetSession">The TargetSession to follow</param>
        private void FollowTarget()
        {
            if (Npc == null || !IsAlive || HasBuff(CardType.Move, (byte)AdditionalTypes.Move.MovementImpossible))
            {
                return;
            }

            if (!Target?.IsTargetable(SessionType()) ?? true)
            {
                RemoveTarget();
                return;
            }

            if (!Path.Any())
            {
                Path = BestFirstSearch.TracePathJagged(new Node {
                    X = MapX, Y = MapY
                }, Target.GetBrushFire(),
                                                       MapInstance.Map.Grid);
            }

            Move(); // follow the target
        }