continuing to switch to MapCell orientation

This commit is contained in:
2026-07-03 02:16:29 -04:00
parent e6355167e3
commit 336b72e4cb
13 changed files with 81 additions and 82 deletions
+5 -5
View File
@@ -12,15 +12,15 @@ public partial class Spearman : FriendlyPeg
_visibility = 4;
}
public override Vector2I Goal()
public override MapCell Goal()
{
Map map = _pegController._playArea._map;
List<Peg> enemies = [.. _pegController._pegs.Where(p => p._disposition == -_disposition)];
Dictionary<Vector2I, MapCell> enemies = GetVisibleEnemies();
if (enemies.Count == 0)
{
return _address;
return _map._cells[_address];
}
List<Vector2I> closest = [.. enemies.OrderBy(e => (e._address - _address).Length()).Select(e => e._address)];
return closest[0];
Dictionary<Vector2I, MapCell> closest = enemies.OrderBy(e => (e.Value._occupant._address - _address).Length()).ToDictionary();
return closest.ElementAt(0).Value;
}
}