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 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; }