private void CharAction(ref ICharacter friend, ref ICharacter foe) { if (friend.GetStatus() == CharStatus.Normal) { // Check enemy status for advantage int advantage = 0; if (foe.GetStatus() == CharStatus.Unconscious) { advantage = 1; } // Roll to hit (roll, toHit) Tuple <int, int> attackRoll = friend.AttackRoll(advantage); if (attackRoll.Item1 == 20 || (attackRoll.Item2 > foe.GetAC() && attackRoll.Item1 != 1)) { // Check for crit bool crit = false; if (attackRoll.Item1 >= 20 || foe.GetStatus() == CharStatus.Unconscious) { crit = true; } // Roll damage int damage = friend.DamageRoll(crit); Tuple <bool, bool, bool> report = foe.HitByAttack(damage, crit); // Generate message log.Add(friend.GetShortName() + (crit ? " critically" : "") + " strikes " + foe.GetShortName() + " for " + damage + " damage! "); if (report.Item1) { log.Add(foe.GetShortName() + " falls unconscious! "); } else if (report.Item2) { log.Add(foe.GetShortName() + " is no longer stable! "); } else if (report.Item3) { log.Add(foe.GetShortName() + " dies! "); } // string report = char1.PickAction() or somesuch } else { log.Add(friend.GetShortName() + " strikes and misses! "); } } else if (friend.GetStatus() == CharStatus.Unconscious) { Tuple <int, bool, bool, bool> deathSave = friend.MakeDeathSave(); if (deathSave.Item1 == 1) { log.Add(friend.GetShortName() + " critically fails a death save! "); } else if (deathSave.Item1 == 20) { log.Add(friend.GetShortName() + " critically succeeds a death save! "); } else if (deathSave.Item1 >= 10) { log.Add(friend.GetShortName() + " succeeds a death save! "); } else { log.Add(friend.GetShortName() + " fails a death save! "); } if (deathSave.Item2) { log.Add(friend.GetShortName() + " revives! "); } if (deathSave.Item3) { log.Add(friend.GetShortName() + " stabilizes! "); } if (deathSave.Item4) { log.Add(friend.GetShortName() + " dies! "); } } else if (friend.GetStatus() == CharStatus.Stable) { log.Add(friend.GetShortName() + " does nothing! "); } }