public void Update(DwarfTime time) { RoomBuilder.Faction = this; RoomBuilder.CheckRemovals(); Minions.RemoveAll(m => m.IsDead); SelectedMinions.RemoveAll(m => m.IsDead); if (this == World.PlayerFaction) { foreach (var m in Minions.Where(c => !SelectedMinions.Contains(c))) { if (m.Creature.SelectionCircle != null) { m.Creature.DeleteSelectionCircle(); } m.Creature.Sprite.DrawSilhouette = false; } ; foreach (CreatureAI creature in SelectedMinions) { if (creature.Creature.SelectionCircle == null) { creature.Creature.Physics.AddChild(new SelectionCircle(creature.Manager)); } creature.Creature.SelectionCircle.SetFlagRecursive(GameComponent.Flag.Visible, true); creature.Creature.Sprite.DrawSilhouette = true; } } foreach (Room zone in GetRooms()) { zone.ZoneBodies.RemoveAll(body => body.IsDead); } Designations.CleanupDesignations(); foreach (var zone in RoomBuilder.DesignatedRooms) { zone.Update(); } if (HandleThreatsTimer == null) { HandleThreatsTimer = new Timer(1.0f, false, Timer.TimerMode.Real ); } HandleThreatsTimer.Update(time); if (HandleThreatsTimer.HasTriggered) { HandleThreats(); } OwnedObjects.RemoveAll(obj => obj.IsDead); }
public void RemoveSummonedEntourage() { if (Minions != null) { foreach (var minion in Minions.Where(minion => minion != null)) { DeleteMinion(minion); } } if (Totems != null) { foreach (var totem in Totems.Where(totem => totem != null)) { DeleteMinion(totem); } } }
/// <summary> /// Move destroyed entities from <see cref="Zone.PLAY"/> <see cref="Zone{T}"/> into /// <see cref="Zone.GRAVEYARD"/> /// </summary> public void GraveYard() { // remove dead weapons var heroesBadWeapons = Heroes.Where(p => p.Weapon != null && (p.Weapon.Durability == 0 || p.Weapon.ToBeDestroyed)).ToList(); heroesBadWeapons.ForEach(p => p.RemoveWeapon()); // check for dead minions to carry to the graveyard Minions.Where(p => p.IsDead).ToList().ForEach(p => { Log(LogLevel.INFO, BlockType.PLAY, "Game", $"{p} is Dead! Graveyard say 'Hello'!"); p.Zone.Remove(p); if (p.HasDeathrattle) { p.ApplyEnchantments(EnchantmentActivation.DEATHRATTLE, Enums.Zone.GRAVEYARD); } if (History) { PowerHistoryBuilder.BlockStart(BlockType.DEATHS, 1, "", 0, 0); } p.IsExhausted = false; p.Controller.GraveyardZone.Add(p); p.Controller.NumFriendlyMinionsThatDiedThisTurn++; CurrentPlayer.NumMinionsPlayerKilledThisTurn++; NumMinionsKilledThisTurn++; p.Damage = 0; if (History) { PowerHistoryBuilder.BlockEnd(); } }); // check for dead heroes var deadHeroes = Heroes.Where(p => p.IsDead).ToList(); deadHeroes.ForEach(p => p.Controller.PlayState = deadHeroes.Count > 1 ? PlayState.TIED : PlayState.LOSING); }