public async Task AddFighter(List <Fighter> newFighters) { foreach (Fighter f in newFighters) { combatants.Add(f); LogMessageQueue.Log($"Added {f.Name}"); } EvaluateDeathStatus(); await EvaluateInitiativeOrder(); }
private void EvaluateDeathStatus() { List <Fighter> aliveToDying = new List <Fighter>(); List <Fighter> aliveToDead = new List <Fighter>(); foreach (Fighter alive in combatants) { if (!alive.isPC) { if (alive.HP <= 0 && Math.Abs(alive.HP) < alive.Con) { aliveToDying.Add(alive); LogMessageQueue.Log($"{alive.Name} is unconscious, but still alive!"); } else if (alive.HP <= 0) { aliveToDead.Add(alive); LogMessageQueue.Log($"{alive.Name} was completely killed!"); } } } TransferFightersToNewList(combatants, dyingCombatants, aliveToDying); TransferFightersToNewList(combatants, deadCombatants, aliveToDead); List <Fighter> dyingToDead = new List <Fighter>(); foreach (Fighter dying in dyingCombatants) { if (Math.Abs(dying.HP) >= dying.Con) { dyingToDead.Add(dying); LogMessageQueue.Log($"{dying.Name} bled out!"); } } TransferFightersToNewList(dyingCombatants, deadCombatants, dyingToDead); }
public void AddFighter(Fighter newFighter) { combatants.Add(newFighter); LogMessageQueue.Log($"Added {newFighter.Name}"); EvaluateDeathStatus(); }