Example #1
0
 public async Task AddFighter(List <Fighter> newFighters)
 {
     foreach (Fighter f in newFighters)
     {
         combatants.Add(f);
         LogMessageQueue.Log($"Added {f.Name}");
     }
     EvaluateDeathStatus();
     await EvaluateInitiativeOrder();
 }
Example #2
0
        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);
        }
Example #3
0
 public void AddFighter(Fighter newFighter)
 {
     combatants.Add(newFighter);
     LogMessageQueue.Log($"Added {newFighter.Name}");
     EvaluateDeathStatus();
 }