public static List <int> GetAllCellsForThisLinePath(int dir, int baseCell, int remoteCell, Map map) { List <int> cells = new List <int>(); if (!Pathfinder.InLine(map, baseCell, remoteCell)) { return(cells); } bool pathFinished = false; int timeOut = 0; while (!pathFinished) { baseCell = Pathfinder.DirToCellID(baseCell, char.Parse(GetDirChar(dir)), map, false); if (baseCell == remoteCell) { pathFinished = true; } else { cells.Add(baseCell); } timeOut++; if (timeOut >= 30) { break; } } return(cells); }
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); }
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); }
public static List <int> GetCrossCells(Map Map, int CurrentCell, int Radius) { var Cells = new List <int>(); foreach (var Cell in GetCircleCells(Map, CurrentCell, Radius)) { if (Pathfinder.InLine(Map, CurrentCell, Cell)) { Cells.Add(Cell); } } return(Cells); }