public List <int> MoveUntilCanHit(Fighter fighter) { List <int> moves = new List <int>(); Fighter nearestFighter = fighter; int mp = Monster.CurrentMP; int baseCell = Monster.CellID; var pathEngine = new PathfindingV2(this.MonsterFight.Map); var path = pathEngine.FindShortestPath(baseCell, nearestFighter.CellID, this.GetDynObs(nearestFighter.CellID)); foreach (var cell in path) { if (cell.ID != nearestFighter.CellID) { moves.Add(cell.ID); mp--; if (mp == 0) { break; } } else { break; } } return(moves); }
public List <int> BestMoves(bool far = false) { if (this.Monster.LifePercentage <= 10) { return(MoveFar()); } List <int> moves = new List <int>(); Fighter nearestFighter = GetNearestFighter(); int mp = Monster.CurrentMP; int baseCell = Monster.CellID; var pathEngine = new PathfindingV2(this.MonsterFight.Map); var path = pathEngine.FindShortestPath(baseCell, nearestFighter.CellID, this.GetDynObs(nearestFighter.CellID)); foreach (var cell in path) { if (cell.ID != nearestFighter.CellID) { moves.Add(cell.ID); mp--; if (mp == 0) { break; } } else { break; } } return(moves); }
public void TestPath(int startCell, int endCell) { this.self.APIShowCell(startCell); this.self.APIShowCell(endCell); var finder = new PathfindingV2(this.self.APIGetMap().Engine); var result = finder.FindShortestPath(startCell, endCell, new List <int>()); this.self.APIMessage("Taille : " + result.Count); result.ForEach(x => this.self.APIShowCell(x.ID)); }
public void APIMove(int cellid) { var map = World.Helper.MapHelper.FindMap(this.MapId).Engine; var engine = new PathfindingV2(map); var path = engine.FindShortestPath(this.CellId, cellid, new List <int>()); var intCells = new List <int>(); path.ForEach(x => intCells.Add(x.ID)); this.Patterns = new Patterns.NpcPattern(this); var strPath = Engines.Pathfinding.CreateStringPath(this.CellId, this.Orientation, intCells, map); map.Send("GA0;1;" + this.TempID + ";" + strPath); this.CellId = cellid; }