public double ProfitPerRound(IGenerationGlobalContext context, bool printDetails = false) { double realTime = RealTime(context); double result = GeneratorUtils.CalculateProfitPerRound(this, context.GetUnitCount(GeneratorId), ProfitBoosts.Value * context.ProfitBoostValue) * TimeToProfit(realTime); if (printDetails) { //return generator.Data.BaseGeneration * count * profitBoost * Math.Pow(generator.Data.ProfitIncrementFactor, count); GeneratorInfoCollection collection = context as GeneratorInfoCollection; if (collection != null) { Dictionary <string, double> profitFormulaComponents = new Dictionary <string, double>() { ["BASE GEN"] = Data.BaseGeneration, ["UNIT COUNT"] = context.GetUnitCount(GeneratorId), ["LOCAL BOOSTS"] = ProfitBoosts.Value, ["GLOBAL BOOST"] = context.ProfitBoostValue, ["LOCBOOST * GLOBBOOST"] = ProfitBoosts.Value * context.ProfitBoostValue, ["PROFIT INCR FACTOR"] = Data.ProfitIncrementFactor, }; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.AppendLine(collection.ProfitBoostComponents.AsString(k => k, v => v.ToString("F2"))); sb.AppendLine("**********************"); sb.AppendLine(profitFormulaComponents.AsString(k => k, v => v.ToString("F2"))); Services.GetService <IConsoleService>().AddOutput(sb.ToString(), ConsoleTextColor.yellow, true); } } return(result); }
public ProfitBoostBuilder(GeneratorInfoCollection context) { this.context = context; }