コード例 #1
0
ファイル: Battle.cs プロジェクト: se5a/EventHorizonGui
        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);
        }
コード例 #2
0
ファイル: Battle.cs プロジェクト: se5a/EventHorizonGui
 public bool DidShipSurviveRound(Ship ship, int round)
 {
     foreach (BattleEvent salvo in Salvos.Take(round))
     {
         if (salvo.Target == ship && salvo.TargetDestroyed)
         {
             return(false);
         }
     }
     return(true);
 }
コード例 #3
0
ファイル: Battle.cs プロジェクト: se5a/EventHorizonGui
        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);
        }