public void Skip(int turns) { var toRemove = new List <LinkedListNode <Invader> >(); foreach (var node in byPriority) { var invader = node.Value; invader.Distance -= turns; if (invader.Distance <= 0) { if (Energy <= invader.Damage) { Energy = 0; } else { Energy -= invader.Damage; } toRemove.Add(node); byInsertion.Remove(node); } } byPriority.RemoveMany(toRemove); }