Example #1
0
        public static List <int> GetCrossZone(int baseCell, int lenght, Map map)
        {
            List <int> openedList = new List <int>();

            openedList.Add(baseCell);
            int cCell = baseCell;

            for (int i = 0; i <= lenght - 1; i++)
            {
                cCell = Pathfinder.NextCell(map, cCell, 1);
                openedList.Add(cCell);
            }
            cCell = baseCell;
            for (int i = 0; i <= lenght - 1; i++)
            {
                cCell = Pathfinder.NextCell(map, cCell, 3);
                openedList.Add(cCell);
            }
            cCell = baseCell;
            for (int i = 0; i <= lenght - 1; i++)
            {
                cCell = Pathfinder.NextCell(map, cCell, 5);
                openedList.Add(cCell);
            }
            cCell = baseCell;
            for (int i = 0; i <= lenght - 1; i++)
            {
                cCell = Pathfinder.NextCell(map, cCell, 7);
                openedList.Add(cCell);
            }
            cCell = baseCell;
            return(openedList);
        }
Example #2
0
        public static int IsValidLine(Map Map, int BeginCell, int Direction, int EndCell)
        {
            var Length     = -1;
            var ActualCell = BeginCell;

            if (Pathfinder.InLine(Map, BeginCell, EndCell))
            {
                Length = (int)GoalDistanceEstimate(Map, BeginCell, EndCell);
            }
            else
            {
                Length = (int)(GoalDistanceEstimate(Map, BeginCell, EndCell) / 1.4);
            }

            for (int i = 0; i < Length; i++)
            {
                ActualCell = Pathfinder.NextCell(Map, ActualCell, Direction);
                if (!Map.IsCellWalkable(ActualCell))
                {
                    ;
                }
                //return -1;

                //return -1;
            }

            return(Length);
        }
Example #3
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);
        }
Example #4
0
        public static int GetRemoteCaseInThisDir(int dir, int distance, int cell, Map map)
        {
            int lastCell = cell;

            for (int i = 0; i <= distance; i++)
            {
                lastCell = Pathfinder.NextCell(map, lastCell, dir);
            }
            return(lastCell);
        }
Example #5
0
        public static List <int> GetJoinCell(int cell, Map map)
        {
            List <int> cells = new List <int>();

            cells.Add(Pathfinder.NextCell(map, cell, 1));
            cells.Add(Pathfinder.NextCell(map, cell, 3));
            cells.Add(Pathfinder.NextCell(map, cell, 5));
            cells.Add(Pathfinder.NextCell(map, cell, 7));
            return(cells);
        }
Example #6
0
        public static List <int> GetAdjacentCells(Map Map, int Cell)
        {
            var Cells = new List <int>();

            for (int i = 1; i < 8; i += 2)
            {
                Cells.Add(Pathfinder.NextCell(Map, Cell, i));
            }

            return(Cells);
        }
Example #7
0
        public static List <int> GetLineCells(Map Map, int Cell, int Direction, int Length)
        {
            var Cells    = new List <int>();
            var LastCell = Cell;

            for (int i = 0; i < Length; i++)
            {
                Cells.Add(Pathfinder.NextCell(Map, LastCell, Direction));
                LastCell = Cells[i];
            }
            return(Cells);
        }
Example #8
0
        public static List <Fighter> GetEnnemyNear(Fight Fight, FightTeam Team, int CellId)
        {
            List <Fighter> Ennemies = new List <Fighter>();

            foreach (var Direction in Pathfinder.FIGHT_DIRECTIONS)
            {
                var Ennemy = Fight.HasEnnemyInCell(Pathfinder.NextCell(Fight.Map, CellId, Direction), Team);
                if (Ennemy != null)
                {
                    if (!Ennemy.Dead)
                    {
                        Ennemies.Add(Ennemy);
                    }
                }
            }

            return(Ennemies);
        }