public Mood GetMoodAfter(int round) { if (round >= Salvos.Count()) { switch (Outcome) { case BattleOutcome.Stalemate: return(Mood.BattleEndStalemate); case BattleOutcome.Victory: return(Mood.BattleEndVictory); case BattleOutcome.Defeat: return(Mood.BattleEndDefeat); } } int us = GetOurStrengthAfterRound(round); int them = GetEnemyStrengthAfterRound(round); if (us / them >= Settings.Default.BattleFavorableThreshold) { return(Mood.BattleFavorable); } if (us / them <= Settings.Default.BattleUnfavorableThreshold) { return(Mood.BattleUnfavorable); } return(Mood.BattleEqual); }
public bool DidShipSurviveRound(Ship ship, int round) { foreach (BattleEvent salvo in Salvos.Take(round)) { if (salvo.Target == ship && salvo.TargetDestroyed) { return(false); } } return(true); }
public int GetEnemyStrengthAfterRound(int round) { // NOTE - may not be entirely accurate as ships shrink when they take damage! var salvos = Salvos.Take(round).ToArray(); int str = 0; foreach (var ship in EnemyShips) { if (DidShipSurviveRound(ship, round)) { str += ship.Size; } } return(str); }