diff --git a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/economy/minioncalculator/ProfitMinionCalculator.kt b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/economy/minioncalculator/ProfitMinionCalculator.kt index a80623c2..b91fa4e7 100644 --- a/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/economy/minioncalculator/ProfitMinionCalculator.kt +++ b/src/main/kotlin/me/partlysanestudios/partlysaneskies/features/economy/minioncalculator/ProfitMinionCalculator.kt @@ -478,29 +478,22 @@ class ProfitMinionCalculator(version: ElementaVersion) : WindowScreen(version) { 1 -> testUpgrades = listOf(upgrade1) 2 -> testUpgrades = listOf(upgrade1, upgrade2) } - val bestMinionsMap = MinionData.getMostProfitMinion(testUpgrades, fuel) - // Gets the price of the current test - var testMinionPrice = Int.MIN_VALUE.toDouble() - for (`val` in bestMinionsMap.values) { - if (`val` > testMinionPrice) { - testMinionPrice = `val` + MinionData.getBestMinions(testUpgrades, fuel).maxByOrNull { it.second }?.let { (_ , bestPrice) -> + if (bestPrice > bestProfit) { + bestUpgrades = testUpgrades + bestMinionFuel = fuel } } - if (testMinionPrice > bestProfit) { - bestUpgrades = testUpgrades - bestMinionFuel = fuel - } - println(testUpgrades) } } } resetFuels() - if (bestMinionFuel != null) { - changeFuel(bestMinionFuel.id, true) + bestMinionFuel?.let { + changeFuel(it.id, true) } resetUpgrades()