Example #1
0
        private string EnumerateSolutionIssues(int waveIndex, WaveSolution solution)
        {
            bool      issuesFound  = false;
            string    issuesString = "";
            WaveStats stats        = WaveStatList[waveIndex];

            //
            // Is it possible to afford this solution?
            //

            if (stats.CoinAvail < stats.CoinNeeded)
            {
                issuesFound   = true;
                issuesString += "Can't afford at start of wave  ";
            }

            //
            // Are all the enemies killed in simulation?
            //

            if (LevelDesc.Waves[waveIndex].Count > stats.FullSimulation.EnemiesKilled)
            {
                issuesFound   = true;
                issuesString += "Enemies survived simulation  ";
            }

            if (!issuesFound)
            {
                return("<span foreground='green'>None</span>");
            }

            return("<span foreground='red'>" + issuesString + "</span>");
        }
Example #2
0
        private void CalculateStatsForWaves(List <TurretStats> Turrets)
        {
            WaveStatList = new List <WaveStats>();

            float maxDPSOverall = 0.0F;
            int   coinNeeded    = 0;

            for (int j = 0; j < Turrets.Count; j++)
            {
                maxDPSOverall += Turrets[j].MaxDPSOverall;
                coinNeeded    += Turrets[j].t.Cost;
            }

            int maxCoinEarned = LevelDesc.StartingCoins;

            for (int i = 0; i < LevelDesc.Waves.Count; i++)
            {
                EnemyWave        wave      = LevelDesc.Waves[i];
                EnemyDescription enemyDesc = LevelManager.LookupEnemy(wave.Enemy);
                WaveSolution     solution  = GenerateWaveSolution();
                WaveStats        stats     = new WaveStats();

                WaveSimulatorDamageStats singleEnemyStats = SimulateWave(enemyDesc, solution, 1, true);
                WaveSimulatorDamageStats fullWaveStats    = SimulateWave(enemyDesc, solution, wave.Count, false);

                EnemyDescription enemy = LevelManager.LookupEnemy(wave.Enemy);
                stats.MaxDmgDealtSingleEnemy = singleEnemyStats.DamageDealt;
                stats.MaxDPSOverall          = maxDPSOverall;
                stats.MaxHPPSProducted       = EnemyEditLayout.CalculateDPSforWave(enemy);
                stats.FullSimulation         = fullWaveStats;
                stats.CoinNeeded             = coinNeeded;
                stats.CoinAvail = maxCoinEarned;

                maxCoinEarned += (enemy.Coins * wave.Count);

                WaveStatList.Add(stats);
            }
        }