Пример #1
0
        /// <summary>
        /// Try to move to the targeted Cell (truncate the path if the player hasn't enough MP)
        /// </summary>
        /// <param name="cell">Targeted cell</param>
        /// <param name="mp">MP to use</param>
        /// <returns>False if cannot move</returns>
        public bool Move(Cell cell, int mp, IAdvancedPathFinder pathFinder = null, int minDistance = 0, bool cautious = true)
        {
            if (!IsPlaying())
            {
                return(false);
            }
            if (mp < 1)
            {
                Character.SendMessage(String.Format("Can't move with {0} MP", mp), Color.Red);
                return(false);
            }

            if (pathFinder == null)
            {
                pathFinder = new BiM.Behaviors.Game.World.Pathfinding.FFPathFinding.PathFinder(Fight, true);
            }
            Path path = null;

            path = pathFinder.FindPath(Cell, cell, false, Stats.CurrentMP < mp ? Stats.CurrentMP : mp, minDistance, true); // Try in cautious way first
            if (path == null || path.IsEmpty())
            {
                path = pathFinder.FindPath(Cell, cell, false, Stats.CurrentMP < mp ? Stats.CurrentMP : mp, minDistance, false); // If failed, then uncautious
                if (path != null && cautious)
                {
                    Character.SendWarning("Couldn't find a cautious path from {0} to {1}, so go the unsafe way", Cell, cell);
                }
            }
            return(Move(path));
        }
Пример #2
0
        /// <summary>
        /// Try to move to the targeted Cell (truncate the path if the player hasn't enough MP)
        /// </summary>
        /// <param name="cell">Targeted cell</param>
        /// <param name="mp">MP to use</param>
        /// <returns>False if cannot move</returns>
        public bool Move(Cell cell, int mp, IAdvancedPathFinder pathFinder = null, int minDistance = 0, bool cautious = true)
        {
            if (!IsPlaying())
                return false;
            if (mp < 1)
            {                
                Character.SendMessage(String.Format("Can't move with {0} MP", mp), Color.Red);
                return false;
            }

            if (pathFinder == null)
                    pathFinder = new BiM.Behaviors.Game.World.Pathfinding.FFPathFinding.PathFinder(Fight, true);
            Path path = null;
            path = pathFinder.FindPath(Cell, cell, false, Stats.CurrentMP < mp ? Stats.CurrentMP : mp, minDistance, true); // Try in cautious way first
            if (path == null || path.IsEmpty())
            {
                path = pathFinder.FindPath(Cell, cell, false, Stats.CurrentMP < mp ? Stats.CurrentMP : mp, minDistance, false); // If failed, then uncautious
                if (path != null && cautious)
                {
                    Character.SendWarning("Couldn't find a cautious path from {0} to {1}, so go the unsafe way", Cell, cell);
                }
            }
            return Move(path);

        }
Пример #3
0
 /// <summary>
 /// Try to move to the targeted Cell (truncate the path if the player hasn't enough MP)
 /// </summary>
 /// <param name="cell">Targeted cell</param>
 public bool Move(Cell cell, IAdvancedPathFinder pathFinder = null, int minDistance = 0, bool cautious = true)
 {
     return Move(cell, Stats.CurrentMP, pathFinder, minDistance, cautious);
 }
Пример #4
0
 /// <summary>
 /// Try to move to the targeted Cell (truncate the path if the player hasn't enough MP)
 /// </summary>
 /// <param name="cell">Targeted cell</param>
 public bool Move(Cell cell, IAdvancedPathFinder pathFinder = null, int minDistance = 0, bool cautious = true)
 {
     return(Move(cell, Stats.CurrentMP, pathFinder, minDistance, cautious));
 }