Skip to content

Instantly share code, notes, and snippets.

@mlms13
Last active January 24, 2017 21:32
Show Gist options
  • Save mlms13/c775511e64dd6241e77d to your computer and use it in GitHub Desktop.
Save mlms13/c775511e64dd6241e77d to your computer and use it in GitHub Desktop.
List unpurchased upgrades in Cookie Clicker
// 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