public void FillCurrentMonstersFromRemainingMonsters() { int monstersToAdd = GetNumberOfMissingCurrentMonsters(); for (int i = 0; i < monstersToAdd; ++i) { if (RemainingMonsters.Count > 0) { IGameMonster monsterToAdd = RemainingMonsters[0]; CurrentMonsters.Add(monsterToAdd); RemainingMonsters.RemoveAt(0); } } }
/// <summary> /// Checks whether the specified monster exists in the current cell. /// </summary> /// <param name="name">The name of the monster whose existence should be checked.</param> /// <returns>Whether the specified monster exists and is alive in the current cell.</returns> public bool Exists(string name) => CurrentMonsters.Find(m => m.Name.Equals(name, StringComparison.OrdinalIgnoreCase) && m.Alive) != null;
public bool TryGetMonster(string name, out Monster monster) { monster = CurrentMonsters.Find(m => name == "*" || m.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); return(monster != null); }