From 306c7c24a4d4ad319b0af6af00b7f782ca3eaea0 Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Sat, 5 Mar 2016 18:41:31 -0500 Subject: [PATCH 1/8] Version change to 2.4 --- CookieMonster.js | 2 +- src/Main.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index d0801c9..09edb61 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -2308,7 +2308,7 @@ CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBar CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '2'; -CM.VersionMinor = '3'; +CM.VersionMinor = '4'; /******* * Sim * diff --git a/src/Main.js b/src/Main.js index a126629..04151dc 100644 --- a/src/Main.js +++ b/src/Main.js @@ -183,5 +183,5 @@ CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBar CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '2'; -CM.VersionMinor = '3'; +CM.VersionMinor = '4'; From a09602fecd9f51ff9e179de813d5e702c8ce8496 Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Sun, 6 Mar 2016 22:21:35 -0500 Subject: [PATCH 2/8] Changed calculation from Base Cost per Income to Return on Investment (Issue #3 (partly), #28, #52) with the formula from @svschouw and minor README edit --- CookieMonster.js | 156 ++++++++++++++++++++++------------------------- README.md | 1 - src/Cache.js | 73 +++++++++++----------- src/Config.js | 2 +- src/Disp.js | 53 ++++++++-------- src/Main.js | 25 +++----- src/Sim.js | 3 + 7 files changed, 148 insertions(+), 165 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 09edb61..de50e13 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -44,70 +44,72 @@ CM.Cache.RemakeIncome = function() { CM.Sim.BuyBuildings(100, 'Objects100'); } -CM.Cache.RemakeBuildingsBCI = function() { - CM.Disp.min = -1; - CM.Disp.max = -1; - CM.Disp.mid = -1; +CM.Cache.RemakeBuildingsROI = function() { + CM.Cache.min = -1; + CM.Cache.max = -1; + CM.Cache.mid = -1; for (var i in CM.Cache.Objects) { - CM.Cache.Objects[i].bci = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus; - if (CM.Disp.min == -1 || CM.Cache.Objects[i].bci < CM.Disp.min) CM.Disp.min = CM.Cache.Objects[i].bci; - if (CM.Disp.max == -1 || CM.Cache.Objects[i].bci > CM.Disp.max) CM.Disp.max = CM.Cache.Objects[i].bci; + //CM.Cache.Objects[i].roi = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus; + CM.Cache.Objects[i].roi = (Math.max(Game.Objects[i].getPrice() - Game.cookies, 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus); + if (CM.Cache.min == -1 || CM.Cache.Objects[i].roi < CM.Cache.min) CM.Cache.min = CM.Cache.Objects[i].roi; + if (CM.Cache.max == -1 || CM.Cache.Objects[i].roi > CM.Cache.max) CM.Cache.max = CM.Cache.Objects[i].roi; } - CM.Disp.mid = ((CM.Disp.max - CM.Disp.min) / 2) + CM.Disp.min; + CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min; for (var i in CM.Cache.Objects) { var color = ''; - if (CM.Cache.Objects[i].bci == CM.Disp.min) color = CM.Disp.colorGreen; - else if (CM.Cache.Objects[i].bci == CM.Disp.max) color = CM.Disp.colorRed; - else if (CM.Cache.Objects[i].bci > CM.Disp.mid) color = CM.Disp.colorOrange; + if (CM.Cache.Objects[i].roi == CM.Cache.min) color = CM.Disp.colorGreen; + else if (CM.Cache.Objects[i].roi == CM.Cache.max) color = CM.Disp.colorRed; + else if (CM.Cache.Objects[i].roi > CM.Cache.mid) color = CM.Disp.colorOrange; else color = CM.Disp.colorYellow; CM.Cache.Objects[i].color = color; } } -CM.Cache.RemakeUpgradeBCI = function() { +CM.Cache.RemakeUpgradeROI = function() { for (var i in CM.Cache.Upgrades) { - CM.Cache.Upgrades[i].bci = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus; - if (isNaN(CM.Cache.Upgrades[i].bci)) CM.Cache.Upgrades[i].bci = 'Infinity'; + //CM.Cache.Upgrades[i].roi = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus; + CM.Cache.Upgrades[i].roi = (Math.max(Game.Upgrades[i].getPrice() - Game.cookies, 0) / Game.cookiesPs) + (Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus); + if (isNaN(CM.Cache.Upgrades[i].roi)) CM.Cache.Upgrades[i].roi = 'Infinity'; var color = ''; - if (CM.Cache.Upgrades[i].bci <= 0 || CM.Cache.Upgrades[i].bci == 'Infinity') color = CM.Disp.colorGray; - else if (CM.Cache.Upgrades[i].bci < CM.Disp.min) color = CM.Disp.colorBlue; - else if (CM.Cache.Upgrades[i].bci == CM.Disp.min) color = CM.Disp.colorGreen; - else if (CM.Cache.Upgrades[i].bci == CM.Disp.max) color = CM.Disp.colorRed; - else if (CM.Cache.Upgrades[i].bci > CM.Disp.max) color = CM.Disp.colorPurple; - else if (CM.Cache.Upgrades[i].bci > CM.Disp.mid) color = CM.Disp.colorOrange; + if (CM.Cache.Upgrades[i].roi <= 0 || CM.Cache.Upgrades[i].roi == 'Infinity') color = CM.Disp.colorGray; + else if (CM.Cache.Upgrades[i].roi < CM.Cache.min) color = CM.Disp.colorBlue; + else if (CM.Cache.Upgrades[i].roi == CM.Cache.min) color = CM.Disp.colorGreen; + else if (CM.Cache.Upgrades[i].roi == CM.Cache.max) color = CM.Disp.colorRed; + else if (CM.Cache.Upgrades[i].roi > CM.Cache.max) color = CM.Disp.colorPurple; + else if (CM.Cache.Upgrades[i].roi > CM.Cache.mid) color = CM.Disp.colorOrange; else color = CM.Disp.colorYellow; CM.Cache.Upgrades[i].color = color; } } -CM.Cache.RemakeBuildingsOtherBCI = function(amount, target) { +CM.Cache.RemakeBuildingsOtherROI = function(amount, target) { for (var i in CM.Cache[target]) { - CM.Cache[target][i].price = CM.Sim.BuildingGetPrice(Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, amount); - CM.Cache[target][i].bci = CM.Cache[target][i].price / CM.Cache[target][i].bonus; + //CM.Cache[target][i].roi = CM.Cache[target][i].price / CM.Cache[target][i].bonus; + CM.Cache[target][i].roi = (Math.max(CM.Cache[target][i].price - Game.cookies, 0) / Game.cookiesPs) + (CM.Cache[target][i].price / CM.Cache[target][i].bonus); var color = ''; - if (CM.Cache[target][i].bci <= 0 || CM.Cache[target][i].bci == 'Infinity') color = CM.Disp.colorGray; - else if (CM.Cache[target][i].bci < CM.Disp.min) color = CM.Disp.colorBlue; - else if (CM.Cache[target][i].bci == CM.Disp.min) color = CM.Disp.colorGreen; - else if (CM.Cache[target][i].bci == CM.Disp.max) color = CM.Disp.colorRed; - else if (CM.Cache[target][i].bci > CM.Disp.max) color = CM.Disp.colorPurple; - else if (CM.Cache[target][i].bci > CM.Disp.mid) color = CM.Disp.colorOrange; + if (CM.Cache[target][i].roi <= 0 || CM.Cache[target][i].roi == 'Infinity') color = CM.Disp.colorGray; + else if (CM.Cache[target][i].roi < CM.Cache.min) color = CM.Disp.colorBlue; + else if (CM.Cache[target][i].roi == CM.Cache.min) color = CM.Disp.colorGreen; + else if (CM.Cache[target][i].roi == CM.Cache.max) color = CM.Disp.colorRed; + else if (CM.Cache[target][i].roi > CM.Cache.max) color = CM.Disp.colorPurple; + else if (CM.Cache[target][i].roi > CM.Cache.mid) color = CM.Disp.colorOrange; else color = CM.Disp.colorYellow; CM.Cache[target][i].color = color; } } -CM.Cache.RemakeBCI = function() { +CM.Cache.RemakeROI = function() { // Buildings for 1 amount - CM.Cache.RemakeBuildingsBCI(); + CM.Cache.RemakeBuildingsROI(); // Upgrades - CM.Cache.RemakeUpgradeBCI(); + CM.Cache.RemakeUpgradeROI(); // Buildings for 10 amount - CM.Cache.RemakeBuildingsOtherBCI(10, 'Objects10'); + CM.Cache.RemakeBuildingsOtherROI(10, 'Objects10'); // Buildings for 100 amount - CM.Cache.RemakeBuildingsOtherBCI(100, 'Objects100'); + CM.Cache.RemakeBuildingsOtherROI(100, 'Objects100'); } CM.Cache.RemakeLucky = function() { @@ -209,6 +211,9 @@ CM.Cache.RemakeSellForChoEgg = function() { CM.Cache.SellForChoEgg = sellTotal; } +CM.Cache.min = -1; +CM.Cache.max = -1; +CM.Cache.mid = -1; CM.Cache.Lucky = 0; CM.Cache.LuckyReward = 0; CM.Cache.LuckyFrenzy = 0; @@ -345,7 +350,7 @@ CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timer CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}}; CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}}; CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', toggle: true, func: function() {CM.Disp.ToggleUpBarColor();}}; -CM.ConfigData.Colors = {desc: {Blue: 'Color Blue. Used to show better than best BCI building, for Click Frenzy bar, and for various labels', Green: 'Color Green. Used to show best BCI building, for Blood Frenzy bar, and for various labels', Yellow: 'Color Yellow. Used to show between best and worst BCI buildings closer to best, for Frenzy bar, and for various labels', Orange: 'Color Orange. Used to show between best and worst BCI buildings closer to worst, for Next Reindeer bar, and for various labels', Red: 'Color Red. Used to show worst BCI building, for Clot bar, and for various labels', Purple: 'Color Purple. Used to show worse than worst BCI building, for Next Cookie bar, and for various labels', Gray: 'Color Gray. Used to show negative or infinity BCI, and for Next Cookie/Next Reindeer bar', Pink: 'Color Pink. Used for Dragonflight bar', Brown: 'Color Brown. Used for Dragon Harvest bar'}, func: function() {CM.Disp.UpdateColors();}}; +CM.ConfigData.Colors = {desc: {Blue: 'Color Blue. Used to show better than best ROI building, for Click Frenzy bar, and for various labels', Green: 'Color Green. Used to show best ROI building, for Blood Frenzy bar, and for various labels', Yellow: 'Color Yellow. Used to show between best and worst ROI buildings closer to best, for Frenzy bar, and for various labels', Orange: 'Color Orange. Used to show between best and worst ROI buildings closer to worst, for Next Reindeer bar, and for various labels', Red: 'Color Red. Used to show worst ROI building, for Clot bar, and for various labels', Purple: 'Color Purple. Used to show worse than worst ROI building, for Next Cookie bar, and for various labels', Gray: 'Color Gray. Used to show negative or infinity ROI, and for Next Cookie/Next Reindeer bar', Pink: 'Color Pink. Used for Dragonflight bar', Brown: 'Color Brown. Used for Dragon Harvest bar'}, func: function() {CM.Disp.UpdateColors();}}; CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup', toggle: true}; CM.ConfigData.Sound = {label: ['Sounds OFF', 'Sounds ON'], desc: 'Play a sound on Golden Cookie/Season Popup', toggle: true}; CM.ConfigData.Volume = {label: [], desc: 'Volume of the sound'}; @@ -526,9 +531,9 @@ CM.Disp.CreateBotBar = function() { var bonus = document.createElement('tr'); bonus.appendChild(firstCol('Bonus Income', CM.Disp.colorBlue)); tbody.appendChild(bonus); - var bci = document.createElement('tr'); - bci.appendChild(firstCol('Base Cost Per Income', CM.Disp.colorBlue)); - tbody.appendChild(bci); + var roi = document.createElement('tr'); + roi.appendChild(firstCol('Return On Investment', CM.Disp.colorBlue)); + tbody.appendChild(roi); var time = document.createElement('tr'); time.appendChild(firstCol('Time Left', CM.Disp.colorBlue)); tbody.appendChild(time); @@ -542,7 +547,7 @@ CM.Disp.CreateBotBar = function() { header.appendChild(document.createTextNode(')')); type.appendChild(header); bonus.appendChild(document.createElement('td')); - bci.appendChild(document.createElement('td')); + roi.appendChild(document.createElement('td')); time.appendChild(document.createElement('td')); } @@ -572,7 +577,7 @@ CM.Disp.UpdateBotBarOther = function() { CM.Disp.BotBar.firstChild.firstChild.childNodes[0].childNodes[count].childNodes[1].textContent = Game.Objects[i].amount; CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].bonus, 2); CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache.Objects[i].color; - CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].bci, 2); + CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].roi, 2); } } } @@ -824,13 +829,13 @@ CM.Disp.UpdateBuildings = function() { if (CM.Config.BuildColor == 1 && Game.buyMode == 1) { var target = ''; if (Game.buyBulk == 10) { - target = 'Objects10' + target = 'Objects10'; } else if (Game.buyBulk == 100) { - target = 'Objects100' + target = 'Objects100'; } else { - target = 'Objects' + target = 'Objects'; } for (var i in CM.Cache[target]) { l('productPrice' + Game.Objects[i].id).style.color = CM.Config.Colors[CM.Cache[target][i].color]; @@ -877,13 +882,13 @@ CM.Disp.CreateUpgradeBar = function() { return div; } - legend.appendChild(legendLine(CM.Disp.colorBlue, 'Better than best BCI building')); - legend.appendChild(legendLine(CM.Disp.colorGreen, 'Same as best BCI building')); - legend.appendChild(legendLine(CM.Disp.colorYellow, 'Between best and worst BCI buildings closer to best')); - legend.appendChild(legendLine(CM.Disp.colorOrange, 'Between best and worst BCI buildings closer to worst')); - legend.appendChild(legendLine(CM.Disp.colorRed, 'Same as worst BCI building')); - legend.appendChild(legendLine(CM.Disp.colorPurple, 'Worse than worst BCI building')); - legend.appendChild(legendLine(CM.Disp.colorGray, 'Negative or infinity BCI')); + legend.appendChild(legendLine(CM.Disp.colorBlue, 'Better than best ROI building')); + legend.appendChild(legendLine(CM.Disp.colorGreen, 'Same as best ROI building')); + legend.appendChild(legendLine(CM.Disp.colorYellow, 'Between best and worst ROI buildings closer to best')); + legend.appendChild(legendLine(CM.Disp.colorOrange, 'Between best and worst ROI buildings closer to worst')); + legend.appendChild(legendLine(CM.Disp.colorRed, 'Same as worst ROI building')); + legend.appendChild(legendLine(CM.Disp.colorPurple, 'Worse than worst ROI building')); + legend.appendChild(legendLine(CM.Disp.colorGray, 'Negative or infinity ROI')); placeholder.appendChild(legend); CM.Disp.UpgradeBar.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');}; @@ -1864,11 +1869,11 @@ CM.Disp.Tooltip = function(type, name) { income.style.color = 'white'; income.id = 'CMTooltipIncome'; tooltip.appendChild(income); - tooltip.appendChild(header('Base Cost Per Income')); - var bci = document.createElement('div'); - bci.style.marginBottom = '4px'; - bci.id = 'CMTooltipBCI'; - tooltip.appendChild(bci); + tooltip.appendChild(header('Return On Investment')); + var roi = document.createElement('div'); + roi.style.marginBottom = '4px'; + roi.id = 'CMTooltipROI'; + tooltip.appendChild(roi); tooltip.appendChild(header('Time Left')); var time = document.createElement('div'); time.id = 'CMTooltipTime'; @@ -1906,8 +1911,8 @@ CM.Disp.UpdateTooltip = function() { bonus = CM.Cache[target][CM.Disp.tooltipName].bonus; if (CM.Config.Tooltip == 1 && Game.buyMode == 1) { l('CMTooltipBorder').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color; - l('CMTooltipBCI').textContent = Beautify(CM.Cache[target][CM.Disp.tooltipName].bci, 2); - l('CMTooltipBCI').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color; + l('CMTooltipROI').textContent = Beautify(CM.Cache[target][CM.Disp.tooltipName].roi, 2); + l('CMTooltipROI').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color; } } else { // Upgrades @@ -1915,8 +1920,8 @@ CM.Disp.UpdateTooltip = function() { price = Game.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].getPrice(); if (CM.Config.Tooltip == 1) { l('CMTooltipBorder').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color; - l('CMTooltipBCI').textContent = Beautify(CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].bci, 2); - l('CMTooltipBCI').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color; + l('CMTooltipROI').textContent = Beautify(CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].roi, 2); + l('CMTooltipROI').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color; } } if (CM.Config.Tooltip == 1 && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) { @@ -2090,9 +2095,6 @@ CM.Disp.RefreshScale = function() { CM.Disp.UpdateUpgrades(); } -CM.Disp.min = -1; -CM.Disp.max = -1; -CM.Disp.mid = -1; CM.Disp.colorTextPre = 'CMText'; CM.Disp.colorBackPre = 'CMBack'; CM.Disp.colorBorderPre = 'CMBorder'; @@ -2108,8 +2110,6 @@ CM.Disp.colorBrown = 'Brown'; CM.Disp.colors = [CM.Disp.colorBlue, CM.Disp.colorGreen, CM.Disp.colorYellow, CM.Disp.colorOrange, CM.Disp.colorRed, CM.Disp.colorPurple, CM.Disp.colorGray, CM.Disp.colorPink, CM.Disp.colorBrown]; CM.Disp.lastGoldenCookieState = 'none'; CM.Disp.lastAscendState = -1; -CM.Disp.lastBuyMode = -1; -CM.Disp.lastBuyBulk = -1; CM.Disp.metric = ['M', 'G', 'T', 'P', 'E', 'Z', 'Y']; CM.Disp.shortScale = ['M', 'B', 'Tr', 'Quadr', 'Quint', 'Sext', 'Sept', 'Oct', 'Non', 'Dec', 'Undec', 'Duodec', 'Tredec']; @@ -2211,33 +2211,22 @@ CM.Loop = function() { if (!Game.OnAscend && Game.AscendTimer == 0) { if (CM.Sim.DoSims) { CM.Cache.RemakeIncome(); - CM.Cache.RemakeBCI(); CM.Cache.RemakeLucky(); CM.Cache.RemakeChain(); CM.Cache.RemakeSeaSpec(); CM.Cache.RemakeSellForChoEgg(); - - CM.Disp.UpdateBotBarOther(); - CM.Disp.UpdateBuildings(); - CM.Disp.UpdateUpgrades(); CM.Sim.DoSims = 0; } - // Update Buildings Color for different buy/sell modes - var updateBuildings = false; - if (CM.Disp.lastBuyMode != Game.buyMode) { - CM.Disp.lastBuyMode = Game.buyMode; - updateBuildings = true; - } - if (CM.Disp.lastBuyBulk != Game.buyBulk) { - CM.Disp.lastBuyBulk = Game.buyBulk; - updateBuildings = true; - } - if (updateBuildings) { - CM.Disp.UpdateBuildings(); - } + // Calculate ROI + CM.Cache.RemakeROI(); + // Update colors + CM.Disp.UpdateBotBarOther(); + CM.Disp.UpdateBuildings(); + CM.Disp.UpdateUpgrades(); + // Redraw timers CM.Disp.UpdateBotBarTime(); CM.Disp.UpdateTimerBar(); @@ -2669,6 +2658,9 @@ CM.Sim.BuyBuildings = function(amount, target) { CM.Cache[target][i] = {}; CM.Cache[target][i].bonus = CM.Sim.cookiesPs - Game.cookiesPs; + if (amount != 1) { + CM.Cache[target][i].price = CM.Sim.BuildingGetPrice(Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, amount); + } } } diff --git a/README.md b/README.md index 192e2a7..a6c3ca2 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,6 @@ All suggestions are welcome, even the smallest ones. * **[Raving_Kumquat](http://cookieclicker.wikia.com/wiki/User:Raving_Kumquat)**: Original author * **[Maxime Fabre](https://github.com/Anahkiasen)**: Previous maintainer -* **Alderi Tokori**: ROI calculations (unused now) * **[Alhifar](https://github.com/Alhifar)**: Missed Golden Cookie Stat * **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons * **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer \ No newline at end of file diff --git a/src/Cache.js b/src/Cache.js index eb7eecc..2e6dc50 100644 --- a/src/Cache.js +++ b/src/Cache.js @@ -24,70 +24,72 @@ CM.Cache.RemakeIncome = function() { CM.Sim.BuyBuildings(100, 'Objects100'); } -CM.Cache.RemakeBuildingsBCI = function() { - CM.Disp.min = -1; - CM.Disp.max = -1; - CM.Disp.mid = -1; +CM.Cache.RemakeBuildingsROI = function() { + CM.Cache.min = -1; + CM.Cache.max = -1; + CM.Cache.mid = -1; for (var i in CM.Cache.Objects) { - CM.Cache.Objects[i].bci = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus; - if (CM.Disp.min == -1 || CM.Cache.Objects[i].bci < CM.Disp.min) CM.Disp.min = CM.Cache.Objects[i].bci; - if (CM.Disp.max == -1 || CM.Cache.Objects[i].bci > CM.Disp.max) CM.Disp.max = CM.Cache.Objects[i].bci; + //CM.Cache.Objects[i].roi = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus; + CM.Cache.Objects[i].roi = (Math.max(Game.Objects[i].getPrice() - Game.cookies, 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus); + if (CM.Cache.min == -1 || CM.Cache.Objects[i].roi < CM.Cache.min) CM.Cache.min = CM.Cache.Objects[i].roi; + if (CM.Cache.max == -1 || CM.Cache.Objects[i].roi > CM.Cache.max) CM.Cache.max = CM.Cache.Objects[i].roi; } - CM.Disp.mid = ((CM.Disp.max - CM.Disp.min) / 2) + CM.Disp.min; + CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min; for (var i in CM.Cache.Objects) { var color = ''; - if (CM.Cache.Objects[i].bci == CM.Disp.min) color = CM.Disp.colorGreen; - else if (CM.Cache.Objects[i].bci == CM.Disp.max) color = CM.Disp.colorRed; - else if (CM.Cache.Objects[i].bci > CM.Disp.mid) color = CM.Disp.colorOrange; + if (CM.Cache.Objects[i].roi == CM.Cache.min) color = CM.Disp.colorGreen; + else if (CM.Cache.Objects[i].roi == CM.Cache.max) color = CM.Disp.colorRed; + else if (CM.Cache.Objects[i].roi > CM.Cache.mid) color = CM.Disp.colorOrange; else color = CM.Disp.colorYellow; CM.Cache.Objects[i].color = color; } } -CM.Cache.RemakeUpgradeBCI = function() { +CM.Cache.RemakeUpgradeROI = function() { for (var i in CM.Cache.Upgrades) { - CM.Cache.Upgrades[i].bci = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus; - if (isNaN(CM.Cache.Upgrades[i].bci)) CM.Cache.Upgrades[i].bci = 'Infinity'; + //CM.Cache.Upgrades[i].roi = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus; + CM.Cache.Upgrades[i].roi = (Math.max(Game.Upgrades[i].getPrice() - Game.cookies, 0) / Game.cookiesPs) + (Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus); + if (isNaN(CM.Cache.Upgrades[i].roi)) CM.Cache.Upgrades[i].roi = 'Infinity'; var color = ''; - if (CM.Cache.Upgrades[i].bci <= 0 || CM.Cache.Upgrades[i].bci == 'Infinity') color = CM.Disp.colorGray; - else if (CM.Cache.Upgrades[i].bci < CM.Disp.min) color = CM.Disp.colorBlue; - else if (CM.Cache.Upgrades[i].bci == CM.Disp.min) color = CM.Disp.colorGreen; - else if (CM.Cache.Upgrades[i].bci == CM.Disp.max) color = CM.Disp.colorRed; - else if (CM.Cache.Upgrades[i].bci > CM.Disp.max) color = CM.Disp.colorPurple; - else if (CM.Cache.Upgrades[i].bci > CM.Disp.mid) color = CM.Disp.colorOrange; + if (CM.Cache.Upgrades[i].roi <= 0 || CM.Cache.Upgrades[i].roi == 'Infinity') color = CM.Disp.colorGray; + else if (CM.Cache.Upgrades[i].roi < CM.Cache.min) color = CM.Disp.colorBlue; + else if (CM.Cache.Upgrades[i].roi == CM.Cache.min) color = CM.Disp.colorGreen; + else if (CM.Cache.Upgrades[i].roi == CM.Cache.max) color = CM.Disp.colorRed; + else if (CM.Cache.Upgrades[i].roi > CM.Cache.max) color = CM.Disp.colorPurple; + else if (CM.Cache.Upgrades[i].roi > CM.Cache.mid) color = CM.Disp.colorOrange; else color = CM.Disp.colorYellow; CM.Cache.Upgrades[i].color = color; } } -CM.Cache.RemakeBuildingsOtherBCI = function(amount, target) { +CM.Cache.RemakeBuildingsOtherROI = function(amount, target) { for (var i in CM.Cache[target]) { - CM.Cache[target][i].price = CM.Sim.BuildingGetPrice(Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, amount); - CM.Cache[target][i].bci = CM.Cache[target][i].price / CM.Cache[target][i].bonus; + //CM.Cache[target][i].roi = CM.Cache[target][i].price / CM.Cache[target][i].bonus; + CM.Cache[target][i].roi = (Math.max(CM.Cache[target][i].price - Game.cookies, 0) / Game.cookiesPs) + (CM.Cache[target][i].price / CM.Cache[target][i].bonus); var color = ''; - if (CM.Cache[target][i].bci <= 0 || CM.Cache[target][i].bci == 'Infinity') color = CM.Disp.colorGray; - else if (CM.Cache[target][i].bci < CM.Disp.min) color = CM.Disp.colorBlue; - else if (CM.Cache[target][i].bci == CM.Disp.min) color = CM.Disp.colorGreen; - else if (CM.Cache[target][i].bci == CM.Disp.max) color = CM.Disp.colorRed; - else if (CM.Cache[target][i].bci > CM.Disp.max) color = CM.Disp.colorPurple; - else if (CM.Cache[target][i].bci > CM.Disp.mid) color = CM.Disp.colorOrange; + if (CM.Cache[target][i].roi <= 0 || CM.Cache[target][i].roi == 'Infinity') color = CM.Disp.colorGray; + else if (CM.Cache[target][i].roi < CM.Cache.min) color = CM.Disp.colorBlue; + else if (CM.Cache[target][i].roi == CM.Cache.min) color = CM.Disp.colorGreen; + else if (CM.Cache[target][i].roi == CM.Cache.max) color = CM.Disp.colorRed; + else if (CM.Cache[target][i].roi > CM.Cache.max) color = CM.Disp.colorPurple; + else if (CM.Cache[target][i].roi > CM.Cache.mid) color = CM.Disp.colorOrange; else color = CM.Disp.colorYellow; CM.Cache[target][i].color = color; } } -CM.Cache.RemakeBCI = function() { +CM.Cache.RemakeROI = function() { // Buildings for 1 amount - CM.Cache.RemakeBuildingsBCI(); + CM.Cache.RemakeBuildingsROI(); // Upgrades - CM.Cache.RemakeUpgradeBCI(); + CM.Cache.RemakeUpgradeROI(); // Buildings for 10 amount - CM.Cache.RemakeBuildingsOtherBCI(10, 'Objects10'); + CM.Cache.RemakeBuildingsOtherROI(10, 'Objects10'); // Buildings for 100 amount - CM.Cache.RemakeBuildingsOtherBCI(100, 'Objects100'); + CM.Cache.RemakeBuildingsOtherROI(100, 'Objects100'); } CM.Cache.RemakeLucky = function() { @@ -189,6 +191,9 @@ CM.Cache.RemakeSellForChoEgg = function() { CM.Cache.SellForChoEgg = sellTotal; } +CM.Cache.min = -1; +CM.Cache.max = -1; +CM.Cache.mid = -1; CM.Cache.Lucky = 0; CM.Cache.LuckyReward = 0; CM.Cache.LuckyFrenzy = 0; diff --git a/src/Config.js b/src/Config.js index e0d2678..a6ea9ff 100644 --- a/src/Config.js +++ b/src/Config.js @@ -119,7 +119,7 @@ CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timer CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}}; CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}}; CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', toggle: true, func: function() {CM.Disp.ToggleUpBarColor();}}; -CM.ConfigData.Colors = {desc: {Blue: 'Color Blue. Used to show better than best BCI building, for Click Frenzy bar, and for various labels', Green: 'Color Green. Used to show best BCI building, for Blood Frenzy bar, and for various labels', Yellow: 'Color Yellow. Used to show between best and worst BCI buildings closer to best, for Frenzy bar, and for various labels', Orange: 'Color Orange. Used to show between best and worst BCI buildings closer to worst, for Next Reindeer bar, and for various labels', Red: 'Color Red. Used to show worst BCI building, for Clot bar, and for various labels', Purple: 'Color Purple. Used to show worse than worst BCI building, for Next Cookie bar, and for various labels', Gray: 'Color Gray. Used to show negative or infinity BCI, and for Next Cookie/Next Reindeer bar', Pink: 'Color Pink. Used for Dragonflight bar', Brown: 'Color Brown. Used for Dragon Harvest bar'}, func: function() {CM.Disp.UpdateColors();}}; +CM.ConfigData.Colors = {desc: {Blue: 'Color Blue. Used to show better than best ROI building, for Click Frenzy bar, and for various labels', Green: 'Color Green. Used to show best ROI building, for Blood Frenzy bar, and for various labels', Yellow: 'Color Yellow. Used to show between best and worst ROI buildings closer to best, for Frenzy bar, and for various labels', Orange: 'Color Orange. Used to show between best and worst ROI buildings closer to worst, for Next Reindeer bar, and for various labels', Red: 'Color Red. Used to show worst ROI building, for Clot bar, and for various labels', Purple: 'Color Purple. Used to show worse than worst ROI building, for Next Cookie bar, and for various labels', Gray: 'Color Gray. Used to show negative or infinity ROI, and for Next Cookie/Next Reindeer bar', Pink: 'Color Pink. Used for Dragonflight bar', Brown: 'Color Brown. Used for Dragon Harvest bar'}, func: function() {CM.Disp.UpdateColors();}}; CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup', toggle: true}; CM.ConfigData.Sound = {label: ['Sounds OFF', 'Sounds ON'], desc: 'Play a sound on Golden Cookie/Season Popup', toggle: true}; CM.ConfigData.Volume = {label: [], desc: 'Volume of the sound'}; diff --git a/src/Disp.js b/src/Disp.js index 4874ab3..cddb867 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -148,9 +148,9 @@ CM.Disp.CreateBotBar = function() { var bonus = document.createElement('tr'); bonus.appendChild(firstCol('Bonus Income', CM.Disp.colorBlue)); tbody.appendChild(bonus); - var bci = document.createElement('tr'); - bci.appendChild(firstCol('Base Cost Per Income', CM.Disp.colorBlue)); - tbody.appendChild(bci); + var roi = document.createElement('tr'); + roi.appendChild(firstCol('Return On Investment', CM.Disp.colorBlue)); + tbody.appendChild(roi); var time = document.createElement('tr'); time.appendChild(firstCol('Time Left', CM.Disp.colorBlue)); tbody.appendChild(time); @@ -164,7 +164,7 @@ CM.Disp.CreateBotBar = function() { header.appendChild(document.createTextNode(')')); type.appendChild(header); bonus.appendChild(document.createElement('td')); - bci.appendChild(document.createElement('td')); + roi.appendChild(document.createElement('td')); time.appendChild(document.createElement('td')); } @@ -194,7 +194,7 @@ CM.Disp.UpdateBotBarOther = function() { CM.Disp.BotBar.firstChild.firstChild.childNodes[0].childNodes[count].childNodes[1].textContent = Game.Objects[i].amount; CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].bonus, 2); CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache.Objects[i].color; - CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].bci, 2); + CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].roi, 2); } } } @@ -446,13 +446,13 @@ CM.Disp.UpdateBuildings = function() { if (CM.Config.BuildColor == 1 && Game.buyMode == 1) { var target = ''; if (Game.buyBulk == 10) { - target = 'Objects10' + target = 'Objects10'; } else if (Game.buyBulk == 100) { - target = 'Objects100' + target = 'Objects100'; } else { - target = 'Objects' + target = 'Objects'; } for (var i in CM.Cache[target]) { l('productPrice' + Game.Objects[i].id).style.color = CM.Config.Colors[CM.Cache[target][i].color]; @@ -499,13 +499,13 @@ CM.Disp.CreateUpgradeBar = function() { return div; } - legend.appendChild(legendLine(CM.Disp.colorBlue, 'Better than best BCI building')); - legend.appendChild(legendLine(CM.Disp.colorGreen, 'Same as best BCI building')); - legend.appendChild(legendLine(CM.Disp.colorYellow, 'Between best and worst BCI buildings closer to best')); - legend.appendChild(legendLine(CM.Disp.colorOrange, 'Between best and worst BCI buildings closer to worst')); - legend.appendChild(legendLine(CM.Disp.colorRed, 'Same as worst BCI building')); - legend.appendChild(legendLine(CM.Disp.colorPurple, 'Worse than worst BCI building')); - legend.appendChild(legendLine(CM.Disp.colorGray, 'Negative or infinity BCI')); + legend.appendChild(legendLine(CM.Disp.colorBlue, 'Better than best ROI building')); + legend.appendChild(legendLine(CM.Disp.colorGreen, 'Same as best ROI building')); + legend.appendChild(legendLine(CM.Disp.colorYellow, 'Between best and worst ROI buildings closer to best')); + legend.appendChild(legendLine(CM.Disp.colorOrange, 'Between best and worst ROI buildings closer to worst')); + legend.appendChild(legendLine(CM.Disp.colorRed, 'Same as worst ROI building')); + legend.appendChild(legendLine(CM.Disp.colorPurple, 'Worse than worst ROI building')); + legend.appendChild(legendLine(CM.Disp.colorGray, 'Negative or infinity ROI')); placeholder.appendChild(legend); CM.Disp.UpgradeBar.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');}; @@ -1486,11 +1486,11 @@ CM.Disp.Tooltip = function(type, name) { income.style.color = 'white'; income.id = 'CMTooltipIncome'; tooltip.appendChild(income); - tooltip.appendChild(header('Base Cost Per Income')); - var bci = document.createElement('div'); - bci.style.marginBottom = '4px'; - bci.id = 'CMTooltipBCI'; - tooltip.appendChild(bci); + tooltip.appendChild(header('Return On Investment')); + var roi = document.createElement('div'); + roi.style.marginBottom = '4px'; + roi.id = 'CMTooltipROI'; + tooltip.appendChild(roi); tooltip.appendChild(header('Time Left')); var time = document.createElement('div'); time.id = 'CMTooltipTime'; @@ -1528,8 +1528,8 @@ CM.Disp.UpdateTooltip = function() { bonus = CM.Cache[target][CM.Disp.tooltipName].bonus; if (CM.Config.Tooltip == 1 && Game.buyMode == 1) { l('CMTooltipBorder').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color; - l('CMTooltipBCI').textContent = Beautify(CM.Cache[target][CM.Disp.tooltipName].bci, 2); - l('CMTooltipBCI').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color; + l('CMTooltipROI').textContent = Beautify(CM.Cache[target][CM.Disp.tooltipName].roi, 2); + l('CMTooltipROI').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color; } } else { // Upgrades @@ -1537,8 +1537,8 @@ CM.Disp.UpdateTooltip = function() { price = Game.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].getPrice(); if (CM.Config.Tooltip == 1) { l('CMTooltipBorder').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color; - l('CMTooltipBCI').textContent = Beautify(CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].bci, 2); - l('CMTooltipBCI').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color; + l('CMTooltipROI').textContent = Beautify(CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].roi, 2); + l('CMTooltipROI').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color; } } if (CM.Config.Tooltip == 1 && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) { @@ -1712,9 +1712,6 @@ CM.Disp.RefreshScale = function() { CM.Disp.UpdateUpgrades(); } -CM.Disp.min = -1; -CM.Disp.max = -1; -CM.Disp.mid = -1; CM.Disp.colorTextPre = 'CMText'; CM.Disp.colorBackPre = 'CMBack'; CM.Disp.colorBorderPre = 'CMBorder'; @@ -1730,8 +1727,6 @@ CM.Disp.colorBrown = 'Brown'; CM.Disp.colors = [CM.Disp.colorBlue, CM.Disp.colorGreen, CM.Disp.colorYellow, CM.Disp.colorOrange, CM.Disp.colorRed, CM.Disp.colorPurple, CM.Disp.colorGray, CM.Disp.colorPink, CM.Disp.colorBrown]; CM.Disp.lastGoldenCookieState = 'none'; CM.Disp.lastAscendState = -1; -CM.Disp.lastBuyMode = -1; -CM.Disp.lastBuyBulk = -1; CM.Disp.metric = ['M', 'G', 'T', 'P', 'E', 'Z', 'Y']; CM.Disp.shortScale = ['M', 'B', 'Tr', 'Quadr', 'Quint', 'Sext', 'Sept', 'Oct', 'Non', 'Dec', 'Undec', 'Duodec', 'Tredec']; diff --git a/src/Main.js b/src/Main.js index 04151dc..0076180 100644 --- a/src/Main.js +++ b/src/Main.js @@ -86,33 +86,22 @@ CM.Loop = function() { if (!Game.OnAscend && Game.AscendTimer == 0) { if (CM.Sim.DoSims) { CM.Cache.RemakeIncome(); - CM.Cache.RemakeBCI(); CM.Cache.RemakeLucky(); CM.Cache.RemakeChain(); CM.Cache.RemakeSeaSpec(); CM.Cache.RemakeSellForChoEgg(); - - CM.Disp.UpdateBotBarOther(); - CM.Disp.UpdateBuildings(); - CM.Disp.UpdateUpgrades(); CM.Sim.DoSims = 0; } - // Update Buildings Color for different buy/sell modes - var updateBuildings = false; - if (CM.Disp.lastBuyMode != Game.buyMode) { - CM.Disp.lastBuyMode = Game.buyMode; - updateBuildings = true; - } - if (CM.Disp.lastBuyBulk != Game.buyBulk) { - CM.Disp.lastBuyBulk = Game.buyBulk; - updateBuildings = true; - } - if (updateBuildings) { - CM.Disp.UpdateBuildings(); - } + // Calculate ROI + CM.Cache.RemakeROI(); + // Update colors + CM.Disp.UpdateBotBarOther(); + CM.Disp.UpdateBuildings(); + CM.Disp.UpdateUpgrades(); + // Redraw timers CM.Disp.UpdateBotBarTime(); CM.Disp.UpdateTimerBar(); diff --git a/src/Sim.js b/src/Sim.js index 1c98632..fb7d962 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -357,6 +357,9 @@ CM.Sim.BuyBuildings = function(amount, target) { CM.Cache[target][i] = {}; CM.Cache[target][i].bonus = CM.Sim.cookiesPs - Game.cookiesPs; + if (amount != 1) { + CM.Cache[target][i].price = CM.Sim.BuildingGetPrice(Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, amount); + } } } From 1dcc814fa4e569fcf3c4c0f7fc61404d97ef90c6 Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Sun, 6 Mar 2016 22:41:37 -0500 Subject: [PATCH 3/8] Added back Alderi Tokori to credits with correct link. I confused him with Maxime Fabre --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a6c3ca2..e808779 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,7 @@ All suggestions are welcome, even the smallest ones. * **[Raving_Kumquat](http://cookieclicker.wikia.com/wiki/User:Raving_Kumquat)**: Original author * **[Maxime Fabre](https://github.com/Anahkiasen)**: Previous maintainer +* **[Alderi Tokori](http://forum.dashnet.org/profile/Alderi)**: ROI calculations (unused now) * **[Alhifar](https://github.com/Alhifar)**: Missed Golden Cookie Stat * **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons * **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer \ No newline at end of file From 6c1f08a6c07537d3ba65c71ab0879564d808c3a7 Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Thu, 10 Mar 2016 19:27:29 -0500 Subject: [PATCH 4/8] Updated README to ROI information and credited @svschouw --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e808779..b24faf3 100644 --- a/README.md +++ b/README.md @@ -12,21 +12,21 @@ You can see the current version, and a full history of all versions and what the At its core, Cookie Monster computes an index on both buildings and upgrades: -* **Base Cost per Income (BCI)**: Indicates how much a building is worth by comparing how much it costs to how much income gained +* **Return On Investment (ROI)**: Indicates how much a building is worth by using the formula max(cost - cookies in bank, 0)/cps + cost/Δ cps Cookie Monster also indicates the time left before being able to buy an upgrade or building, and takes it into consideration. It will take *everything* in consideration, meaning if buying a building also unlocks an achievement which boosts your income, which unlocks an achievement, it will know and highlight that building's value. This index is computed for buildings and upgrades. If the relevant option is enabled, it will color-code each of them based on their value: -* Light Blue: (upgrades) This item has a better BCI than any building -* Green: This item has the best BCI +* Light Blue: (upgrades) This item has a better ROI than any building +* Green: This item has the best ROI * Yellow: This item is not the best, but it is closer to best than it is to worst * Orange: This item is not the worst, but it is closer to worst than it is to best -* Red: This item has the worst BCI -* Purple: (upgrades) This item has a worse BCI than any building +* Red: This item has the worst ROI +* Purple: (upgrades) This item has a worse ROI than any building * Gray: (upgrades) This item has not been calculated and/or cannot be calculated due to no definitive worth. -Note: For this index, **lower is better**, meaning a building with a BCI of 1 is more interesting than one with a BCI of 3. +Note: For this index, **lower is better**, meaning a building with a ROI of 1 is more interesting than one with a ROI of 3. ## What it doesn't do @@ -134,4 +134,5 @@ All suggestions are welcome, even the smallest ones. * **[Alderi Tokori](http://forum.dashnet.org/profile/Alderi)**: ROI calculations (unused now) * **[Alhifar](https://github.com/Alhifar)**: Missed Golden Cookie Stat * **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons +* **[Sandworm](https://github.com/svschouw)**: Modified ROI Calculation to account for cookies in bank already * **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer \ No newline at end of file From dd25067271e2538ebafa33a49fed4fd2e1919aec Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Thu, 10 Mar 2016 19:48:42 -0500 Subject: [PATCH 5/8] Updated README, added option to change bulk buildings colors between the single buildings colors or calculated colors (Issue #59 and #63) --- CookieMonster.js | 8 +++++--- README.md | 2 +- src/Config.js | 1 + src/Disp.js | 5 +++-- src/Main.js | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index de50e13..3f821bd 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -349,6 +349,7 @@ CM.ConfigData.BotBar = {label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Build CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', toggle: true, func: function() {CM.Disp.ToggleTimerBar();}}; CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}}; CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}}; +CM.ConfigData.BulkBuildColor = {label: ['Bulk Building Colors (Single Buildings Color)', 'Bulk Building Colors (Calculated Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}}; CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', toggle: true, func: function() {CM.Disp.ToggleUpBarColor();}}; CM.ConfigData.Colors = {desc: {Blue: 'Color Blue. Used to show better than best ROI building, for Click Frenzy bar, and for various labels', Green: 'Color Green. Used to show best ROI building, for Blood Frenzy bar, and for various labels', Yellow: 'Color Yellow. Used to show between best and worst ROI buildings closer to best, for Frenzy bar, and for various labels', Orange: 'Color Orange. Used to show between best and worst ROI buildings closer to worst, for Next Reindeer bar, and for various labels', Red: 'Color Red. Used to show worst ROI building, for Clot bar, and for various labels', Purple: 'Color Purple. Used to show worse than worst ROI building, for Next Cookie bar, and for various labels', Gray: 'Color Gray. Used to show negative or infinity ROI, and for Next Cookie/Next Reindeer bar', Pink: 'Color Pink. Used for Dragonflight bar', Brown: 'Color Brown. Used for Dragon Harvest bar'}, func: function() {CM.Disp.UpdateColors();}}; CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup', toggle: true}; @@ -828,10 +829,10 @@ CM.Disp.UpdateBotTimerBarDisplay = function() { CM.Disp.UpdateBuildings = function() { if (CM.Config.BuildColor == 1 && Game.buyMode == 1) { var target = ''; - if (Game.buyBulk == 10) { + if (Game.buyBulk == 10 && CM.Config.BulkBuildColor == 1) { target = 'Objects10'; } - else if (Game.buyBulk == 100) { + else if (Game.buyBulk == 100 && CM.Config.BulkBuildColor == 1) { target = 'Objects100'; } else { @@ -1238,6 +1239,7 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(listing('TimerBar')); frag.appendChild(listing('TimerBarPos')); frag.appendChild(listing('BuildColor')); + frag.appendChild(listing('BulkBuildColor')); frag.appendChild(listing('UpBarColor')); for (var i = 0; i < CM.Disp.colors.length; i++) { var div = document.createElement('div'); @@ -2293,7 +2295,7 @@ CM.DelayInit = function() { Game.Win('Third-party'); } -CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Favicon: 1, Tooltip: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWarnCautBon: 0, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'}}; +CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, BulkBuildColor: 0, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Favicon: 1, Tooltip: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWarnCautBon: 0, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'}}; CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '2'; diff --git a/README.md b/README.md index b24faf3..644d65a 100644 --- a/README.md +++ b/README.md @@ -134,5 +134,5 @@ All suggestions are welcome, even the smallest ones. * **[Alderi Tokori](http://forum.dashnet.org/profile/Alderi)**: ROI calculations (unused now) * **[Alhifar](https://github.com/Alhifar)**: Missed Golden Cookie Stat * **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons -* **[Sandworm](https://github.com/svschouw)**: Modified ROI Calculation to account for cookies in bank already +* **[Sandworm](https://github.com/svschouw)**: Modified ROI calculation * **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer \ No newline at end of file diff --git a/src/Config.js b/src/Config.js index a6ea9ff..6e511bf 100644 --- a/src/Config.js +++ b/src/Config.js @@ -118,6 +118,7 @@ CM.ConfigData.BotBar = {label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Build CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', toggle: true, func: function() {CM.Disp.ToggleTimerBar();}}; CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}}; CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}}; +CM.ConfigData.BulkBuildColor = {label: ['Bulk Building Colors (Single Buildings Color)', 'Bulk Building Colors (Calculated Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}}; CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', toggle: true, func: function() {CM.Disp.ToggleUpBarColor();}}; CM.ConfigData.Colors = {desc: {Blue: 'Color Blue. Used to show better than best ROI building, for Click Frenzy bar, and for various labels', Green: 'Color Green. Used to show best ROI building, for Blood Frenzy bar, and for various labels', Yellow: 'Color Yellow. Used to show between best and worst ROI buildings closer to best, for Frenzy bar, and for various labels', Orange: 'Color Orange. Used to show between best and worst ROI buildings closer to worst, for Next Reindeer bar, and for various labels', Red: 'Color Red. Used to show worst ROI building, for Clot bar, and for various labels', Purple: 'Color Purple. Used to show worse than worst ROI building, for Next Cookie bar, and for various labels', Gray: 'Color Gray. Used to show negative or infinity ROI, and for Next Cookie/Next Reindeer bar', Pink: 'Color Pink. Used for Dragonflight bar', Brown: 'Color Brown. Used for Dragon Harvest bar'}, func: function() {CM.Disp.UpdateColors();}}; CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup', toggle: true}; diff --git a/src/Disp.js b/src/Disp.js index cddb867..660b363 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -445,10 +445,10 @@ CM.Disp.UpdateBotTimerBarDisplay = function() { CM.Disp.UpdateBuildings = function() { if (CM.Config.BuildColor == 1 && Game.buyMode == 1) { var target = ''; - if (Game.buyBulk == 10) { + if (Game.buyBulk == 10 && CM.Config.BulkBuildColor == 1) { target = 'Objects10'; } - else if (Game.buyBulk == 100) { + else if (Game.buyBulk == 100 && CM.Config.BulkBuildColor == 1) { target = 'Objects100'; } else { @@ -855,6 +855,7 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(listing('TimerBar')); frag.appendChild(listing('TimerBarPos')); frag.appendChild(listing('BuildColor')); + frag.appendChild(listing('BulkBuildColor')); frag.appendChild(listing('UpBarColor')); for (var i = 0; i < CM.Disp.colors.length; i++) { var div = document.createElement('div'); diff --git a/src/Main.js b/src/Main.js index 0076180..9fec7ae 100644 --- a/src/Main.js +++ b/src/Main.js @@ -168,7 +168,7 @@ CM.DelayInit = function() { Game.Win('Third-party'); } -CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Favicon: 1, Tooltip: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWarnCautBon: 0, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'}}; +CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, BulkBuildColor: 0, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Favicon: 1, Tooltip: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWarnCautBon: 0, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'}}; CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '2'; From f0d492ea4a702331237fa975edb095651386a4a8 Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Thu, 10 Mar 2016 21:33:23 -0500 Subject: [PATCH 6/8] Split/combine "Lucky!" stat when needed (Issue #60) --- CookieMonster.js | 10 +++++++--- src/Disp.js | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 3f821bd..c21c858 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1384,6 +1384,10 @@ CM.Disp.AddMenuStats = function(title) { luckyRewardFrenzyMaxWrath *= 1.1; luckyCurWrath *= 1.1; } + var luckySplit = false; + if (luckyRewardMax != luckyRewardMaxWrath) { + luckySplit = true; + } var luckyReqFrag = document.createDocumentFragment(); var luckyReqSpan = document.createElement('span'); @@ -1409,9 +1413,9 @@ CM.Disp.AddMenuStats = function(title) { luckyReqFrenFrag.appendChild(luckyReqFrenSmall); } stats.appendChild(listing('\"Lucky!\" Cookies Required (Frenzy)', luckyReqFrenFrag)); - stats.appendChild(listing('\"Lucky!\" Reward (MAX) (Golden / Wrath)', document.createTextNode(Beautify(luckyRewardMax) + ' / ' + Beautify(luckyRewardMaxWrath)))); - stats.appendChild(listing('\"Lucky!\" Reward (MAX) (Frenzy) (Golden / Wrath)', document.createTextNode(Beautify(luckyRewardFrenzyMax) + ' / ' + Beautify(luckyRewardFrenzyMaxWrath)))); - stats.appendChild(listing('\"Lucky!\" Reward (CUR) (Golden / Wrath)', document.createTextNode(Beautify(luckyCur) + ' / ' + Beautify(luckyCurWrath)))); + stats.appendChild(listing('\"Lucky!\" Reward (MAX)' + (luckySplit ? ' (Golden / Wrath)' : ''), document.createTextNode(Beautify(luckyRewardMax) + (luckySplit ? (' / ' + Beautify(luckyRewardMaxWrath)) : '')))); + stats.appendChild(listing('\"Lucky!\" Reward (MAX) (Frenzy)' + (luckySplit ? ' (Golden / Wrath)' : ''), document.createTextNode(Beautify(luckyRewardFrenzyMax) + (luckySplit ? (' / ' + Beautify(luckyRewardFrenzyMaxWrath)) : '')))); + stats.appendChild(listing('\"Lucky!\" Reward (CUR)' + (luckySplit ? ' (Golden / Wrath)' : ''), document.createTextNode(Beautify(luckyCur) + (luckySplit ? (' / ' + Beautify(luckyCurWrath)) : '')))); } stats.appendChild(header('Chain Cookies', 'Chain')); diff --git a/src/Disp.js b/src/Disp.js index 660b363..3241207 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1000,6 +1000,10 @@ CM.Disp.AddMenuStats = function(title) { luckyRewardFrenzyMaxWrath *= 1.1; luckyCurWrath *= 1.1; } + var luckySplit = false; + if (luckyRewardMax != luckyRewardMaxWrath) { + luckySplit = true; + } var luckyReqFrag = document.createDocumentFragment(); var luckyReqSpan = document.createElement('span'); @@ -1025,9 +1029,9 @@ CM.Disp.AddMenuStats = function(title) { luckyReqFrenFrag.appendChild(luckyReqFrenSmall); } stats.appendChild(listing('\"Lucky!\" Cookies Required (Frenzy)', luckyReqFrenFrag)); - stats.appendChild(listing('\"Lucky!\" Reward (MAX) (Golden / Wrath)', document.createTextNode(Beautify(luckyRewardMax) + ' / ' + Beautify(luckyRewardMaxWrath)))); - stats.appendChild(listing('\"Lucky!\" Reward (MAX) (Frenzy) (Golden / Wrath)', document.createTextNode(Beautify(luckyRewardFrenzyMax) + ' / ' + Beautify(luckyRewardFrenzyMaxWrath)))); - stats.appendChild(listing('\"Lucky!\" Reward (CUR) (Golden / Wrath)', document.createTextNode(Beautify(luckyCur) + ' / ' + Beautify(luckyCurWrath)))); + stats.appendChild(listing('\"Lucky!\" Reward (MAX)' + (luckySplit ? ' (Golden / Wrath)' : ''), document.createTextNode(Beautify(luckyRewardMax) + (luckySplit ? (' / ' + Beautify(luckyRewardMaxWrath)) : '')))); + stats.appendChild(listing('\"Lucky!\" Reward (MAX) (Frenzy)' + (luckySplit ? ' (Golden / Wrath)' : ''), document.createTextNode(Beautify(luckyRewardFrenzyMax) + (luckySplit ? (' / ' + Beautify(luckyRewardFrenzyMaxWrath)) : '')))); + stats.appendChild(listing('\"Lucky!\" Reward (CUR)' + (luckySplit ? ' (Golden / Wrath)' : ''), document.createTextNode(Beautify(luckyCur) + (luckySplit ? (' / ' + Beautify(luckyCurWrath)) : '')))); } stats.appendChild(header('Chain Cookies', 'Chain')); From 00a9ea2cd4fb94973449d475f82b2a9944511e2a Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Sun, 13 Mar 2016 10:51:10 -0400 Subject: [PATCH 7/8] Added Century Egg stat, fixed golden cookie stats to not include Golden Switch boost (Issue #64), changed pop all wrinkler button to only pop wrinklers that has sucked some cookies (Issue #66), and minor cleanup/bug fix --- CookieMonster.js | 113 ++++++++++++++++++++++++++++++++++++----------- src/Cache.js | 6 ++- src/Disp.js | 89 ++++++++++++++++++++++++++++--------- src/Main.js | 4 ++ src/Sim.js | 14 +++++- 5 files changed, 176 insertions(+), 50 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index c21c858..2a49412 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -113,7 +113,7 @@ CM.Cache.RemakeROI = function() { } CM.Cache.RemakeLucky = function() { - CM.Cache.Lucky = (Game.cookiesPs * 60 * 15) / 0.15; + CM.Cache.Lucky = (CM.Cache.NoGoldSwitchCookiesPS * 60 * 15) / 0.15; if (Game.frenzy > 0) { CM.Cache.Lucky /= Game.frenzyPower; } @@ -135,7 +135,7 @@ CM.Cache.MaxChainMoni = function(digit, maxPayout) { } CM.Cache.RemakeChain = function() { - var maxPayout = Game.cookiesPs * 60 * 60 * 6; + var maxPayout = CM.Cache.NoGoldSwitchCookiesPS * 60 * 60 * 6; if (Game.frenzy > 0) { maxPayout /= Game.frenzyPower; } @@ -214,6 +214,7 @@ CM.Cache.RemakeSellForChoEgg = function() { CM.Cache.min = -1; CM.Cache.max = -1; CM.Cache.mid = -1; +CM.Cache.NoGoldSwitchCookiesPS = 0; CM.Cache.Lucky = 0; CM.Cache.LuckyReward = 0; CM.Cache.LuckyFrenzy = 0; @@ -227,6 +228,7 @@ CM.Cache.ChainFrenzy = 0; CM.Cache.ChainFrenzyWrath = 0; CM.Cache.ChainFrenzyReward = 0; CM.Cache.ChainFrenzyWrathReward = 0; +CM.Cache.CentEgg = 0; CM.Cache.SellForChoEgg = 0; /********** @@ -1148,6 +1150,26 @@ CM.Disp.UpdateTitle = function() { } } +CM.Disp.CollectWrinklers = function() { + for (var i in Game.wrinklers) { + if (Game.wrinklers[i].sucked > 0) { + Game.wrinklers[i].hp = 0; + } + } +} + +CM.Disp.CreateGoldCookTooltip = function() { + CM.Disp.GoldCookTooltipPlaceholder = document.createElement('div'); + var goldCookDesc = document.createElement('div'); + goldCookDesc.style.minWidth = '200px'; + goldCookDesc.style.marginBottom = '4px'; + var div = document.createElement('div'); + div.style.textAlign = 'left'; + div.textContent = 'Calculated with Golden Switch off'; + goldCookDesc.appendChild(div); + CM.Disp.GoldCookTooltipPlaceholder.appendChild(goldCookDesc); +} + CM.Disp.CreateResetTooltip = function() { CM.Disp.ResetTooltipPlaceholder = document.createElement('div'); var resetTitleDesc = document.createElement('div'); @@ -1361,13 +1383,36 @@ CM.Disp.AddMenuStats = function(title) { return div; } + if (CM.Config.StatsPref.Lucky || CM.Config.StatsPref.Chain) { + var goldListing = function(text) { + var frag = document.createDocumentFragment(); + frag.appendChild(document.createTextNode(text + ' ')); + var span = document.createElement('span'); + span.onmouseout = function() { Game.tooltip.hide(); }; + span.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp.GoldCookTooltipPlaceholder.innerHTML));}; + span.style.cursor = 'default'; + span.style.display = 'inline-block'; + span.style.height = '10px'; + span.style.width = '10px'; + span.style.borderRadius = '5px'; + span.style.textAlign = 'center'; + span.style.backgroundColor = '#C0C0C0'; + span.style.color = 'black'; + span.style.fontSize = '9px'; + span.style.verticalAlign = 'bottom'; + span.textContent = '?'; + frag.appendChild(span); + return frag; + } + } + stats.appendChild(header('Lucky Cookies', 'Lucky')); if (CM.Config.StatsPref.Lucky) { var luckyColor = (Game.cookies < CM.Cache.Lucky) ? CM.Disp.colorRed : CM.Disp.colorGreen; var luckyTime = (Game.cookies < CM.Cache.Lucky) ? CM.Disp.FormatTime((CM.Cache.Lucky - Game.cookies) / (Game.cookiesPs * (1 - Game.cpsSucked))) : ''; var luckyColorFrenzy = (Game.cookies < CM.Cache.LuckyFrenzy) ? CM.Disp.colorRed : CM.Disp.colorGreen; var luckyTimeFrenzy = (Game.cookies < CM.Cache.LuckyFrenzy) ? CM.Disp.FormatTime((CM.Cache.LuckyFrenzy - Game.cookies) / (Game.cookiesPs * (1 - Game.cpsSucked))) : ''; - var luckyCurBase = Math.min(Game.cookies * 0.15, Game.cookiesPs * 60 * 15) + 13; + var luckyCurBase = Math.min(Game.cookies * 0.15, CM.Cache.NoGoldSwitchCookiesPS * 60 * 15) + 13; var luckyRewardMax = CM.Cache.LuckyReward; var luckyRewardMaxWrath = CM.Cache.LuckyReward; var luckyRewardFrenzyMax = CM.Cache.LuckyRewardFrenzy; @@ -1384,10 +1429,7 @@ CM.Disp.AddMenuStats = function(title) { luckyRewardFrenzyMaxWrath *= 1.1; luckyCurWrath *= 1.1; } - var luckySplit = false; - if (luckyRewardMax != luckyRewardMaxWrath) { - luckySplit = true; - } + var luckySplit = luckyRewardMax != luckyRewardMaxWrath; var luckyReqFrag = document.createDocumentFragment(); var luckyReqSpan = document.createElement('span'); @@ -1400,7 +1442,7 @@ CM.Disp.AddMenuStats = function(title) { luckyReqSmall.textContent = ' (' + luckyTime + ')'; luckyReqFrag.appendChild(luckyReqSmall); } - stats.appendChild(listing('\"Lucky!\" Cookies Required', luckyReqFrag)); + stats.appendChild(listing(goldListing('\"Lucky!\" Cookies Required'), luckyReqFrag)); var luckyReqFrenFrag = document.createDocumentFragment(); var luckyReqFrenSpan = document.createElement('span'); luckyReqFrenSpan.style.fontWeight = 'bold'; @@ -1412,10 +1454,10 @@ CM.Disp.AddMenuStats = function(title) { luckyReqFrenSmall.textContent = ' (' + luckyTimeFrenzy + ')'; luckyReqFrenFrag.appendChild(luckyReqFrenSmall); } - stats.appendChild(listing('\"Lucky!\" Cookies Required (Frenzy)', luckyReqFrenFrag)); - stats.appendChild(listing('\"Lucky!\" Reward (MAX)' + (luckySplit ? ' (Golden / Wrath)' : ''), document.createTextNode(Beautify(luckyRewardMax) + (luckySplit ? (' / ' + Beautify(luckyRewardMaxWrath)) : '')))); - stats.appendChild(listing('\"Lucky!\" Reward (MAX) (Frenzy)' + (luckySplit ? ' (Golden / Wrath)' : ''), document.createTextNode(Beautify(luckyRewardFrenzyMax) + (luckySplit ? (' / ' + Beautify(luckyRewardFrenzyMaxWrath)) : '')))); - stats.appendChild(listing('\"Lucky!\" Reward (CUR)' + (luckySplit ? ' (Golden / Wrath)' : ''), document.createTextNode(Beautify(luckyCur) + (luckySplit ? (' / ' + Beautify(luckyCurWrath)) : '')))); + stats.appendChild(listing(goldListing('\"Lucky!\" Cookies Required (Frenzy)'), luckyReqFrenFrag)); + stats.appendChild(listing(goldListing('\"Lucky!\" Reward (MAX)' + (luckySplit ? ' (Golden / Wrath)' : '')), document.createTextNode(Beautify(luckyRewardMax) + (luckySplit ? (' / ' + Beautify(luckyRewardMaxWrath)) : '')))); + stats.appendChild(listing(goldListing('\"Lucky!\" Reward (MAX) (Frenzy)' + (luckySplit ? ' (Golden / Wrath)' : '')), document.createTextNode(Beautify(luckyRewardFrenzyMax) + (luckySplit ? (' / ' + Beautify(luckyRewardFrenzyMaxWrath)) : '')))); + stats.appendChild(listing(goldListing('\"Lucky!\" Reward (CUR)' + (luckySplit ? ' (Golden / Wrath)' : '')), document.createTextNode(Beautify(luckyCur) + (luckySplit ? (' / ' + Beautify(luckyCurWrath)) : '')))); } stats.appendChild(header('Chain Cookies', 'Chain')); @@ -1433,7 +1475,7 @@ CM.Disp.AddMenuStats = function(title) { var chainWrathRewardMax = CM.Cache.ChainWrathReward; var chainFrenzyRewardMax = CM.Cache.ChainFrenzyReward; var chainFrenzyWrathRewardMax = CM.Cache.ChainFrenzyWrathReward; - var chainCurMax = Math.min(Game.cookiesPs * 60 * 60 * 6, Game.cookies * 0.25); + var chainCurMax = Math.min(CM.Cache.NoGoldSwitchCookiesPS * 60 * 60 * 6, Game.cookies * 0.25); var chainCur = CM.Cache.MaxChainMoni(7, chainCurMax); var chainCurWrath = CM.Cache.MaxChainMoni(6, chainCurMax); if (Game.hasAura('Ancestral Metamorphosis')) { @@ -1458,7 +1500,7 @@ CM.Disp.AddMenuStats = function(title) { chainReqSmall.textContent = ' (' + chainTime + ')'; chainReqFrag.appendChild(chainReqSmall); } - stats.appendChild(listing('\"Chain\" Cookies Required', chainReqFrag)); + stats.appendChild(listing(goldListing('\"Chain\" Cookies Required'), chainReqFrag)); var chainWrathReqFrag = document.createDocumentFragment(); var chainWrathReqSpan = document.createElement('span'); chainWrathReqSpan.style.fontWeight = 'bold'; @@ -1470,7 +1512,7 @@ CM.Disp.AddMenuStats = function(title) { chainWrathReqSmall.textContent = ' (' + chainWrathTime + ')'; chainWrathReqFrag.appendChild(chainWrathReqSmall); } - stats.appendChild(listing('\"Chain\" Cookies Required (Wrath)', chainWrathReqFrag)); + stats.appendChild(listing(goldListing('\"Chain\" Cookies Required (Wrath)'), chainWrathReqFrag)); var chainReqFrenFrag = document.createDocumentFragment(); var chainReqFrenSpan = document.createElement('span'); chainReqFrenSpan.style.fontWeight = 'bold'; @@ -1482,7 +1524,7 @@ CM.Disp.AddMenuStats = function(title) { chainReqFrenSmall.textContent = ' (' + chainTimeFrenzy + ')'; chainReqFrenFrag.appendChild(chainReqFrenSmall); } - stats.appendChild(listing('\"Chain\" Cookies Required (Frenzy)', chainReqFrenFrag)); + stats.appendChild(listing(goldListing('\"Chain\" Cookies Required (Frenzy)'), chainReqFrenFrag)); var chainWrathReqFrenFrag = document.createDocumentFragment(); var chainWrathReqFrenFrag = document.createDocumentFragment(); var chainWrathReqFrenSpan = document.createElement('span'); @@ -1495,10 +1537,10 @@ CM.Disp.AddMenuStats = function(title) { chainWrathReqFrenSmall.textContent = ' (' + chainWrathTimeFrenzy + ')'; chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSmall); } - stats.appendChild(listing('\"Chain\" Cookies Required (Frenzy) (Wrath)', chainWrathReqFrenFrag)); - stats.appendChild(listing('\"Chain\" Reward (MAX) (Golden / Wrath)', document.createTextNode(Beautify(chainRewardMax) + ' / ' + Beautify(chainWrathRewardMax)))); - stats.appendChild(listing('\"Chain\" Reward (MAX) (Frenzy) (Golden / Wrath)', document.createTextNode(Beautify(chainFrenzyRewardMax) + ' / ' + Beautify(chainFrenzyWrathRewardMax)))); - stats.appendChild(listing('\"Chain\" Reward (CUR) (Golden / Wrath)', document.createTextNode(Beautify(chainCur) + ' / ' + Beautify(chainCurWrath)))); + stats.appendChild(listing(goldListing('\"Chain\" Cookies Required (Frenzy) (Wrath)'), chainWrathReqFrenFrag)); + stats.appendChild(listing(goldListing('\"Chain\" Reward (MAX) (Golden / Wrath)'), document.createTextNode(Beautify(chainRewardMax) + ' / ' + Beautify(chainWrathRewardMax)))); + stats.appendChild(listing(goldListing('\"Chain\" Reward (MAX) (Frenzy) (Golden / Wrath)'), document.createTextNode(Beautify(chainFrenzyRewardMax) + ' / ' + Beautify(chainFrenzyWrathRewardMax)))); + stats.appendChild(listing(goldListing('\"Chain\" Reward (CUR) (Golden / Wrath)'), document.createTextNode(Beautify(chainCur) + ' / ' + Beautify(chainCurWrath)))); } stats.appendChild(header('Prestige', 'Prestige')); @@ -1514,7 +1556,7 @@ CM.Disp.AddMenuStats = function(title) { cookiesNextFrag.appendChild(cookiesNextSmall); stats.appendChild(listing('Cookies To Next Level', cookiesNextFrag)); var resetTitleFrag = document.createDocumentFragment(); - resetTitleFrag.appendChild(document.createTextNode('Reset Bonus Income ')) + resetTitleFrag.appendChild(document.createTextNode('Reset Bonus Income ')); var resetTitleSpan = document.createElement('span'); resetTitleSpan.onmouseout = function() { Game.tooltip.hide(); }; resetTitleSpan.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp.ResetTooltipPlaceholder.innerHTML));}; @@ -1564,7 +1606,7 @@ CM.Disp.AddMenuStats = function(title) { var popAllA = document.createElement('a'); popAllA.textContent = 'Pop All'; popAllA.className = 'option'; - popAllA.onclick = function() {Game.CollectWrinklers();}; + popAllA.onclick = function() { CM.Disp.CollectWrinklers(); }; popAllFrag.appendChild(popAllA); stats.appendChild(listing('Rewards of Popping', popAllFrag)); } @@ -1608,7 +1650,9 @@ CM.Disp.AddMenuStats = function(title) { } } - if (Game.season == 'christmas' || specDisp || choEgg) { + var centEgg = Game.Has('Century egg'); + + if (Game.season == 'christmas' || specDisp || choEgg || centEgg) { stats.appendChild(header('Season Specials', 'Sea')); if (CM.Config.StatsPref.Sea) { if (specDisp) { @@ -1681,7 +1725,10 @@ CM.Disp.AddMenuStats = function(title) { } choEggTotal *= 0.05; stats.appendChild(listing(choEggTitleFrag, document.createTextNode(Beautify(choEggTotal)))); - } + } + if (centEgg) { + stats.appendChild(listing('Century Egg Multiplier', document.createTextNode(Beautify(CM.Cache.CentEgg, 1) + '%'))); + } } } @@ -2217,8 +2264,11 @@ CM.Loop = function() { if (!Game.OnAscend && Game.AscendTimer == 0) { if (CM.Sim.DoSims) { CM.Cache.RemakeIncome(); + + CM.Sim.NoGoldSwitchCookiesPS(); // Needed first CM.Cache.RemakeLucky(); CM.Cache.RemakeChain(); + CM.Cache.RemakeSeaSpec(); CM.Cache.RemakeSellForChoEgg(); @@ -2281,6 +2331,7 @@ CM.DelayInit = function() { CM.Disp.CreateWhiteScreen(); CM.Disp.CreateFavicon(); CM.Disp.CreateGCTimer(); + CM.Disp.CreateGoldCookTooltip(); CM.Disp.CreateResetTooltip(); CM.Disp.CreateChoEggTooltip(); CM.Disp.CreateTooltipWarnCaut(); @@ -2529,7 +2580,8 @@ CM.Sim.CalculateGains = function() { // The boost increases a little every day, with diminishing returns up to +10% on the 100th day var day = Math.floor((CM.Sim.Date - Game.startDate) / 1000 / 10) * 10 / 60 / 60 / 24; day = Math.min(day,100); - eggMult += (1 - Math.pow(1 - day / 100, 3)) * 10; + CM.Cache.CentEgg = (1 - Math.pow(1 - day / 100, 3)) * 10; + eggMult += CM.Cache.CentEgg; } mult *= (1 + 0.01 * eggMult); @@ -2710,6 +2762,16 @@ CM.Sim.BuyUpgrades = function() { } } +CM.Sim.NoGoldSwitchCookiesPS = function() { + if (Game.Has('Golden switch [off]')) { + CM.Sim.CopyData(); + CM.Sim.Upgrades['Golden switch [off]'].bought = 0; + CM.Sim.CalculateGains(); + CM.Cache.NoGoldSwitchCookiesPS = CM.Sim.cookiesPs; + } + else CM.Cache.NoGoldSwitchCookiesPS = Game.cookiesPs; +} + CM.Sim.ResetBonus = function() { CM.Sim.CopyData(); @@ -2743,6 +2805,7 @@ CM.Sim.ResetBonus = function() { if (CM.Sim.Upgrades['Heavenly key'].bought == 0) { CM.Sim.Upgrades['Heavenly key'].bought = 1; CM.Sim.UpgradesOwned++; + CM.Sim.Win('Wholesome'); } CM.Sim.prestige = Math.floor(Game.HowMuchPrestige(Game.cookiesEarned + Game.cookiesReset)); diff --git a/src/Cache.js b/src/Cache.js index 2e6dc50..51d781b 100644 --- a/src/Cache.js +++ b/src/Cache.js @@ -93,7 +93,7 @@ CM.Cache.RemakeROI = function() { } CM.Cache.RemakeLucky = function() { - CM.Cache.Lucky = (Game.cookiesPs * 60 * 15) / 0.15; + CM.Cache.Lucky = (CM.Cache.NoGoldSwitchCookiesPS * 60 * 15) / 0.15; if (Game.frenzy > 0) { CM.Cache.Lucky /= Game.frenzyPower; } @@ -115,7 +115,7 @@ CM.Cache.MaxChainMoni = function(digit, maxPayout) { } CM.Cache.RemakeChain = function() { - var maxPayout = Game.cookiesPs * 60 * 60 * 6; + var maxPayout = CM.Cache.NoGoldSwitchCookiesPS * 60 * 60 * 6; if (Game.frenzy > 0) { maxPayout /= Game.frenzyPower; } @@ -194,6 +194,7 @@ CM.Cache.RemakeSellForChoEgg = function() { CM.Cache.min = -1; CM.Cache.max = -1; CM.Cache.mid = -1; +CM.Cache.NoGoldSwitchCookiesPS = 0; CM.Cache.Lucky = 0; CM.Cache.LuckyReward = 0; CM.Cache.LuckyFrenzy = 0; @@ -207,5 +208,6 @@ CM.Cache.ChainFrenzy = 0; CM.Cache.ChainFrenzyWrath = 0; CM.Cache.ChainFrenzyReward = 0; CM.Cache.ChainFrenzyWrathReward = 0; +CM.Cache.CentEgg = 0; CM.Cache.SellForChoEgg = 0; diff --git a/src/Disp.js b/src/Disp.js index 3241207..b7ed21d 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -764,6 +764,26 @@ CM.Disp.UpdateTitle = function() { } } +CM.Disp.CollectWrinklers = function() { + for (var i in Game.wrinklers) { + if (Game.wrinklers[i].sucked > 0) { + Game.wrinklers[i].hp = 0; + } + } +} + +CM.Disp.CreateGoldCookTooltip = function() { + CM.Disp.GoldCookTooltipPlaceholder = document.createElement('div'); + var goldCookDesc = document.createElement('div'); + goldCookDesc.style.minWidth = '200px'; + goldCookDesc.style.marginBottom = '4px'; + var div = document.createElement('div'); + div.style.textAlign = 'left'; + div.textContent = 'Calculated with Golden Switch off'; + goldCookDesc.appendChild(div); + CM.Disp.GoldCookTooltipPlaceholder.appendChild(goldCookDesc); +} + CM.Disp.CreateResetTooltip = function() { CM.Disp.ResetTooltipPlaceholder = document.createElement('div'); var resetTitleDesc = document.createElement('div'); @@ -977,13 +997,36 @@ CM.Disp.AddMenuStats = function(title) { return div; } + if (CM.Config.StatsPref.Lucky || CM.Config.StatsPref.Chain) { + var goldListing = function(text) { + var frag = document.createDocumentFragment(); + frag.appendChild(document.createTextNode(text + ' ')); + var span = document.createElement('span'); + span.onmouseout = function() { Game.tooltip.hide(); }; + span.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp.GoldCookTooltipPlaceholder.innerHTML));}; + span.style.cursor = 'default'; + span.style.display = 'inline-block'; + span.style.height = '10px'; + span.style.width = '10px'; + span.style.borderRadius = '5px'; + span.style.textAlign = 'center'; + span.style.backgroundColor = '#C0C0C0'; + span.style.color = 'black'; + span.style.fontSize = '9px'; + span.style.verticalAlign = 'bottom'; + span.textContent = '?'; + frag.appendChild(span); + return frag; + } + } + stats.appendChild(header('Lucky Cookies', 'Lucky')); if (CM.Config.StatsPref.Lucky) { var luckyColor = (Game.cookies < CM.Cache.Lucky) ? CM.Disp.colorRed : CM.Disp.colorGreen; var luckyTime = (Game.cookies < CM.Cache.Lucky) ? CM.Disp.FormatTime((CM.Cache.Lucky - Game.cookies) / (Game.cookiesPs * (1 - Game.cpsSucked))) : ''; var luckyColorFrenzy = (Game.cookies < CM.Cache.LuckyFrenzy) ? CM.Disp.colorRed : CM.Disp.colorGreen; var luckyTimeFrenzy = (Game.cookies < CM.Cache.LuckyFrenzy) ? CM.Disp.FormatTime((CM.Cache.LuckyFrenzy - Game.cookies) / (Game.cookiesPs * (1 - Game.cpsSucked))) : ''; - var luckyCurBase = Math.min(Game.cookies * 0.15, Game.cookiesPs * 60 * 15) + 13; + var luckyCurBase = Math.min(Game.cookies * 0.15, CM.Cache.NoGoldSwitchCookiesPS * 60 * 15) + 13; var luckyRewardMax = CM.Cache.LuckyReward; var luckyRewardMaxWrath = CM.Cache.LuckyReward; var luckyRewardFrenzyMax = CM.Cache.LuckyRewardFrenzy; @@ -1000,10 +1043,7 @@ CM.Disp.AddMenuStats = function(title) { luckyRewardFrenzyMaxWrath *= 1.1; luckyCurWrath *= 1.1; } - var luckySplit = false; - if (luckyRewardMax != luckyRewardMaxWrath) { - luckySplit = true; - } + var luckySplit = luckyRewardMax != luckyRewardMaxWrath; var luckyReqFrag = document.createDocumentFragment(); var luckyReqSpan = document.createElement('span'); @@ -1016,7 +1056,7 @@ CM.Disp.AddMenuStats = function(title) { luckyReqSmall.textContent = ' (' + luckyTime + ')'; luckyReqFrag.appendChild(luckyReqSmall); } - stats.appendChild(listing('\"Lucky!\" Cookies Required', luckyReqFrag)); + stats.appendChild(listing(goldListing('\"Lucky!\" Cookies Required'), luckyReqFrag)); var luckyReqFrenFrag = document.createDocumentFragment(); var luckyReqFrenSpan = document.createElement('span'); luckyReqFrenSpan.style.fontWeight = 'bold'; @@ -1028,10 +1068,10 @@ CM.Disp.AddMenuStats = function(title) { luckyReqFrenSmall.textContent = ' (' + luckyTimeFrenzy + ')'; luckyReqFrenFrag.appendChild(luckyReqFrenSmall); } - stats.appendChild(listing('\"Lucky!\" Cookies Required (Frenzy)', luckyReqFrenFrag)); - stats.appendChild(listing('\"Lucky!\" Reward (MAX)' + (luckySplit ? ' (Golden / Wrath)' : ''), document.createTextNode(Beautify(luckyRewardMax) + (luckySplit ? (' / ' + Beautify(luckyRewardMaxWrath)) : '')))); - stats.appendChild(listing('\"Lucky!\" Reward (MAX) (Frenzy)' + (luckySplit ? ' (Golden / Wrath)' : ''), document.createTextNode(Beautify(luckyRewardFrenzyMax) + (luckySplit ? (' / ' + Beautify(luckyRewardFrenzyMaxWrath)) : '')))); - stats.appendChild(listing('\"Lucky!\" Reward (CUR)' + (luckySplit ? ' (Golden / Wrath)' : ''), document.createTextNode(Beautify(luckyCur) + (luckySplit ? (' / ' + Beautify(luckyCurWrath)) : '')))); + stats.appendChild(listing(goldListing('\"Lucky!\" Cookies Required (Frenzy)'), luckyReqFrenFrag)); + stats.appendChild(listing(goldListing('\"Lucky!\" Reward (MAX)' + (luckySplit ? ' (Golden / Wrath)' : '')), document.createTextNode(Beautify(luckyRewardMax) + (luckySplit ? (' / ' + Beautify(luckyRewardMaxWrath)) : '')))); + stats.appendChild(listing(goldListing('\"Lucky!\" Reward (MAX) (Frenzy)' + (luckySplit ? ' (Golden / Wrath)' : '')), document.createTextNode(Beautify(luckyRewardFrenzyMax) + (luckySplit ? (' / ' + Beautify(luckyRewardFrenzyMaxWrath)) : '')))); + stats.appendChild(listing(goldListing('\"Lucky!\" Reward (CUR)' + (luckySplit ? ' (Golden / Wrath)' : '')), document.createTextNode(Beautify(luckyCur) + (luckySplit ? (' / ' + Beautify(luckyCurWrath)) : '')))); } stats.appendChild(header('Chain Cookies', 'Chain')); @@ -1049,7 +1089,7 @@ CM.Disp.AddMenuStats = function(title) { var chainWrathRewardMax = CM.Cache.ChainWrathReward; var chainFrenzyRewardMax = CM.Cache.ChainFrenzyReward; var chainFrenzyWrathRewardMax = CM.Cache.ChainFrenzyWrathReward; - var chainCurMax = Math.min(Game.cookiesPs * 60 * 60 * 6, Game.cookies * 0.25); + var chainCurMax = Math.min(CM.Cache.NoGoldSwitchCookiesPS * 60 * 60 * 6, Game.cookies * 0.25); var chainCur = CM.Cache.MaxChainMoni(7, chainCurMax); var chainCurWrath = CM.Cache.MaxChainMoni(6, chainCurMax); if (Game.hasAura('Ancestral Metamorphosis')) { @@ -1074,7 +1114,7 @@ CM.Disp.AddMenuStats = function(title) { chainReqSmall.textContent = ' (' + chainTime + ')'; chainReqFrag.appendChild(chainReqSmall); } - stats.appendChild(listing('\"Chain\" Cookies Required', chainReqFrag)); + stats.appendChild(listing(goldListing('\"Chain\" Cookies Required'), chainReqFrag)); var chainWrathReqFrag = document.createDocumentFragment(); var chainWrathReqSpan = document.createElement('span'); chainWrathReqSpan.style.fontWeight = 'bold'; @@ -1086,7 +1126,7 @@ CM.Disp.AddMenuStats = function(title) { chainWrathReqSmall.textContent = ' (' + chainWrathTime + ')'; chainWrathReqFrag.appendChild(chainWrathReqSmall); } - stats.appendChild(listing('\"Chain\" Cookies Required (Wrath)', chainWrathReqFrag)); + stats.appendChild(listing(goldListing('\"Chain\" Cookies Required (Wrath)'), chainWrathReqFrag)); var chainReqFrenFrag = document.createDocumentFragment(); var chainReqFrenSpan = document.createElement('span'); chainReqFrenSpan.style.fontWeight = 'bold'; @@ -1098,7 +1138,7 @@ CM.Disp.AddMenuStats = function(title) { chainReqFrenSmall.textContent = ' (' + chainTimeFrenzy + ')'; chainReqFrenFrag.appendChild(chainReqFrenSmall); } - stats.appendChild(listing('\"Chain\" Cookies Required (Frenzy)', chainReqFrenFrag)); + stats.appendChild(listing(goldListing('\"Chain\" Cookies Required (Frenzy)'), chainReqFrenFrag)); var chainWrathReqFrenFrag = document.createDocumentFragment(); var chainWrathReqFrenFrag = document.createDocumentFragment(); var chainWrathReqFrenSpan = document.createElement('span'); @@ -1111,10 +1151,10 @@ CM.Disp.AddMenuStats = function(title) { chainWrathReqFrenSmall.textContent = ' (' + chainWrathTimeFrenzy + ')'; chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSmall); } - stats.appendChild(listing('\"Chain\" Cookies Required (Frenzy) (Wrath)', chainWrathReqFrenFrag)); - stats.appendChild(listing('\"Chain\" Reward (MAX) (Golden / Wrath)', document.createTextNode(Beautify(chainRewardMax) + ' / ' + Beautify(chainWrathRewardMax)))); - stats.appendChild(listing('\"Chain\" Reward (MAX) (Frenzy) (Golden / Wrath)', document.createTextNode(Beautify(chainFrenzyRewardMax) + ' / ' + Beautify(chainFrenzyWrathRewardMax)))); - stats.appendChild(listing('\"Chain\" Reward (CUR) (Golden / Wrath)', document.createTextNode(Beautify(chainCur) + ' / ' + Beautify(chainCurWrath)))); + stats.appendChild(listing(goldListing('\"Chain\" Cookies Required (Frenzy) (Wrath)'), chainWrathReqFrenFrag)); + stats.appendChild(listing(goldListing('\"Chain\" Reward (MAX) (Golden / Wrath)'), document.createTextNode(Beautify(chainRewardMax) + ' / ' + Beautify(chainWrathRewardMax)))); + stats.appendChild(listing(goldListing('\"Chain\" Reward (MAX) (Frenzy) (Golden / Wrath)'), document.createTextNode(Beautify(chainFrenzyRewardMax) + ' / ' + Beautify(chainFrenzyWrathRewardMax)))); + stats.appendChild(listing(goldListing('\"Chain\" Reward (CUR) (Golden / Wrath)'), document.createTextNode(Beautify(chainCur) + ' / ' + Beautify(chainCurWrath)))); } stats.appendChild(header('Prestige', 'Prestige')); @@ -1130,7 +1170,7 @@ CM.Disp.AddMenuStats = function(title) { cookiesNextFrag.appendChild(cookiesNextSmall); stats.appendChild(listing('Cookies To Next Level', cookiesNextFrag)); var resetTitleFrag = document.createDocumentFragment(); - resetTitleFrag.appendChild(document.createTextNode('Reset Bonus Income ')) + resetTitleFrag.appendChild(document.createTextNode('Reset Bonus Income ')); var resetTitleSpan = document.createElement('span'); resetTitleSpan.onmouseout = function() { Game.tooltip.hide(); }; resetTitleSpan.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp.ResetTooltipPlaceholder.innerHTML));}; @@ -1180,7 +1220,7 @@ CM.Disp.AddMenuStats = function(title) { var popAllA = document.createElement('a'); popAllA.textContent = 'Pop All'; popAllA.className = 'option'; - popAllA.onclick = function() {Game.CollectWrinklers();}; + popAllA.onclick = function() { CM.Disp.CollectWrinklers(); }; popAllFrag.appendChild(popAllA); stats.appendChild(listing('Rewards of Popping', popAllFrag)); } @@ -1224,7 +1264,9 @@ CM.Disp.AddMenuStats = function(title) { } } - if (Game.season == 'christmas' || specDisp || choEgg) { + var centEgg = Game.Has('Century egg'); + + if (Game.season == 'christmas' || specDisp || choEgg || centEgg) { stats.appendChild(header('Season Specials', 'Sea')); if (CM.Config.StatsPref.Sea) { if (specDisp) { @@ -1297,7 +1339,10 @@ CM.Disp.AddMenuStats = function(title) { } choEggTotal *= 0.05; stats.appendChild(listing(choEggTitleFrag, document.createTextNode(Beautify(choEggTotal)))); - } + } + if (centEgg) { + stats.appendChild(listing('Century Egg Multiplier', document.createTextNode(Beautify(CM.Cache.CentEgg, 1) + '%'))); + } } } diff --git a/src/Main.js b/src/Main.js index 9fec7ae..e649b13 100644 --- a/src/Main.js +++ b/src/Main.js @@ -86,8 +86,11 @@ CM.Loop = function() { if (!Game.OnAscend && Game.AscendTimer == 0) { if (CM.Sim.DoSims) { CM.Cache.RemakeIncome(); + + CM.Sim.NoGoldSwitchCookiesPS(); // Needed first CM.Cache.RemakeLucky(); CM.Cache.RemakeChain(); + CM.Cache.RemakeSeaSpec(); CM.Cache.RemakeSellForChoEgg(); @@ -150,6 +153,7 @@ CM.DelayInit = function() { CM.Disp.CreateWhiteScreen(); CM.Disp.CreateFavicon(); CM.Disp.CreateGCTimer(); + CM.Disp.CreateGoldCookTooltip(); CM.Disp.CreateResetTooltip(); CM.Disp.CreateChoEggTooltip(); CM.Disp.CreateTooltipWarnCaut(); diff --git a/src/Sim.js b/src/Sim.js index fb7d962..8fbc0dc 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -222,7 +222,8 @@ CM.Sim.CalculateGains = function() { // The boost increases a little every day, with diminishing returns up to +10% on the 100th day var day = Math.floor((CM.Sim.Date - Game.startDate) / 1000 / 10) * 10 / 60 / 60 / 24; day = Math.min(day,100); - eggMult += (1 - Math.pow(1 - day / 100, 3)) * 10; + CM.Cache.CentEgg = (1 - Math.pow(1 - day / 100, 3)) * 10; + eggMult += CM.Cache.CentEgg; } mult *= (1 + 0.01 * eggMult); @@ -403,6 +404,16 @@ CM.Sim.BuyUpgrades = function() { } } +CM.Sim.NoGoldSwitchCookiesPS = function() { + if (Game.Has('Golden switch [off]')) { + CM.Sim.CopyData(); + CM.Sim.Upgrades['Golden switch [off]'].bought = 0; + CM.Sim.CalculateGains(); + CM.Cache.NoGoldSwitchCookiesPS = CM.Sim.cookiesPs; + } + else CM.Cache.NoGoldSwitchCookiesPS = Game.cookiesPs; +} + CM.Sim.ResetBonus = function() { CM.Sim.CopyData(); @@ -436,6 +447,7 @@ CM.Sim.ResetBonus = function() { if (CM.Sim.Upgrades['Heavenly key'].bought == 0) { CM.Sim.Upgrades['Heavenly key'].bought = 1; CM.Sim.UpgradesOwned++; + CM.Sim.Win('Wholesome'); } CM.Sim.prestige = Math.floor(Game.HowMuchPrestige(Game.cookiesEarned + Game.cookiesReset)); From 2ed563c9957b12a5c6e5b00410b468259bbeff0e Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Thu, 17 Mar 2016 20:14:51 -0400 Subject: [PATCH 8/8] Added Heavenly Chips stats, changed max prestige calcuation to include wrinklers and chocolate egg (Issue #62) --- CookieMonster.js | 229 ++++++++++++++++++----------------------------- src/Disp.js | 216 +++++++++++++++++--------------------------- src/Main.js | 9 +- src/Sim.js | 4 +- 4 files changed, 178 insertions(+), 280 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 2a49412..33be00a 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1158,40 +1158,16 @@ CM.Disp.CollectWrinklers = function() { } } -CM.Disp.CreateGoldCookTooltip = function() { - CM.Disp.GoldCookTooltipPlaceholder = document.createElement('div'); - var goldCookDesc = document.createElement('div'); - goldCookDesc.style.minWidth = '200px'; - goldCookDesc.style.marginBottom = '4px'; +CM.Disp.CreateTooltip = function(placeholder, text, minWidth) { + CM.Disp[placeholder] = document.createElement('div'); + var desc = document.createElement('div'); + desc.style.minWidth = minWidth; + desc.style.marginBottom = '4px'; var div = document.createElement('div'); div.style.textAlign = 'left'; - div.textContent = 'Calculated with Golden Switch off'; - goldCookDesc.appendChild(div); - CM.Disp.GoldCookTooltipPlaceholder.appendChild(goldCookDesc); -} - -CM.Disp.CreateResetTooltip = function() { - CM.Disp.ResetTooltipPlaceholder = document.createElement('div'); - var resetTitleDesc = document.createElement('div'); - resetTitleDesc.style.minWidth = '340px'; - resetTitleDesc.style.marginBottom = '4px'; - var div = document.createElement('div'); - div.style.textAlign = 'left'; - div.textContent = 'The bonus income you would get from new prestige levels at 100% of its potential and from reset achievements if you have the same buildings/upgrades after reset'; - resetTitleDesc.appendChild(div); - CM.Disp.ResetTooltipPlaceholder.appendChild(resetTitleDesc); -} - -CM.Disp.CreateChoEggTooltip = function() { - CM.Disp.ChoEggTooltipPlaceholder = document.createElement('div'); - var choEggTitleDesc = document.createElement('div'); - choEggTitleDesc.style.minWidth = '310px'; - choEggTitleDesc.style.marginBottom = '4px'; - var div = document.createElement('div'); - div.style.textAlign = 'left'; - div.textContent = 'The amount of cookies you would get from selling all buildings with Earth Shatterer aura (if possible), popping all wrinklers, and then buying Chocolate egg'; - choEggTitleDesc.appendChild(div); - CM.Disp.ChoEggTooltipPlaceholder.appendChild(choEggTitleDesc); + div.textContent = text; + desc.appendChild(div); + CM.Disp[placeholder].appendChild(desc); } CM.Disp.AddMenuPref = function(title) { @@ -1383,27 +1359,25 @@ CM.Disp.AddMenuStats = function(title) { return div; } - if (CM.Config.StatsPref.Lucky || CM.Config.StatsPref.Chain) { - var goldListing = function(text) { - var frag = document.createDocumentFragment(); - frag.appendChild(document.createTextNode(text + ' ')); - var span = document.createElement('span'); - span.onmouseout = function() { Game.tooltip.hide(); }; - span.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp.GoldCookTooltipPlaceholder.innerHTML));}; - span.style.cursor = 'default'; - span.style.display = 'inline-block'; - span.style.height = '10px'; - span.style.width = '10px'; - span.style.borderRadius = '5px'; - span.style.textAlign = 'center'; - span.style.backgroundColor = '#C0C0C0'; - span.style.color = 'black'; - span.style.fontSize = '9px'; - span.style.verticalAlign = 'bottom'; - span.textContent = '?'; - frag.appendChild(span); - return frag; - } + var listingQuest = function(text, placeholder) { + var frag = document.createDocumentFragment(); + frag.appendChild(document.createTextNode(text + ' ')); + var span = document.createElement('span'); + span.onmouseout = function() { Game.tooltip.hide(); }; + span.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp[placeholder].innerHTML));}; + span.style.cursor = 'default'; + span.style.display = 'inline-block'; + span.style.height = '10px'; + span.style.width = '10px'; + span.style.borderRadius = '5px'; + span.style.textAlign = 'center'; + span.style.backgroundColor = '#C0C0C0'; + span.style.color = 'black'; + span.style.fontSize = '9px'; + span.style.verticalAlign = 'bottom'; + span.textContent = '?'; + frag.appendChild(span); + return frag; } stats.appendChild(header('Lucky Cookies', 'Lucky')); @@ -1442,7 +1416,7 @@ CM.Disp.AddMenuStats = function(title) { luckyReqSmall.textContent = ' (' + luckyTime + ')'; luckyReqFrag.appendChild(luckyReqSmall); } - stats.appendChild(listing(goldListing('\"Lucky!\" Cookies Required'), luckyReqFrag)); + stats.appendChild(listing(listingQuest('\"Lucky!\" Cookies Required', 'GoldCookTooltipPlaceholder'), luckyReqFrag)); var luckyReqFrenFrag = document.createDocumentFragment(); var luckyReqFrenSpan = document.createElement('span'); luckyReqFrenSpan.style.fontWeight = 'bold'; @@ -1454,10 +1428,10 @@ CM.Disp.AddMenuStats = function(title) { luckyReqFrenSmall.textContent = ' (' + luckyTimeFrenzy + ')'; luckyReqFrenFrag.appendChild(luckyReqFrenSmall); } - stats.appendChild(listing(goldListing('\"Lucky!\" Cookies Required (Frenzy)'), luckyReqFrenFrag)); - stats.appendChild(listing(goldListing('\"Lucky!\" Reward (MAX)' + (luckySplit ? ' (Golden / Wrath)' : '')), document.createTextNode(Beautify(luckyRewardMax) + (luckySplit ? (' / ' + Beautify(luckyRewardMaxWrath)) : '')))); - stats.appendChild(listing(goldListing('\"Lucky!\" Reward (MAX) (Frenzy)' + (luckySplit ? ' (Golden / Wrath)' : '')), document.createTextNode(Beautify(luckyRewardFrenzyMax) + (luckySplit ? (' / ' + Beautify(luckyRewardFrenzyMaxWrath)) : '')))); - stats.appendChild(listing(goldListing('\"Lucky!\" Reward (CUR)' + (luckySplit ? ' (Golden / Wrath)' : '')), document.createTextNode(Beautify(luckyCur) + (luckySplit ? (' / ' + Beautify(luckyCurWrath)) : '')))); + stats.appendChild(listing(listingQuest('\"Lucky!\" Cookies Required (Frenzy)', 'GoldCookTooltipPlaceholder'), luckyReqFrenFrag)); + stats.appendChild(listing(listingQuest('\"Lucky!\" Reward (MAX)' + (luckySplit ? ' (Golden / Wrath)' : ''), 'GoldCookTooltipPlaceholder'), document.createTextNode(Beautify(luckyRewardMax) + (luckySplit ? (' / ' + Beautify(luckyRewardMaxWrath)) : '')))); + stats.appendChild(listing(listingQuest('\"Lucky!\" Reward (MAX) (Frenzy)' + (luckySplit ? ' (Golden / Wrath)' : ''), 'GoldCookTooltipPlaceholder'), document.createTextNode(Beautify(luckyRewardFrenzyMax) + (luckySplit ? (' / ' + Beautify(luckyRewardFrenzyMaxWrath)) : '')))); + stats.appendChild(listing(listingQuest('\"Lucky!\" Reward (CUR)' + (luckySplit ? ' (Golden / Wrath)' : ''), 'GoldCookTooltipPlaceholder'), document.createTextNode(Beautify(luckyCur) + (luckySplit ? (' / ' + Beautify(luckyCurWrath)) : '')))); } stats.appendChild(header('Chain Cookies', 'Chain')); @@ -1500,7 +1474,7 @@ CM.Disp.AddMenuStats = function(title) { chainReqSmall.textContent = ' (' + chainTime + ')'; chainReqFrag.appendChild(chainReqSmall); } - stats.appendChild(listing(goldListing('\"Chain\" Cookies Required'), chainReqFrag)); + stats.appendChild(listing(listingQuest('\"Chain\" Cookies Required', 'GoldCookTooltipPlaceholder'), chainReqFrag)); var chainWrathReqFrag = document.createDocumentFragment(); var chainWrathReqSpan = document.createElement('span'); chainWrathReqSpan.style.fontWeight = 'bold'; @@ -1512,7 +1486,7 @@ CM.Disp.AddMenuStats = function(title) { chainWrathReqSmall.textContent = ' (' + chainWrathTime + ')'; chainWrathReqFrag.appendChild(chainWrathReqSmall); } - stats.appendChild(listing(goldListing('\"Chain\" Cookies Required (Wrath)'), chainWrathReqFrag)); + stats.appendChild(listing(listingQuest('\"Chain\" Cookies Required (Wrath)', 'GoldCookTooltipPlaceholder'), chainWrathReqFrag)); var chainReqFrenFrag = document.createDocumentFragment(); var chainReqFrenSpan = document.createElement('span'); chainReqFrenSpan.style.fontWeight = 'bold'; @@ -1524,7 +1498,7 @@ CM.Disp.AddMenuStats = function(title) { chainReqFrenSmall.textContent = ' (' + chainTimeFrenzy + ')'; chainReqFrenFrag.appendChild(chainReqFrenSmall); } - stats.appendChild(listing(goldListing('\"Chain\" Cookies Required (Frenzy)'), chainReqFrenFrag)); + stats.appendChild(listing(listingQuest('\"Chain\" Cookies Required (Frenzy)', 'GoldCookTooltipPlaceholder'), chainReqFrenFrag)); var chainWrathReqFrenFrag = document.createDocumentFragment(); var chainWrathReqFrenFrag = document.createDocumentFragment(); var chainWrathReqFrenSpan = document.createElement('span'); @@ -1537,42 +1511,51 @@ CM.Disp.AddMenuStats = function(title) { chainWrathReqFrenSmall.textContent = ' (' + chainWrathTimeFrenzy + ')'; chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSmall); } - stats.appendChild(listing(goldListing('\"Chain\" Cookies Required (Frenzy) (Wrath)'), chainWrathReqFrenFrag)); - stats.appendChild(listing(goldListing('\"Chain\" Reward (MAX) (Golden / Wrath)'), document.createTextNode(Beautify(chainRewardMax) + ' / ' + Beautify(chainWrathRewardMax)))); - stats.appendChild(listing(goldListing('\"Chain\" Reward (MAX) (Frenzy) (Golden / Wrath)'), document.createTextNode(Beautify(chainFrenzyRewardMax) + ' / ' + Beautify(chainFrenzyWrathRewardMax)))); - stats.appendChild(listing(goldListing('\"Chain\" Reward (CUR) (Golden / Wrath)'), document.createTextNode(Beautify(chainCur) + ' / ' + Beautify(chainCurWrath)))); + stats.appendChild(listing(listingQuest('\"Chain\" Cookies Required (Frenzy) (Wrath)', 'GoldCookTooltipPlaceholder'), chainWrathReqFrenFrag)); + stats.appendChild(listing(listingQuest('\"Chain\" Reward (MAX) (Golden / Wrath)', 'GoldCookTooltipPlaceholder'), document.createTextNode(Beautify(chainRewardMax) + ' / ' + Beautify(chainWrathRewardMax)))); + stats.appendChild(listing(listingQuest('\"Chain\" Reward (MAX) (Frenzy) (Golden / Wrath)', 'GoldCookTooltipPlaceholder'), document.createTextNode(Beautify(chainFrenzyRewardMax) + ' / ' + Beautify(chainFrenzyWrathRewardMax)))); + stats.appendChild(listing(listingQuest('\"Chain\" Reward (CUR) (Golden / Wrath)', 'GoldCookTooltipPlaceholder'), document.createTextNode(Beautify(chainCur) + ' / ' + Beautify(chainCurWrath)))); } + var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); // Needs to be done for the checking below + + + if (CM.Config.StatsPref.Wrink || (CM.Config.StatsPref.Sea && choEgg) || CM.Config.StatsPref.Prestige) { + var totalSucked = 0; // Used in Prestige and Chocolate Egg calculation below also + for (var i in Game.wrinklers) { + var sucked = Game.wrinklers[i].sucked; + var toSuck = 1.1; + if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05; + if (Game.wrinklers[i].type==1) toSuck *= 3; // Shiny wrinklers + sucked *= toSuck; + if (Game.Has('Wrinklerspawn')) sucked *= 1.05; + totalSucked += sucked; + } + } + + if (choEgg) { + var choEggTotal = Game.cookies + CM.Cache.SellForChoEgg; + if (Game.cpsSucked > 0) { + choEggTotal += totalSucked; + } + choEggTotal *= 0.05; // Used in Prestige calculation below also + } + stats.appendChild(header('Prestige', 'Prestige')); if (CM.Config.StatsPref.Prestige) { + var possiblePresMax = Math.floor(Game.HowMuchPrestige(Game.cookiesEarned + Game.cookiesReset + totalSucked + (choEgg ? choEggTotal : 0))); var possiblePres = Math.floor(Game.HowMuchPrestige(Game.cookiesEarned + Game.cookiesReset)); var neededCook = Game.HowManyCookiesReset(possiblePres + 1) - (Game.cookiesEarned + Game.cookiesReset); - stats.appendChild(listing('Prestige Level (CUR / MAX)', document.createTextNode(Beautify(Game.prestige) + ' / ' + Beautify(possiblePres)))); + stats.appendChild(listing(listingQuest('Prestige Level (CUR / MAX)', 'PrestMaxTooltipPlaceholder'), document.createTextNode(Beautify(Game.prestige) + ' / ' + Beautify(possiblePresMax)))); var cookiesNextFrag = document.createDocumentFragment(); cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook))); var cookiesNextSmall = document.createElement('small'); cookiesNextSmall.textContent = ' (' + (CM.Disp.FormatTime(neededCook / (Game.cookiesPs * (1 - Game.cpsSucked)), 1)) + ')'; cookiesNextFrag.appendChild(cookiesNextSmall); - stats.appendChild(listing('Cookies To Next Level', cookiesNextFrag)); - var resetTitleFrag = document.createDocumentFragment(); - resetTitleFrag.appendChild(document.createTextNode('Reset Bonus Income ')); - var resetTitleSpan = document.createElement('span'); - resetTitleSpan.onmouseout = function() { Game.tooltip.hide(); }; - resetTitleSpan.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp.ResetTooltipPlaceholder.innerHTML));}; - resetTitleSpan.style.cursor = 'default'; - resetTitleSpan.style.display = 'inline-block'; - resetTitleSpan.style.height = '10px'; - resetTitleSpan.style.width = '10px'; - resetTitleSpan.style.borderRadius = '5px'; - resetTitleSpan.style.textAlign = 'center'; - resetTitleSpan.style.backgroundColor = '#C0C0C0'; - resetTitleSpan.style.color = 'black'; - resetTitleSpan.style.fontSize = '9px'; - resetTitleSpan.style.verticalAlign = 'bottom'; - resetTitleSpan.textContent = '?'; - resetTitleFrag.appendChild(resetTitleSpan); - var resetBonus = CM.Sim.ResetBonus(); + stats.appendChild(listing(listingQuest('Cookies To Next Level', 'NextPrestTooltipPlaceholder'), cookiesNextFrag)); + stats.appendChild(listing(listingQuest('Heavenly Chips (CUR / MAX)', 'HeavenChipMaxTooltipPlaceholder'), document.createTextNode(Beautify(Game.heavenlyChips) + ' / ' + Beautify((possiblePresMax - Game.prestige) + Game.heavenlyChips)))); + var resetBonus = CM.Sim.ResetBonus(possiblePresMax); var resetFrag = document.createDocumentFragment(); resetFrag.appendChild(document.createTextNode(Beautify(resetBonus))); var increase = Math.round(resetBonus / Game.cookiesPs * 10000); @@ -1581,35 +1564,20 @@ CM.Disp.AddMenuStats = function(title) { resetSmall.textContent = ' (' + (increase / 100) + '% of income)'; resetFrag.appendChild(resetSmall); } - stats.appendChild(listing(resetTitleFrag, resetFrag)); + stats.appendChild(listing(listingQuest('Reset Bonus Income', 'ResetTooltipPlaceholder'), resetFrag)); } - - var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); // Needs to be done for the checking below - + if (Game.cpsSucked > 0) { - stats.appendChild(header('Wrinklers', 'Wrink')); - if (CM.Config.StatsPref.Wrink || (CM.Config.StatsPref.Sea && choEgg)) { - var totalSucked = 0; // Used in Chocolate Egg calculation below also - for (var i in Game.wrinklers) { - var sucked = Game.wrinklers[i].sucked; - var toSuck = 1.1; - if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05; - if (Game.wrinklers[i].type==1) toSuck *= 3; // Shiny wrinklers - sucked *= toSuck; - if (Game.Has('Wrinklerspawn')) sucked *= 1.05; - totalSucked += sucked; - } - - if (CM.Config.StatsPref.Wrink) { - var popAllFrag = document.createDocumentFragment(); - popAllFrag.appendChild(document.createTextNode(Beautify(totalSucked) + ' ')); - var popAllA = document.createElement('a'); - popAllA.textContent = 'Pop All'; - popAllA.className = 'option'; - popAllA.onclick = function() { CM.Disp.CollectWrinklers(); }; - popAllFrag.appendChild(popAllA); - stats.appendChild(listing('Rewards of Popping', popAllFrag)); - } + stats.appendChild(header('Wrinklers', 'Wrink')); + if (CM.Config.StatsPref.Wrink) { + var popAllFrag = document.createDocumentFragment(); + popAllFrag.appendChild(document.createTextNode(Beautify(totalSucked) + ' ')); + var popAllA = document.createElement('a'); + popAllA.textContent = 'Pop All'; + popAllA.className = 'option'; + popAllA.onclick = function() { CM.Disp.CollectWrinklers(); }; + popAllFrag.appendChild(popAllA); + stats.appendChild(listing('Rewards of Popping', popAllFrag)); } } @@ -1702,29 +1670,7 @@ CM.Disp.AddMenuStats = function(title) { if (Game.season == 'christmas') stats.appendChild(listing('Reindeer Reward', document.createTextNode(Beautify(CM.Cache.SeaSpec)))); if (choEgg) { - var choEggTitleFrag = document.createDocumentFragment(); - choEggTitleFrag.appendChild(document.createTextNode('Chocolate Egg Cookies ')) - var choEggTitleSpan = document.createElement('span'); - choEggTitleSpan.onmouseout = function() { Game.tooltip.hide(); }; - choEggTitleSpan.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp.ChoEggTooltipPlaceholder.innerHTML));}; - choEggTitleSpan.style.cursor = 'default'; - choEggTitleSpan.style.display = 'inline-block'; - choEggTitleSpan.style.height = '10px'; - choEggTitleSpan.style.width = '10px'; - choEggTitleSpan.style.borderRadius = '5px'; - choEggTitleSpan.style.textAlign = 'center'; - choEggTitleSpan.style.backgroundColor = '#C0C0C0'; - choEggTitleSpan.style.color = 'black'; - choEggTitleSpan.style.fontSize = '9px'; - choEggTitleSpan.style.verticalAlign = 'bottom'; - choEggTitleSpan.textContent = '?'; - choEggTitleFrag.appendChild(choEggTitleSpan); - var choEggTotal = Game.cookies + CM.Cache.SellForChoEgg; - if (Game.cpsSucked > 0) { - choEggTotal += totalSucked; - } - choEggTotal *= 0.05; - stats.appendChild(listing(choEggTitleFrag, document.createTextNode(Beautify(choEggTotal)))); + stats.appendChild(listing(listingQuest('Chocolate Egg Cookies', 'ChoEggTooltipPlaceholder'), document.createTextNode(Beautify(choEggTotal)))); } if (centEgg) { stats.appendChild(listing('Century Egg Multiplier', document.createTextNode(Beautify(CM.Cache.CentEgg, 1) + '%'))); @@ -2331,9 +2277,12 @@ CM.DelayInit = function() { CM.Disp.CreateWhiteScreen(); CM.Disp.CreateFavicon(); CM.Disp.CreateGCTimer(); - CM.Disp.CreateGoldCookTooltip(); - CM.Disp.CreateResetTooltip(); - CM.Disp.CreateChoEggTooltip(); + CM.Disp.CreateTooltip('GoldCookTooltipPlaceholder', 'Calculated with Golden Switch off', '200px'); + CM.Disp.CreateTooltip('PrestMaxTooltipPlaceholder', 'The MAX prestige is calculated with the cookies gained from popping all wrinklers, selling all buildings with Earth Shatterer aura, and buying Chocolate egg', '310px'); + CM.Disp.CreateTooltip('NextPrestTooltipPlaceholder', 'Not calculated with cookies gained from wrinklers or Chocolate egg', '200px'); + CM.Disp.CreateTooltip('HeavenChipMaxTooltipPlaceholder', 'The MAX heavenly chips is calculated with the cookies gained from popping all wrinklers, selling all buildings with Earth Shatterer aura, and buying Chocolate egg', '310px'); + CM.Disp.CreateTooltip('ResetTooltipPlaceholder', 'The bonus income you would get from new prestige levels at 100% of its potential and from reset achievements if you have the same buildings/upgrades after reset', '340px'); + CM.Disp.CreateTooltip('ChoEggTooltipPlaceholder', 'The amount of cookies you would get from popping all wrinklers, selling all buildings with Earth Shatterer aura, and then buying Chocolate egg', '290px'); CM.Disp.CreateTooltipWarnCaut(); CM.Disp.AddTooltipBuild(); CM.Disp.AddWrinklerAreaDetect(); @@ -2772,7 +2721,7 @@ CM.Sim.NoGoldSwitchCookiesPS = function() { else CM.Cache.NoGoldSwitchCookiesPS = Game.cookiesPs; } -CM.Sim.ResetBonus = function() { +CM.Sim.ResetBonus = function(possiblePresMax) { CM.Sim.CopyData(); if (Game.cookiesEarned >= 1000000) CM.Sim.Win('Sacrifice'); @@ -2808,7 +2757,7 @@ CM.Sim.ResetBonus = function() { CM.Sim.Win('Wholesome'); } - CM.Sim.prestige = Math.floor(Game.HowMuchPrestige(Game.cookiesEarned + Game.cookiesReset)); + CM.Sim.prestige = possiblePresMax; var lastAchievementsOwned = CM.Sim.AchievementsOwned; diff --git a/src/Disp.js b/src/Disp.js index b7ed21d..ba3d973 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -772,40 +772,16 @@ CM.Disp.CollectWrinklers = function() { } } -CM.Disp.CreateGoldCookTooltip = function() { - CM.Disp.GoldCookTooltipPlaceholder = document.createElement('div'); - var goldCookDesc = document.createElement('div'); - goldCookDesc.style.minWidth = '200px'; - goldCookDesc.style.marginBottom = '4px'; +CM.Disp.CreateTooltip = function(placeholder, text, minWidth) { + CM.Disp[placeholder] = document.createElement('div'); + var desc = document.createElement('div'); + desc.style.minWidth = minWidth; + desc.style.marginBottom = '4px'; var div = document.createElement('div'); div.style.textAlign = 'left'; - div.textContent = 'Calculated with Golden Switch off'; - goldCookDesc.appendChild(div); - CM.Disp.GoldCookTooltipPlaceholder.appendChild(goldCookDesc); -} - -CM.Disp.CreateResetTooltip = function() { - CM.Disp.ResetTooltipPlaceholder = document.createElement('div'); - var resetTitleDesc = document.createElement('div'); - resetTitleDesc.style.minWidth = '340px'; - resetTitleDesc.style.marginBottom = '4px'; - var div = document.createElement('div'); - div.style.textAlign = 'left'; - div.textContent = 'The bonus income you would get from new prestige levels at 100% of its potential and from reset achievements if you have the same buildings/upgrades after reset'; - resetTitleDesc.appendChild(div); - CM.Disp.ResetTooltipPlaceholder.appendChild(resetTitleDesc); -} - -CM.Disp.CreateChoEggTooltip = function() { - CM.Disp.ChoEggTooltipPlaceholder = document.createElement('div'); - var choEggTitleDesc = document.createElement('div'); - choEggTitleDesc.style.minWidth = '310px'; - choEggTitleDesc.style.marginBottom = '4px'; - var div = document.createElement('div'); - div.style.textAlign = 'left'; - div.textContent = 'The amount of cookies you would get from selling all buildings with Earth Shatterer aura (if possible), popping all wrinklers, and then buying Chocolate egg'; - choEggTitleDesc.appendChild(div); - CM.Disp.ChoEggTooltipPlaceholder.appendChild(choEggTitleDesc); + div.textContent = text; + desc.appendChild(div); + CM.Disp[placeholder].appendChild(desc); } CM.Disp.AddMenuPref = function(title) { @@ -997,27 +973,25 @@ CM.Disp.AddMenuStats = function(title) { return div; } - if (CM.Config.StatsPref.Lucky || CM.Config.StatsPref.Chain) { - var goldListing = function(text) { - var frag = document.createDocumentFragment(); - frag.appendChild(document.createTextNode(text + ' ')); - var span = document.createElement('span'); - span.onmouseout = function() { Game.tooltip.hide(); }; - span.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp.GoldCookTooltipPlaceholder.innerHTML));}; - span.style.cursor = 'default'; - span.style.display = 'inline-block'; - span.style.height = '10px'; - span.style.width = '10px'; - span.style.borderRadius = '5px'; - span.style.textAlign = 'center'; - span.style.backgroundColor = '#C0C0C0'; - span.style.color = 'black'; - span.style.fontSize = '9px'; - span.style.verticalAlign = 'bottom'; - span.textContent = '?'; - frag.appendChild(span); - return frag; - } + var listingQuest = function(text, placeholder) { + var frag = document.createDocumentFragment(); + frag.appendChild(document.createTextNode(text + ' ')); + var span = document.createElement('span'); + span.onmouseout = function() { Game.tooltip.hide(); }; + span.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp[placeholder].innerHTML));}; + span.style.cursor = 'default'; + span.style.display = 'inline-block'; + span.style.height = '10px'; + span.style.width = '10px'; + span.style.borderRadius = '5px'; + span.style.textAlign = 'center'; + span.style.backgroundColor = '#C0C0C0'; + span.style.color = 'black'; + span.style.fontSize = '9px'; + span.style.verticalAlign = 'bottom'; + span.textContent = '?'; + frag.appendChild(span); + return frag; } stats.appendChild(header('Lucky Cookies', 'Lucky')); @@ -1056,7 +1030,7 @@ CM.Disp.AddMenuStats = function(title) { luckyReqSmall.textContent = ' (' + luckyTime + ')'; luckyReqFrag.appendChild(luckyReqSmall); } - stats.appendChild(listing(goldListing('\"Lucky!\" Cookies Required'), luckyReqFrag)); + stats.appendChild(listing(listingQuest('\"Lucky!\" Cookies Required', 'GoldCookTooltipPlaceholder'), luckyReqFrag)); var luckyReqFrenFrag = document.createDocumentFragment(); var luckyReqFrenSpan = document.createElement('span'); luckyReqFrenSpan.style.fontWeight = 'bold'; @@ -1068,10 +1042,10 @@ CM.Disp.AddMenuStats = function(title) { luckyReqFrenSmall.textContent = ' (' + luckyTimeFrenzy + ')'; luckyReqFrenFrag.appendChild(luckyReqFrenSmall); } - stats.appendChild(listing(goldListing('\"Lucky!\" Cookies Required (Frenzy)'), luckyReqFrenFrag)); - stats.appendChild(listing(goldListing('\"Lucky!\" Reward (MAX)' + (luckySplit ? ' (Golden / Wrath)' : '')), document.createTextNode(Beautify(luckyRewardMax) + (luckySplit ? (' / ' + Beautify(luckyRewardMaxWrath)) : '')))); - stats.appendChild(listing(goldListing('\"Lucky!\" Reward (MAX) (Frenzy)' + (luckySplit ? ' (Golden / Wrath)' : '')), document.createTextNode(Beautify(luckyRewardFrenzyMax) + (luckySplit ? (' / ' + Beautify(luckyRewardFrenzyMaxWrath)) : '')))); - stats.appendChild(listing(goldListing('\"Lucky!\" Reward (CUR)' + (luckySplit ? ' (Golden / Wrath)' : '')), document.createTextNode(Beautify(luckyCur) + (luckySplit ? (' / ' + Beautify(luckyCurWrath)) : '')))); + stats.appendChild(listing(listingQuest('\"Lucky!\" Cookies Required (Frenzy)', 'GoldCookTooltipPlaceholder'), luckyReqFrenFrag)); + stats.appendChild(listing(listingQuest('\"Lucky!\" Reward (MAX)' + (luckySplit ? ' (Golden / Wrath)' : ''), 'GoldCookTooltipPlaceholder'), document.createTextNode(Beautify(luckyRewardMax) + (luckySplit ? (' / ' + Beautify(luckyRewardMaxWrath)) : '')))); + stats.appendChild(listing(listingQuest('\"Lucky!\" Reward (MAX) (Frenzy)' + (luckySplit ? ' (Golden / Wrath)' : ''), 'GoldCookTooltipPlaceholder'), document.createTextNode(Beautify(luckyRewardFrenzyMax) + (luckySplit ? (' / ' + Beautify(luckyRewardFrenzyMaxWrath)) : '')))); + stats.appendChild(listing(listingQuest('\"Lucky!\" Reward (CUR)' + (luckySplit ? ' (Golden / Wrath)' : ''), 'GoldCookTooltipPlaceholder'), document.createTextNode(Beautify(luckyCur) + (luckySplit ? (' / ' + Beautify(luckyCurWrath)) : '')))); } stats.appendChild(header('Chain Cookies', 'Chain')); @@ -1114,7 +1088,7 @@ CM.Disp.AddMenuStats = function(title) { chainReqSmall.textContent = ' (' + chainTime + ')'; chainReqFrag.appendChild(chainReqSmall); } - stats.appendChild(listing(goldListing('\"Chain\" Cookies Required'), chainReqFrag)); + stats.appendChild(listing(listingQuest('\"Chain\" Cookies Required', 'GoldCookTooltipPlaceholder'), chainReqFrag)); var chainWrathReqFrag = document.createDocumentFragment(); var chainWrathReqSpan = document.createElement('span'); chainWrathReqSpan.style.fontWeight = 'bold'; @@ -1126,7 +1100,7 @@ CM.Disp.AddMenuStats = function(title) { chainWrathReqSmall.textContent = ' (' + chainWrathTime + ')'; chainWrathReqFrag.appendChild(chainWrathReqSmall); } - stats.appendChild(listing(goldListing('\"Chain\" Cookies Required (Wrath)'), chainWrathReqFrag)); + stats.appendChild(listing(listingQuest('\"Chain\" Cookies Required (Wrath)', 'GoldCookTooltipPlaceholder'), chainWrathReqFrag)); var chainReqFrenFrag = document.createDocumentFragment(); var chainReqFrenSpan = document.createElement('span'); chainReqFrenSpan.style.fontWeight = 'bold'; @@ -1138,7 +1112,7 @@ CM.Disp.AddMenuStats = function(title) { chainReqFrenSmall.textContent = ' (' + chainTimeFrenzy + ')'; chainReqFrenFrag.appendChild(chainReqFrenSmall); } - stats.appendChild(listing(goldListing('\"Chain\" Cookies Required (Frenzy)'), chainReqFrenFrag)); + stats.appendChild(listing(listingQuest('\"Chain\" Cookies Required (Frenzy)', 'GoldCookTooltipPlaceholder'), chainReqFrenFrag)); var chainWrathReqFrenFrag = document.createDocumentFragment(); var chainWrathReqFrenFrag = document.createDocumentFragment(); var chainWrathReqFrenSpan = document.createElement('span'); @@ -1151,42 +1125,51 @@ CM.Disp.AddMenuStats = function(title) { chainWrathReqFrenSmall.textContent = ' (' + chainWrathTimeFrenzy + ')'; chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSmall); } - stats.appendChild(listing(goldListing('\"Chain\" Cookies Required (Frenzy) (Wrath)'), chainWrathReqFrenFrag)); - stats.appendChild(listing(goldListing('\"Chain\" Reward (MAX) (Golden / Wrath)'), document.createTextNode(Beautify(chainRewardMax) + ' / ' + Beautify(chainWrathRewardMax)))); - stats.appendChild(listing(goldListing('\"Chain\" Reward (MAX) (Frenzy) (Golden / Wrath)'), document.createTextNode(Beautify(chainFrenzyRewardMax) + ' / ' + Beautify(chainFrenzyWrathRewardMax)))); - stats.appendChild(listing(goldListing('\"Chain\" Reward (CUR) (Golden / Wrath)'), document.createTextNode(Beautify(chainCur) + ' / ' + Beautify(chainCurWrath)))); + stats.appendChild(listing(listingQuest('\"Chain\" Cookies Required (Frenzy) (Wrath)', 'GoldCookTooltipPlaceholder'), chainWrathReqFrenFrag)); + stats.appendChild(listing(listingQuest('\"Chain\" Reward (MAX) (Golden / Wrath)', 'GoldCookTooltipPlaceholder'), document.createTextNode(Beautify(chainRewardMax) + ' / ' + Beautify(chainWrathRewardMax)))); + stats.appendChild(listing(listingQuest('\"Chain\" Reward (MAX) (Frenzy) (Golden / Wrath)', 'GoldCookTooltipPlaceholder'), document.createTextNode(Beautify(chainFrenzyRewardMax) + ' / ' + Beautify(chainFrenzyWrathRewardMax)))); + stats.appendChild(listing(listingQuest('\"Chain\" Reward (CUR) (Golden / Wrath)', 'GoldCookTooltipPlaceholder'), document.createTextNode(Beautify(chainCur) + ' / ' + Beautify(chainCurWrath)))); } + var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); // Needs to be done for the checking below + + + if (CM.Config.StatsPref.Wrink || (CM.Config.StatsPref.Sea && choEgg) || CM.Config.StatsPref.Prestige) { + var totalSucked = 0; // Used in Prestige and Chocolate Egg calculation below also + for (var i in Game.wrinklers) { + var sucked = Game.wrinklers[i].sucked; + var toSuck = 1.1; + if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05; + if (Game.wrinklers[i].type==1) toSuck *= 3; // Shiny wrinklers + sucked *= toSuck; + if (Game.Has('Wrinklerspawn')) sucked *= 1.05; + totalSucked += sucked; + } + } + + if (choEgg) { + var choEggTotal = Game.cookies + CM.Cache.SellForChoEgg; + if (Game.cpsSucked > 0) { + choEggTotal += totalSucked; + } + choEggTotal *= 0.05; // Used in Prestige calculation below also + } + stats.appendChild(header('Prestige', 'Prestige')); if (CM.Config.StatsPref.Prestige) { + var possiblePresMax = Math.floor(Game.HowMuchPrestige(Game.cookiesEarned + Game.cookiesReset + totalSucked + (choEgg ? choEggTotal : 0))); var possiblePres = Math.floor(Game.HowMuchPrestige(Game.cookiesEarned + Game.cookiesReset)); var neededCook = Game.HowManyCookiesReset(possiblePres + 1) - (Game.cookiesEarned + Game.cookiesReset); - stats.appendChild(listing('Prestige Level (CUR / MAX)', document.createTextNode(Beautify(Game.prestige) + ' / ' + Beautify(possiblePres)))); + stats.appendChild(listing(listingQuest('Prestige Level (CUR / MAX)', 'PrestMaxTooltipPlaceholder'), document.createTextNode(Beautify(Game.prestige) + ' / ' + Beautify(possiblePresMax)))); var cookiesNextFrag = document.createDocumentFragment(); cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook))); var cookiesNextSmall = document.createElement('small'); cookiesNextSmall.textContent = ' (' + (CM.Disp.FormatTime(neededCook / (Game.cookiesPs * (1 - Game.cpsSucked)), 1)) + ')'; cookiesNextFrag.appendChild(cookiesNextSmall); - stats.appendChild(listing('Cookies To Next Level', cookiesNextFrag)); - var resetTitleFrag = document.createDocumentFragment(); - resetTitleFrag.appendChild(document.createTextNode('Reset Bonus Income ')); - var resetTitleSpan = document.createElement('span'); - resetTitleSpan.onmouseout = function() { Game.tooltip.hide(); }; - resetTitleSpan.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp.ResetTooltipPlaceholder.innerHTML));}; - resetTitleSpan.style.cursor = 'default'; - resetTitleSpan.style.display = 'inline-block'; - resetTitleSpan.style.height = '10px'; - resetTitleSpan.style.width = '10px'; - resetTitleSpan.style.borderRadius = '5px'; - resetTitleSpan.style.textAlign = 'center'; - resetTitleSpan.style.backgroundColor = '#C0C0C0'; - resetTitleSpan.style.color = 'black'; - resetTitleSpan.style.fontSize = '9px'; - resetTitleSpan.style.verticalAlign = 'bottom'; - resetTitleSpan.textContent = '?'; - resetTitleFrag.appendChild(resetTitleSpan); - var resetBonus = CM.Sim.ResetBonus(); + stats.appendChild(listing(listingQuest('Cookies To Next Level', 'NextPrestTooltipPlaceholder'), cookiesNextFrag)); + stats.appendChild(listing(listingQuest('Heavenly Chips (CUR / MAX)', 'HeavenChipMaxTooltipPlaceholder'), document.createTextNode(Beautify(Game.heavenlyChips) + ' / ' + Beautify((possiblePresMax - Game.prestige) + Game.heavenlyChips)))); + var resetBonus = CM.Sim.ResetBonus(possiblePresMax); var resetFrag = document.createDocumentFragment(); resetFrag.appendChild(document.createTextNode(Beautify(resetBonus))); var increase = Math.round(resetBonus / Game.cookiesPs * 10000); @@ -1195,35 +1178,20 @@ CM.Disp.AddMenuStats = function(title) { resetSmall.textContent = ' (' + (increase / 100) + '% of income)'; resetFrag.appendChild(resetSmall); } - stats.appendChild(listing(resetTitleFrag, resetFrag)); + stats.appendChild(listing(listingQuest('Reset Bonus Income', 'ResetTooltipPlaceholder'), resetFrag)); } - - var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); // Needs to be done for the checking below - + if (Game.cpsSucked > 0) { - stats.appendChild(header('Wrinklers', 'Wrink')); - if (CM.Config.StatsPref.Wrink || (CM.Config.StatsPref.Sea && choEgg)) { - var totalSucked = 0; // Used in Chocolate Egg calculation below also - for (var i in Game.wrinklers) { - var sucked = Game.wrinklers[i].sucked; - var toSuck = 1.1; - if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05; - if (Game.wrinklers[i].type==1) toSuck *= 3; // Shiny wrinklers - sucked *= toSuck; - if (Game.Has('Wrinklerspawn')) sucked *= 1.05; - totalSucked += sucked; - } - - if (CM.Config.StatsPref.Wrink) { - var popAllFrag = document.createDocumentFragment(); - popAllFrag.appendChild(document.createTextNode(Beautify(totalSucked) + ' ')); - var popAllA = document.createElement('a'); - popAllA.textContent = 'Pop All'; - popAllA.className = 'option'; - popAllA.onclick = function() { CM.Disp.CollectWrinklers(); }; - popAllFrag.appendChild(popAllA); - stats.appendChild(listing('Rewards of Popping', popAllFrag)); - } + stats.appendChild(header('Wrinklers', 'Wrink')); + if (CM.Config.StatsPref.Wrink) { + var popAllFrag = document.createDocumentFragment(); + popAllFrag.appendChild(document.createTextNode(Beautify(totalSucked) + ' ')); + var popAllA = document.createElement('a'); + popAllA.textContent = 'Pop All'; + popAllA.className = 'option'; + popAllA.onclick = function() { CM.Disp.CollectWrinklers(); }; + popAllFrag.appendChild(popAllA); + stats.appendChild(listing('Rewards of Popping', popAllFrag)); } } @@ -1316,29 +1284,7 @@ CM.Disp.AddMenuStats = function(title) { if (Game.season == 'christmas') stats.appendChild(listing('Reindeer Reward', document.createTextNode(Beautify(CM.Cache.SeaSpec)))); if (choEgg) { - var choEggTitleFrag = document.createDocumentFragment(); - choEggTitleFrag.appendChild(document.createTextNode('Chocolate Egg Cookies ')) - var choEggTitleSpan = document.createElement('span'); - choEggTitleSpan.onmouseout = function() { Game.tooltip.hide(); }; - choEggTitleSpan.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp.ChoEggTooltipPlaceholder.innerHTML));}; - choEggTitleSpan.style.cursor = 'default'; - choEggTitleSpan.style.display = 'inline-block'; - choEggTitleSpan.style.height = '10px'; - choEggTitleSpan.style.width = '10px'; - choEggTitleSpan.style.borderRadius = '5px'; - choEggTitleSpan.style.textAlign = 'center'; - choEggTitleSpan.style.backgroundColor = '#C0C0C0'; - choEggTitleSpan.style.color = 'black'; - choEggTitleSpan.style.fontSize = '9px'; - choEggTitleSpan.style.verticalAlign = 'bottom'; - choEggTitleSpan.textContent = '?'; - choEggTitleFrag.appendChild(choEggTitleSpan); - var choEggTotal = Game.cookies + CM.Cache.SellForChoEgg; - if (Game.cpsSucked > 0) { - choEggTotal += totalSucked; - } - choEggTotal *= 0.05; - stats.appendChild(listing(choEggTitleFrag, document.createTextNode(Beautify(choEggTotal)))); + stats.appendChild(listing(listingQuest('Chocolate Egg Cookies', 'ChoEggTooltipPlaceholder'), document.createTextNode(Beautify(choEggTotal)))); } if (centEgg) { stats.appendChild(listing('Century Egg Multiplier', document.createTextNode(Beautify(CM.Cache.CentEgg, 1) + '%'))); diff --git a/src/Main.js b/src/Main.js index e649b13..5c82e01 100644 --- a/src/Main.js +++ b/src/Main.js @@ -153,9 +153,12 @@ CM.DelayInit = function() { CM.Disp.CreateWhiteScreen(); CM.Disp.CreateFavicon(); CM.Disp.CreateGCTimer(); - CM.Disp.CreateGoldCookTooltip(); - CM.Disp.CreateResetTooltip(); - CM.Disp.CreateChoEggTooltip(); + CM.Disp.CreateTooltip('GoldCookTooltipPlaceholder', 'Calculated with Golden Switch off', '200px'); + CM.Disp.CreateTooltip('PrestMaxTooltipPlaceholder', 'The MAX prestige is calculated with the cookies gained from popping all wrinklers, selling all buildings with Earth Shatterer aura, and buying Chocolate egg', '310px'); + CM.Disp.CreateTooltip('NextPrestTooltipPlaceholder', 'Not calculated with cookies gained from wrinklers or Chocolate egg', '200px'); + CM.Disp.CreateTooltip('HeavenChipMaxTooltipPlaceholder', 'The MAX heavenly chips is calculated with the cookies gained from popping all wrinklers, selling all buildings with Earth Shatterer aura, and buying Chocolate egg', '310px'); + CM.Disp.CreateTooltip('ResetTooltipPlaceholder', 'The bonus income you would get from new prestige levels at 100% of its potential and from reset achievements if you have the same buildings/upgrades after reset', '340px'); + CM.Disp.CreateTooltip('ChoEggTooltipPlaceholder', 'The amount of cookies you would get from popping all wrinklers, selling all buildings with Earth Shatterer aura, and then buying Chocolate egg', '290px'); CM.Disp.CreateTooltipWarnCaut(); CM.Disp.AddTooltipBuild(); CM.Disp.AddWrinklerAreaDetect(); diff --git a/src/Sim.js b/src/Sim.js index 8fbc0dc..c2952ee 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -414,7 +414,7 @@ CM.Sim.NoGoldSwitchCookiesPS = function() { else CM.Cache.NoGoldSwitchCookiesPS = Game.cookiesPs; } -CM.Sim.ResetBonus = function() { +CM.Sim.ResetBonus = function(possiblePresMax) { CM.Sim.CopyData(); if (Game.cookiesEarned >= 1000000) CM.Sim.Win('Sacrifice'); @@ -450,7 +450,7 @@ CM.Sim.ResetBonus = function() { CM.Sim.Win('Wholesome'); } - CM.Sim.prestige = Math.floor(Game.HowMuchPrestige(Game.cookiesEarned + Game.cookiesReset)); + CM.Sim.prestige = possiblePresMax; var lastAchievementsOwned = CM.Sim.AchievementsOwned;