示例#1
0
        public FighterEntry GetNearestEnnemy(short cellId = -1, Func <FighterEntry, bool> filter = null)
        {
            MapPoint     charMp = MapPoint.FromCellId(cellId == -1 ? PlayedFighter.CellId : cellId), ennemyMp;
            int          distance = -1, tempDistance;
            FighterEntry ennemy = null;

            foreach (var ennemyEntry in filter == null ? Ennemies : Ennemies.Where(f => filter(f)))
            {
                if (!ennemyEntry.Alive)
                {
                    continue;
                }

                ennemyMp     = MapPoint.FromCellId(ennemyEntry.CellId);
                tempDistance = charMp.DistanceToCell(ennemyMp);

                if (distance == -1 || tempDistance < distance)
                {
                    distance = tempDistance;
                    ennemy   = ennemyEntry;
                }
            }

            return(ennemy);
        }
示例#2
0
        public IEnumerable <FighterEntry> GetHandToHandEnnemies(short cellId = -1)
        {
            MapPoint charMp = MapPoint.FromCellId(cellId == -1 ? PlayedFighter.CellId : cellId);

            return(Ennemies.Where(e => e.Alive && charMp.DistanceToCell(MapPoint.FromCellId(e.CellId)) == 1));
        }