private void BotPerformMove(ICharacter c, ArenaFloorTile tile) { // Get movement with most distance. var moveAction = c.GetActions(false) .Where(a => a is MoveBase) .OrderByDescending(a => ((MoveBase)a).Distance) .FirstOrDefault() as MoveBase; if (moveAction == null) return; // Get as close to player as possible - find movement that does this. var d = moveAction.Distance; var newPosition = ArenaHelper.GetClosestMovablePosition(c.ArenaLocation.GetTileLocation(), tile.GetTileLocation(), d); var newTile = CurrentBattleDetails.Arena.ArenaFloor[newPosition.XCoord, newPosition.YCoord]; //TODO: Implement logic for bot moving around obstacles? For now don't allow movement onto tiles that have entities var actions = c.TargetTileAndSelectActions(newTile); if (actions.Exists(i => i.Name == moveAction.Name)) { if (EnableLogging) { Logger.WriteBattleTurnEntry(c.SkillTree.Get() .Where(s => s.IsActive) .OrderByDescending(s => s.Level) .First() .Path + " (" + c.Name + " " + c.Health + "/" + c.Mana + ") " + "performed " + moveAction.Name); } CurrentBattleDetails.TurnDetails.Add(moveAction.Perform((Character)c)); } }