private void CleanupBattlefield() { LinkedList <Creature> buffer = new LinkedList <Creature>(); foreach (Creature c in lbxAttacking.Items) { if (!c.abilities.Contains <Creature.CreatureAbilities>(Creature.CreatureAbilities.Vigilance)) { c.Tapped = true; } buffer.AddLast(c); } foreach (Creature c in lbxDefending.Items) { buffer.AddLast(c); } lbxAttacking.Items.Clear(); lbxDefending.Items.Clear(); while (buffer.Count > 0) { Creature c = buffer.First.Value; declareDamage(c); buffer.RemoveFirst(); if (c.Health <= 0) { tbxAction.AppendText(String.Format("{0} goes to the graveyard.\n", c.ToString())); c.Graveyard.Add(c); } else { tbxAction.AppendText(String.Format("{0} needs attention\n", c.ToString())); c.Field.Add(c); } } }
private void CleanupBattlefield() { LinkedList <Creature> buffer = new LinkedList <Creature>(); foreach (Creature c in lbxAttacking.Items) { buffer.AddLast(c); } foreach (Creature c in lbxDefending.Items) { buffer.AddLast(c); } lbxAttacking.Items.Clear(); lbxDefending.Items.Clear(); while (buffer.Count > 0) { Creature c = buffer.First.Value; buffer.RemoveFirst(); if (c.Health <= 0) { tbxAction.AppendText(String.Format("{0} goes to the graveyard.\n", c.ToString())); c.Graveyard.Add(c); } else { tbxAction.AppendText(String.Format("{0} goes back to the field.\n", c.ToString())); c.Field.Add(c); } } }