Example #1
0
        public static int IsValidLine(Fight Fight, Fighter Fighter, MovementPath Path, int BeginCell, int Direction, int EndCell)
        {
            var Length     = -1;
            var ActualCell = BeginCell;

            if (!Pathfinder.InLine(Fight.Map, BeginCell, EndCell))
            {
                return(Length);
            }

            Length = (int)GoalDistanceEstimate(Fight.Map, BeginCell, EndCell);

            Path.AddCell(ActualCell, Direction);

            for (int i = 0; i < Length; i++)
            {
                ActualCell = Pathfinder.NextCell(Fight.Map, ActualCell, Direction);

                Path.AddCell(ActualCell, Direction);

                Path.MovementLength++;

                if (Pathfinder.IsStopCell(Fighter.Fight, Fighter.Team, ActualCell, Fighter))
                {
                    return(-2);
                }
            }

            return(Length);
        }