public static MovementPath IsValidPath(Fight Fight, Fighter Fighter, int CurrentCell, string EncodedPath) { var DecodedPath = Pathfinder.DecodePath(Fight.Map, CurrentCell, EncodedPath); var FinalPath = new MovementPath(); var Index = 0; int TransitCell = 0; do { TransitCell = DecodedPath.TransitCells[Index]; var Length = Pathfinder.IsValidLine(Fight, Fighter, FinalPath, TransitCell, DecodedPath.GetDirection(TransitCell), DecodedPath.TransitCells[Index + 1]); if (Length == -1) { return(null); } else if (Length == -2) { break; } Index++; }while (TransitCell != DecodedPath.LastStep); return(FinalPath); }
public static MovementPath IsValidPath(Map Map, int CurrentCell, string EncodedPath) { var DecodedPath = Pathfinder.DecodePath(Map, CurrentCell, EncodedPath); var Index = 0; int TransitCell = 0; do { TransitCell = DecodedPath.TransitCells[Index]; var Length = Pathfinder.IsValidLine(Map, TransitCell, DecodedPath.GetDirection(TransitCell), DecodedPath.TransitCells[Index + 1]); if (Length == -1) { return(null); } DecodedPath.MovementLength += Length; Index++; }while (TransitCell != DecodedPath.LastStep); return(DecodedPath); }