Last active
January 24, 2017 21:32
-
-
Save mlms13/c775511e64dd6241e77d to your computer and use it in GitHub Desktop.
List unpurchased upgrades in Cookie Clicker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I rewrite these way too often, so here they are: | |
// upgrades | |
Game.UpgradesById | |
.filter(function (up) { | |
return !up.bought && up.pool != "prestige" && up.pool != "toggle" && up.pool != "debug"; | |
}) | |
.map(_ => _.name); | |
// achievements | |
Game.AchievementsById | |
.filter(function (ach) { | |
return !ach.won && ach.pool != "shadow" && ach.pool != "dungeon"; | |
}) | |
.map(_ => _.desc); | |
// figure out the most valuable next building to buy | |
Object.values(Game.Objects).reduce(function (acc, curr) { | |
var totalOutput = curr.storedTotalCps * Game.globalCpsMult; | |
var oneOutput = totalOutput / curr.amount; | |
var value = oneOutput / curr.getPrice(); | |
return value > acc.value ? { name: curr.name, value: value} : acc; | |
}, { name: "None", value: 0 }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment