using Godot; using System; using System.Collections.Generic; using System.Linq; public partial class Spearman : FriendlyPeg { public override void _Ready() { base._Ready(); _stamina = 2; _visibility = 4; } public override MapCell Goal() { Map map = _pegController._playArea._map; Dictionary enemies = GetVisibleEnemies(); if (enemies.Count == 0) { return _map._cells[_address]; } Dictionary closest = enemies.OrderBy(e => (e.Value._occupant._address - _address).Length()).ToDictionary(); return closest.ElementAt(0).Value; } }