Skip to content

Instantly share code, notes, and snippets.

@graffic
Last active October 7, 2021 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graffic/8131b931033cedbce8376e4f588098d1 to your computer and use it in GitHub Desktop.
Save graffic/8131b931033cedbce8376e4f588098d1 to your computer and use it in GitHub Desktop.
Cookie clicker stats
// Calculates the price per click per second taking into account synergies.
function potato() {
const result = {}
for (const me of Object.values(Game.Objects).sort((a,b) => a.id - b.id)) {
let synergyBoost = 0
if (me.name=='Grandma')
{
for (var i in Game.GrandmaSynergies)
{
if (Game.Has(Game.GrandmaSynergies[i]))
{
let other=Game.Upgrades[Game.GrandmaSynergies[i]].buildingTie;
let mult=me.amount*0.01*(1/(other.id-1));
let boost=(other.storedTotalCps*Game.globalCpsMult)-(other.storedTotalCps*Game.globalCpsMult)/(1+mult);
synergyBoost += boost;
}
}
}
else if (me.name=='Portal' && Game.Has('Elder Pact'))
{
let other=Game.Objects['Grandma'];
let boost=(me.amount*0.05*other.amount)*Game.globalCpsMult;
synergyBoost+=boost;
}
for (const it of me.synergies)
{
if (Game.Has(it.name))
{
let weight=0.05;
let other=it.buildingTie1;
if (me==it.buildingTie1) {weight=0.001;other=it.buildingTie2;}
const boost=(other.storedTotalCps*Game.globalCpsMult)-(other.storedTotalCps*Game.globalCpsMult)/(1+me.amount*weight);
synergyBoost+=boost;
}
}
const price = me.getPrice(1)
const ppc = price / (((me.storedTotalCps/me.amount)*Game.globalCpsMult) + synergyBoost/me.amount)
result[me.name] = {ppc: Beautify(ppc), synergyBoost, price}
}
console.table(result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment