diff --git a/CookieMonster.js b/CookieMonster.js index fc68285a..1e05231d 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -540,6 +540,7 @@ CM.ConfigData.Colors = { }, func: function() {CM.Disp.UpdateColors();} }; +CM.ConfigData.UpgradeBarFixedPos = {label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Position ON'], desc: 'Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling', toggle: true, func: function() {CM.Disp.ToggleUpgradeBarFixedPos();}}; CM.ConfigData.CalcWrink = {label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON'], desc: 'Calculate times and average Cookies Per Second with Wrinklers', toggle: true}; CM.ConfigData.CPSMode = {label: ['Current Cookies Per Second', 'Average Cookies Per Second'], desc: 'Calculate times using current Cookies Per Second or average Cookies Per Second', toggle: false}; CM.ConfigData.AvgCPSHist = {label: ['Average CPS for past 10s', 'Average CPS for past 15s', 'Average CPS for past 30s', 'Average CPS for past 1m', 'Average CPS for past 5m', 'Average CPS for past 10m', 'Average CPS for past 15m', 'Average CPS for past 30m'], desc: 'How much time average Cookies Per Second should consider', toggle: false}; @@ -582,13 +583,15 @@ CM.ConfigData.ToolWarnCaut = {label: ['Tooltip Warning/Caution OFF', 'Tooltip Wa CM.ConfigData.ToolWarnCautPos = {label: ['Tooltip Warning/Caution Position (Left)', 'Tooltip Warning/Caution Position (Bottom)'], desc: 'Placement of the warning/caution boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnCautPos();}}; CM.ConfigData.TooltipGrim = {label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true}; CM.ConfigData.ToolWrink = {label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true}; +CM.ConfigData.TooltipLump = {label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true}; CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true}; CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 5 seconds', toggle: false}; CM.ConfigData.TimeFormat = {label: ['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'], desc: 'Change the time format', toggle: false}; CM.ConfigData.SayTime = {label: ['Format Time OFF', 'Format Time ON'], desc: 'Change how time is displayed in statistics', toggle: true, func: function() {CM.Disp.ToggleSayTime();}}; CM.ConfigData.GrimoireBar = {label: ['Grimoire Magic Meter Timer OFF', 'Grimoire Magic Meter Timer ON'], desc: 'A timer on how long before the Grimoire magic meter is full', toggle: true}; CM.ConfigData.Scale = {label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}}; - +CM.ConfigData.SortBuildings = {label: ['Sort Buildings: Default', 'Sort Buildings: PP'], desc: 'Sort the display of buildings in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateBuildings();}}; +CM.ConfigData.SortUpgrades = {label: ['Sort Upgrades: Default', 'Sort Upgrades: PP'], desc: 'Sort the display of upgrades in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateUpgrades();}}; /******** * Data * ********/ @@ -611,6 +614,7 @@ CM.Data.Fortunes = [ 'Fortune #015', 'Fortune #016', 'Fortune #017', + 'Fortune #018', 'Fortune #100', 'Fortune #101', 'Fortune #102', @@ -619,7 +623,7 @@ CM.Data.Fortunes = [ ]; CM.Data.HalloCookies = ['Skull cookies', 'Ghost cookies', 'Bat cookies', 'Slime cookies', 'Pumpkin cookies', 'Eyeball cookies', 'Spider cookies']; CM.Data.ChristCookies = ['Christmas tree biscuits', 'Snowflake biscuits', 'Snowman biscuits', 'Holly biscuits', 'Candy cane biscuits', 'Bell biscuits', 'Present biscuits']; -CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits']; +CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits', 'Prism heart biscuits']; /******** * Disp * @@ -711,6 +715,46 @@ CM.Disp.GetTimeColor = function(price, bank, cps, time) { return {text: text, color: color}; } +/** + * This function returns Name and Color as object for sugar lump type that is given as input param. + * @param type Sugar Lump Type. + * @returns {{text: string, color: string}} + * @constructor + */ +CM.Disp.GetLumpColor = function(type) { + var name = ""; + var color = ""; + + switch (type) { + case 0: + name = "Normal"; + color = CM.Disp.colorGray; + break; + case 1: + name = "Bifurcated"; + color = CM.Disp.colorGreen; + break; + case 2: + name = "Golden"; + color = CM.Disp.colorYellow; + break; + case 3: + name = "Meaty"; + color = CM.Disp.colorOrange; + break; + case 4: + name = "Caramelized"; + color = CM.Disp.colorPurple; + break; + default: + name = "Unknown Sugar Lump"; + color = CM.Disp.colorRed; + break; + } + + return {text: name, color: color}; +}; + CM.Disp.Beautify = function(num, frac) { if (CM.Config.Scale != 0 && isFinite(num)) { var answer = ''; @@ -829,6 +873,14 @@ CM.Disp.CreateCssArea = function() { CM.Disp.Css.type = 'text/css'; document.head.appendChild(CM.Disp.Css); + + // given the architecture of your code, you probably want these lines somewhere else, + // but I stuck them here for convenience + l("products").style.display = "grid"; + l("storeBulk").style.gridRow = "1/1"; + + l("upgrades").style.display = "flex"; + l("upgrades").style["flex-wrap"] = "wrap"; } CM.Disp.CreateBotBar = function() { @@ -1216,6 +1268,24 @@ CM.Disp.UpdateBuildings = function() { l('productPrice' + Game.Objects[i].id).style.color = ''; } } + + // Build array of pointers, sort by pp, use array index (+2) as the grid row number + // (grid rows are 1-based indexing, and row 1 is the bulk buy/sell options) + var arr = Object.keys(CM.Cache.Objects).map(k => + { + var o = CM.Cache.Objects[k]; + o.name = k; + o.id = Game.Objects[k].id; + return o; + }); + + if (CM.Config.SortBuildings) + arr.sort((a, b) => a.pp - b.pp); + else + arr.sort((a, b) => a.id - b.id); + + for (var x = 0; x < arr.length; x++) + Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2); } CM.Disp.CreateUpgradeBar = function() { @@ -1226,6 +1296,7 @@ CM.Disp.CreateUpgradeBar = function() { CM.Disp.UpgradeBar.style.textAlign = 'center'; CM.Disp.UpgradeBar.style.fontWeight = 'bold'; CM.Disp.UpgradeBar.style.display = 'none'; + CM.Disp.UpgradeBar.style.zIndex = '21'; CM.Disp.UpgradeBar.onmouseout = function() { Game.tooltip.hide(); }; var placeholder = document.createElement('div'); @@ -1342,6 +1413,25 @@ CM.Disp.UpdateUpgrades = function() { l('CMUpgradeBarPurple').textContent = purple; l('CMUpgradeBarGray').textContent = gray; } + + // Build array of pointers, sort by pp, set flex positions + var arr = []; + for (var x = 0; x < Game.UpgradesInStore.length; x++){ + var o = {}; + o.name = Game.UpgradesInStore[x].name; + o.price = Game.UpgradesInStore[x].basePrice; + o.pp = CM.Cache.Upgrades[o.name].pp; + arr.push(o); + } + + if (CM.Config.SortUpgrades) + arr.sort((a, b) => a.pp - b.pp); + else + arr.sort((a, b) => a.price - b.price); + + for (var x = 0; x < Game.UpgradesInStore.length; x++){ + l("upgrade" + x).style.order = arr.findIndex(e => e.name === Game.UpgradesInStore[x].name) + 1 + } } CM.Disp.UpdateColors = function() { @@ -1359,6 +1449,16 @@ CM.Disp.UpdateColors = function() { CM.Disp.UpdateBuildings(); // Class has been already set } +CM.Disp.ToggleUpgradeBarFixedPos = function() { + if (CM.Config.UpgradeBarFixedPos == 1) { + CM.Disp.UpgradeBar.style.position = 'sticky'; + CM.Disp.UpgradeBar.style.top = '0px'; + } + else { + CM.Disp.UpgradeBar.style.position = ''; + } +} + CM.Disp.CreateWhiteScreen = function() { CM.Disp.WhiteScreen = document.createElement('div'); CM.Disp.WhiteScreen.id = 'CMWhiteScreen'; @@ -1720,6 +1820,8 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(listing('BotBar')); frag.appendChild(listing('TimerBar')); frag.appendChild(listing('TimerBarPos')); + frag.appendChild(listing('SortBuildings')); + frag.appendChild(listing('SortUpgrades')); frag.appendChild(listing('BuildColor')); frag.appendChild(listing('BulkBuildColor')); frag.appendChild(listing('UpBarColor')); @@ -1739,6 +1841,7 @@ CM.Disp.AddMenuPref = function(title) { div.appendChild(label); frag.appendChild(div); } + frag.appendChild(listing('UpgradeBarFixedPos')); frag.appendChild(header('Calculation')); frag.appendChild(listing('CalcWrink')); @@ -1775,6 +1878,7 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(listing('ToolWarnCautPos')); frag.appendChild(listing('TooltipGrim')); frag.appendChild(listing('ToolWrink')); + frag.appendChild(listing('TooltipLump')); frag.appendChild(header('Statistics')); frag.appendChild(listing('Stats')); @@ -2052,8 +2156,8 @@ CM.Disp.AddMenuStats = function(title) { if (CM.Config.StatsPref.Prestige) { var possiblePresMax = Math.floor(Game.HowMuchPrestige(CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinkGodBank + (choEgg ? CM.Cache.lastChoEgg : 0))); var neededCook = Game.HowManyCookiesReset(possiblePresMax + 1) - (CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinkGodBank + (choEgg ? CM.Cache.lastChoEgg : 0)); - 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'); @@ -2061,6 +2165,7 @@ CM.Disp.AddMenuStats = function(title) { cookiesNextFrag.appendChild(cookiesNextSmall); 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))); @@ -2071,6 +2176,57 @@ CM.Disp.AddMenuStats = function(title) { resetFrag.appendChild(resetSmall); } stats.appendChild(listing(listingQuest('Reset Bonus Income', 'ResetTooltipPlaceholder'), resetFrag)); + + var currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset)); + var willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)); + var willGet = willHave - currentPrestige; + var addCommas = (n) => + { + var s1 = n.toString(); + var s2 = ''; + for (var i in s1) + { + if ((s1.length - i) % 3 == 0 && i > 0) + s2 += ','; + + s2 += s1[i]; + } + + return s2; + }; + + if (!Game.Has('Lucky digit')) + { + var delta7 = 7 - (willHave % 10); + if (delta7 < 0) delta7 += 10; + var next7Reset = willGet + delta7; + var next7Total = willHave + delta7; + var frag7 = document.createDocumentFragment(); + frag7.appendChild(document.createTextNode(addCommas(next7Total) + " / " + addCommas(next7Reset) + " (+" + delta7 + ")")); + stats.appendChild(listing('Next "Lucky Digit" (total / reset)', frag7)); + } + + if (!Game.Has('Lucky number')) + { + var delta777 = 777 - (willHave % 1000); + if (delta777 < 0) delta777 += 1000; + var next777Reset = willGet + delta777; + var next777Total = willHave + delta777; + var frag777 = document.createDocumentFragment(); + frag777.appendChild(document.createTextNode(addCommas(next777Total) + " / " + addCommas(next777Reset) + " (+" + delta777 + ")")); + stats.appendChild(listing('Next "Lucky Number" (total / reset)', frag777)); + } + + if (!Game.Has('Lucky payout')) + { + var delta777777 = 777777 - (willHave % 1000000); + if (delta777777 < 0) delta777777 += 1000000; + var next777777Reset = willGet + delta777777; + var next777777Total = willHave + delta777777; + var frag777777 = document.createDocumentFragment(); + frag777777.appendChild(document.createTextNode(addCommas(next777777Total) + " / " + addCommas(next777777Reset) + " (+" + delta777777 + ")")); + stats.appendChild(listing('Next "Lucky Payout" (total / reset)', frag777777)); + } } if (Game.cpsSucked > 0) { @@ -2320,6 +2476,17 @@ CM.Disp.AddTooltipGrimoire = function() { } } +/** + * This function improves Sugar Lump tooltip by adding extra infromation. + * @constructor + */ +CM.Disp.AddTooltipLump = function() { + if (Game.canLumps()) { + CM.Disp.TooltipLumpBack = l('lumps').onmouseover; + eval('l(\'lumps\').onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'s\', \'Lump\');}, \'this\'); Game.tooltip.wobble();}'); + } +}; + CM.Disp.Tooltip = function(type, name) { if (type == 'b') { l('tooltip').innerHTML = Game.Objects[name].tooltip(); @@ -2360,6 +2527,10 @@ CM.Disp.Tooltip = function(type, name) { if (!Game.UpgradesInStore[name]) return ''; l('tooltip').innerHTML = Game.crateTooltip(Game.UpgradesInStore[name], 'store'); } + else if (type === 's') { + // Sugar Lump + l('tooltip').innerHTML = Game.lumpTooltip(); + } else { // Grimoire l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); } @@ -2509,6 +2680,40 @@ CM.Disp.UpdateTooltip = function() { CM.Disp.TooltipWarnCaut.style.display = 'none'; } } + else if (CM.Disp.tooltipType === 's') { + // Adding information about Sugar Lumps. + + CM.Disp.TooltipWarnCaut.style.display = 'none'; + l('CMDispTooltipWarn').style.display = 'none'; + l('CMDispTooltipCaut').style.display = 'none'; + + if (CM.Config.TooltipLump === 1) { + l('CMTooltipArea').innerHTML = ''; + + l('tooltip').firstChild.style.paddingBottom = '4px'; + var lumpTooltip = document.createElement('div'); + lumpTooltip.style.border = '1px solid'; + lumpTooltip.style.padding = '4px'; + lumpTooltip.style.margin = '0px -4px'; + lumpTooltip.id = 'CMTooltipBorder'; + lumpTooltip.className = CM.Disp.colorTextPre + CM.Disp.colorGray; + + var lumpHeader = document.createElement('div'); + lumpHeader.style.fontWeight = 'bold'; + lumpHeader.className = CM.Disp.colorTextPre + CM.Disp.colorBlue; + lumpHeader.textContent = 'Current Sugar Lump'; + + lumpTooltip.appendChild(lumpHeader); + var lumpType = document.createElement('div'); + lumpType.id = 'CMTooltipTime'; + lumpTooltip.appendChild(lumpType); + var lumpColor = CM.Disp.GetLumpColor(Game.lumpCurrentType); + lumpType.textContent = lumpColor.text; + lumpType.className = CM.Disp.colorTextPre + lumpColor.color; + + l('CMTooltipArea').appendChild(lumpTooltip); + } + } else { // Grimoire CM.Disp.TooltipWarnCaut.style.display = 'none'; l('CMDispTooltipWarn').style.display = 'none'; @@ -2951,6 +3156,7 @@ CM.DelayInit = function() { CM.Disp.CreateTooltipWarnCaut(); CM.Disp.AddTooltipBuild(); CM.Disp.AddTooltipGrimoire(); + CM.Disp.AddTooltipLump(); CM.Disp.AddWrinklerAreaDetect(); CM.Cache.InitCookiesDiff(); CM.ReplaceNative(); @@ -2977,6 +3183,7 @@ CM.ConfigDefault = { BuildColor: 1, BulkBuildColor: 0, UpBarColor: 1, + UpgradeBarFixedPos: 1, CalcWrink: 0, CPSMode: 1, AvgCPSHist: 3, @@ -3007,6 +3214,7 @@ CM.ConfigDefault = { ToolWarnCautPos: 1, TooltipGrim:1, ToolWrink: 1, + TooltipLump: 1, Stats: 1, UpStats: 1, TimeFormat: 0, @@ -3014,12 +3222,14 @@ CM.ConfigDefault = { GrimoireBar: 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'} + Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'}, + SortBuildings: 0, + SortUpgrades: 0 }; CM.ConfigPrefix = 'CMConfig'; -CM.VersionMajor = '2.021'; -CM.VersionMinor = '2'; +CM.VersionMajor = '2.031'; +CM.VersionMinor = '1'; /******* * Sim * @@ -3088,8 +3298,9 @@ CM.Sim.BuildingSell = function(build, basePrice, start, free, amount, emuAura) { } CM.Sim.Has = function(what) { - if (Game.ascensionMode == 1 && Game.Upgrades[what].pool == 'prestige') return 0; - return (CM.Sim.Upgrades[what] ? CM.Sim.Upgrades[what].bought : 0); + var it = CM.Sim.Upgrades[what]; + if (Game.ascensionMode == 1 && (it.pool == 'prestige' || it.tier == 'fortune')) return 0; + return (it ? it.bought : 0); } @@ -3243,6 +3454,8 @@ CM.Sim.CalculateGains = function() { if (CM.Sim.Has('Fortune #100')) mult *= 1.01; if (CM.Sim.Has('Fortune #101')) mult *= 1.07; + if (CM.Sim.Has('Dragon scale')) mult *= 1.03; + var buildMult = 1; if (Game.hasGod) { var godLvl = Game.hasGod('asceticism'); @@ -3273,16 +3486,8 @@ CM.Sim.CalculateGains = function() { if (CM.Sim.Has('Santa\'s legacy')) mult *= 1 + (Game.santaLevel + 1) * 0.03; - for (var i in CM.Sim.Objects) { - var me = CM.Sim.Objects[i]; - var storedCps = (typeof(me.cps) == 'function' ? me.cps(me) : me.cps); - if (Game.ascensionMode != 1) storedCps *= (1 + me.level * 0.01) * buildMult; - CM.Sim.cookiesPs += me.amount * storedCps; - } - - if (CM.Sim.Has('"egg"')) CM.Sim.cookiesPs += 9; // "egg" - - var milkMult=1; + var milkProgress = CM.Sim.AchievementsOwned / 25; + var milkMult = 1; if (CM.Sim.Has('Santa\'s milk and cookies')) milkMult *= 1.05; //if (CM.Sim.hasAura('Breath of Milk')) milkMult *= 1.05; milkMult *= 1 + CM.Sim.auraMult('Breath of Milk') * 0.05; @@ -3297,21 +3502,31 @@ CM.Sim.CalculateGains = function() { var catMult = 1; - if (CM.Sim.Has('Kitten helpers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.1 * milkMult); - if (CM.Sim.Has('Kitten workers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.125 * milkMult); - if (CM.Sim.Has('Kitten engineers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.15 * milkMult); - if (CM.Sim.Has('Kitten overseers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.175 * milkMult); - if (CM.Sim.Has('Kitten managers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten accountants')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten specialists')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten experts')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten consultants')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten assistants to the regional manager')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.175 * milkMult); - if (CM.Sim.Has('Kitten marketeers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.15 * milkMult); - if (CM.Sim.Has('Kitten analysts')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.125 * milkMult); - if (CM.Sim.Has('Kitten executives')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.115 * milkMult); - if (CM.Sim.Has('Kitten angels')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.1 * milkMult); - if (CM.Sim.Has('Fortune #103')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.05 * milkMult); + if (CM.Sim.Has('Kitten helpers')) catMult *= (1 + milkProgress * 0.1 * milkMult); + if (CM.Sim.Has('Kitten workers')) catMult *= (1 + milkProgress * 0.125 * milkMult); + if (CM.Sim.Has('Kitten engineers')) catMult *= (1 + milkProgress * 0.15 * milkMult); + if (CM.Sim.Has('Kitten overseers')) catMult *= (1 + milkProgress * 0.175 * milkMult); + if (CM.Sim.Has('Kitten managers')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten accountants')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten specialists')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten experts')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten consultants')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten assistants to the regional manager')) catMult *= (1 + milkProgress * 0.175 * milkMult); + if (CM.Sim.Has('Kitten marketeers')) catMult *= (1 + milkProgress * 0.15 * milkMult); + if (CM.Sim.Has('Kitten analysts')) catMult *= (1 + milkProgress * 0.125 * milkMult); + if (CM.Sim.Has('Kitten executives')) catMult *= (1 + milkProgress * 0.115 * milkMult); + if (CM.Sim.Has('Kitten angels')) catMult *= (1 + milkProgress * 0.1 * milkMult); + if (CM.Sim.Has('Fortune #103')) catMult *= (1 + milkProgress * 0.05 * milkMult); + + for (var i in CM.Sim.Objects) { + var me = CM.Sim.Objects[i]; + var storedCps = (typeof(me.cps) == 'function' ? me.cps(me) : me.cps); + if (Game.ascensionMode != 1) storedCps *= (1 + me.level * 0.01) * buildMult; + if (me.name == "Grandma" && CM.Sim.Has('Milkhelp® lactose intolerance relief tablets')) storedCps *= 1 + 0.05 * milkProgress * milkMult; + CM.Sim.cookiesPs += me.amount * storedCps; + } + + if (CM.Sim.Has('"egg"')) CM.Sim.cookiesPs += 9;//"egg" mult *= catMult; @@ -3360,7 +3575,7 @@ CM.Sim.CalculateGains = function() { mult *= CM.Sim.getCPSBuffMult(); // Pointless? - name = Game.bakeryName.toLowerCase(); + var name = Game.bakeryName.toLowerCase(); if (name == 'orteil') mult *= 0.99; else if (name == 'ortiel') mult *= 0.98; //or so help me @@ -3425,19 +3640,25 @@ CM.Sim.CheckOtherAchiev = function() { if (minAmount >= 400) CM.Sim.Win('Quadricentennial'); if (minAmount >= 450) CM.Sim.Win('Quadricentennial and a half'); if (minAmount >= 500) CM.Sim.Win('Quincentennial'); + if (minAmount >= 550) CM.Sim.Win('Quincentennial and a half'); + if (minAmount >= 600) CM.Sim.Win('Sexcentennial'); if (buildingsOwned >= 100) CM.Sim.Win('Builder'); if (buildingsOwned >= 500) CM.Sim.Win('Architect'); if (buildingsOwned >= 1000) CM.Sim.Win('Engineer'); if (buildingsOwned >= 2000) CM.Sim.Win('Lord of Constructs'); + if (buildingsOwned >= 4000) CM.Sim.Win('Grand design'); + if (buildingsOwned >= 8000) CM.Sim.Win('Ecumenopolis'); if (CM.Sim.UpgradesOwned >= 20) CM.Sim.Win('Enhancer'); if (CM.Sim.UpgradesOwned >= 50) CM.Sim.Win('Augmenter'); if (CM.Sim.UpgradesOwned >= 100) CM.Sim.Win('Upgrader'); if (CM.Sim.UpgradesOwned >= 200) CM.Sim.Win('Lord of Progress'); + if (CM.Sim.UpgradesOwned >= 300) CM.Sim.Win('The full picture'); + if (CM.Sim.UpgradesOwned >= 400) CM.Sim.Win('When there\'s nothing left to add'); - if (buildingsOwned >= 3000 && CM.Sim.UpgradesOwned >= 300) CM.Sim.Win('Polymath'); - if (buildingsOwned >= 4000 && CM.Sim.UpgradesOwned >= 400) CM.Sim.Win('Renaissance baker'); + if (buildingsOwned >= 4000 && CM.Sim.UpgradesOwned >= 300) CM.Sim.Win('Polymath'); + if (buildingsOwned >= 8000 && CM.Sim.UpgradesOwned >= 400) CM.Sim.Win('Renaissance baker'); if (CM.Sim.Objects['Cursor'].amount + CM.Sim.Objects['Grandma'].amount >= 777) CM.Sim.Win('The elder scrolls'); @@ -3480,6 +3701,8 @@ CM.Sim.BuyBuildings = function(amount, target) { if (me.amount >= 400) CM.Sim.Win('Dr. T'); if (me.amount >= 500) CM.Sim.Win('Thumbs, phalanges, metacarpals'); if (me.amount >= 600) CM.Sim.Win('With her finger and her thumb'); + if (me.amount >= 700) CM.Sim.Win('Gotta hand it to you'); + if (me.amount >= 800) CM.Sim.Win('The devil\'s workshop'); } else { for (var j in Game.Objects[me.name].tieredAchievs) { @@ -3523,7 +3746,7 @@ CM.Sim.BuyUpgrades = function() { else if (i == 'Elder Covenant') { CM.Sim.Win('Elder calm') } - else if (i == 'Eternal heart biscuits') { + else if (i == 'Prism heart biscuits') { CM.Sim.Win('Lovely cookies'); } else if (i == 'Heavenly key') { diff --git a/src/Config.js b/src/Config.js index 1598ebf8..79d8613c 100644 --- a/src/Config.js +++ b/src/Config.js @@ -134,6 +134,7 @@ CM.ConfigData.Colors = { }, func: function() {CM.Disp.UpdateColors();} }; +CM.ConfigData.UpgradeBarFixedPos = {label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Position ON'], desc: 'Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling', toggle: true, func: function() {CM.Disp.ToggleUpgradeBarFixedPos();}}; CM.ConfigData.CalcWrink = {label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON'], desc: 'Calculate times and average Cookies Per Second with Wrinklers', toggle: true}; CM.ConfigData.CPSMode = {label: ['Current Cookies Per Second', 'Average Cookies Per Second'], desc: 'Calculate times using current Cookies Per Second or average Cookies Per Second', toggle: false}; CM.ConfigData.AvgCPSHist = {label: ['Average CPS for past 10s', 'Average CPS for past 15s', 'Average CPS for past 30s', 'Average CPS for past 1m', 'Average CPS for past 5m', 'Average CPS for past 10m', 'Average CPS for past 15m', 'Average CPS for past 30m'], desc: 'How much time average Cookies Per Second should consider', toggle: false}; @@ -176,10 +177,12 @@ CM.ConfigData.ToolWarnCaut = {label: ['Tooltip Warning/Caution OFF', 'Tooltip Wa CM.ConfigData.ToolWarnCautPos = {label: ['Tooltip Warning/Caution Position (Left)', 'Tooltip Warning/Caution Position (Bottom)'], desc: 'Placement of the warning/caution boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnCautPos();}}; CM.ConfigData.TooltipGrim = {label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true}; CM.ConfigData.ToolWrink = {label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true}; +CM.ConfigData.TooltipLump = {label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true}; CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true}; CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 5 seconds', toggle: false}; CM.ConfigData.TimeFormat = {label: ['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'], desc: 'Change the time format', toggle: false}; CM.ConfigData.SayTime = {label: ['Format Time OFF', 'Format Time ON'], desc: 'Change how time is displayed in statistics', toggle: true, func: function() {CM.Disp.ToggleSayTime();}}; CM.ConfigData.GrimoireBar = {label: ['Grimoire Magic Meter Timer OFF', 'Grimoire Magic Meter Timer ON'], desc: 'A timer on how long before the Grimoire magic meter is full', toggle: true}; CM.ConfigData.Scale = {label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}}; - +CM.ConfigData.SortBuildings = {label: ['Sort Buildings: Default', 'Sort Buildings: PP'], desc: 'Sort the display of buildings in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateBuildings();}}; +CM.ConfigData.SortUpgrades = {label: ['Sort Upgrades: Default', 'Sort Upgrades: PP'], desc: 'Sort the display of upgrades in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateUpgrades();}}; diff --git a/src/Data.js b/src/Data.js index 4202c893..f5a8bded 100644 --- a/src/Data.js +++ b/src/Data.js @@ -20,6 +20,7 @@ CM.Data.Fortunes = [ 'Fortune #015', 'Fortune #016', 'Fortune #017', + 'Fortune #018', 'Fortune #100', 'Fortune #101', 'Fortune #102', @@ -28,5 +29,5 @@ CM.Data.Fortunes = [ ]; CM.Data.HalloCookies = ['Skull cookies', 'Ghost cookies', 'Bat cookies', 'Slime cookies', 'Pumpkin cookies', 'Eyeball cookies', 'Spider cookies']; CM.Data.ChristCookies = ['Christmas tree biscuits', 'Snowflake biscuits', 'Snowman biscuits', 'Holly biscuits', 'Candy cane biscuits', 'Bell biscuits', 'Present biscuits']; -CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits']; +CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits', 'Prism heart biscuits']; diff --git a/src/Disp.js b/src/Disp.js index fcb1d2de..60d6920d 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -88,6 +88,46 @@ CM.Disp.GetTimeColor = function(price, bank, cps, time) { return {text: text, color: color}; } +/** + * This function returns Name and Color as object for sugar lump type that is given as input param. + * @param type Sugar Lump Type. + * @returns {{text: string, color: string}} + * @constructor + */ +CM.Disp.GetLumpColor = function(type) { + var name = ""; + var color = ""; + + switch (type) { + case 0: + name = "Normal"; + color = CM.Disp.colorGray; + break; + case 1: + name = "Bifurcated"; + color = CM.Disp.colorGreen; + break; + case 2: + name = "Golden"; + color = CM.Disp.colorYellow; + break; + case 3: + name = "Meaty"; + color = CM.Disp.colorOrange; + break; + case 4: + name = "Caramelized"; + color = CM.Disp.colorPurple; + break; + default: + name = "Unknown Sugar Lump"; + color = CM.Disp.colorRed; + break; + } + + return {text: name, color: color}; +}; + CM.Disp.Beautify = function(num, frac) { if (CM.Config.Scale != 0 && isFinite(num)) { var answer = ''; @@ -206,6 +246,14 @@ CM.Disp.CreateCssArea = function() { CM.Disp.Css.type = 'text/css'; document.head.appendChild(CM.Disp.Css); + + // given the architecture of your code, you probably want these lines somewhere else, + // but I stuck them here for convenience + l("products").style.display = "grid"; + l("storeBulk").style.gridRow = "1/1"; + + l("upgrades").style.display = "flex"; + l("upgrades").style["flex-wrap"] = "wrap"; } CM.Disp.CreateBotBar = function() { @@ -593,6 +641,24 @@ CM.Disp.UpdateBuildings = function() { l('productPrice' + Game.Objects[i].id).style.color = ''; } } + + // Build array of pointers, sort by pp, use array index (+2) as the grid row number + // (grid rows are 1-based indexing, and row 1 is the bulk buy/sell options) + var arr = Object.keys(CM.Cache.Objects).map(k => + { + var o = CM.Cache.Objects[k]; + o.name = k; + o.id = Game.Objects[k].id; + return o; + }); + + if (CM.Config.SortBuildings) + arr.sort((a, b) => a.pp - b.pp); + else + arr.sort((a, b) => a.id - b.id); + + for (var x = 0; x < arr.length; x++) + Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2); } CM.Disp.CreateUpgradeBar = function() { @@ -603,6 +669,7 @@ CM.Disp.CreateUpgradeBar = function() { CM.Disp.UpgradeBar.style.textAlign = 'center'; CM.Disp.UpgradeBar.style.fontWeight = 'bold'; CM.Disp.UpgradeBar.style.display = 'none'; + CM.Disp.UpgradeBar.style.zIndex = '21'; CM.Disp.UpgradeBar.onmouseout = function() { Game.tooltip.hide(); }; var placeholder = document.createElement('div'); @@ -719,6 +786,25 @@ CM.Disp.UpdateUpgrades = function() { l('CMUpgradeBarPurple').textContent = purple; l('CMUpgradeBarGray').textContent = gray; } + + // Build array of pointers, sort by pp, set flex positions + var arr = []; + for (var x = 0; x < Game.UpgradesInStore.length; x++){ + var o = {}; + o.name = Game.UpgradesInStore[x].name; + o.price = Game.UpgradesInStore[x].basePrice; + o.pp = CM.Cache.Upgrades[o.name].pp; + arr.push(o); + } + + if (CM.Config.SortUpgrades) + arr.sort((a, b) => a.pp - b.pp); + else + arr.sort((a, b) => a.price - b.price); + + for (var x = 0; x < Game.UpgradesInStore.length; x++){ + l("upgrade" + x).style.order = arr.findIndex(e => e.name === Game.UpgradesInStore[x].name) + 1 + } } CM.Disp.UpdateColors = function() { @@ -736,6 +822,16 @@ CM.Disp.UpdateColors = function() { CM.Disp.UpdateBuildings(); // Class has been already set } +CM.Disp.ToggleUpgradeBarFixedPos = function() { + if (CM.Config.UpgradeBarFixedPos == 1) { + CM.Disp.UpgradeBar.style.position = 'sticky'; + CM.Disp.UpgradeBar.style.top = '0px'; + } + else { + CM.Disp.UpgradeBar.style.position = ''; + } +} + CM.Disp.CreateWhiteScreen = function() { CM.Disp.WhiteScreen = document.createElement('div'); CM.Disp.WhiteScreen.id = 'CMWhiteScreen'; @@ -1097,6 +1193,8 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(listing('BotBar')); frag.appendChild(listing('TimerBar')); frag.appendChild(listing('TimerBarPos')); + frag.appendChild(listing('SortBuildings')); + frag.appendChild(listing('SortUpgrades')); frag.appendChild(listing('BuildColor')); frag.appendChild(listing('BulkBuildColor')); frag.appendChild(listing('UpBarColor')); @@ -1116,6 +1214,7 @@ CM.Disp.AddMenuPref = function(title) { div.appendChild(label); frag.appendChild(div); } + frag.appendChild(listing('UpgradeBarFixedPos')); frag.appendChild(header('Calculation')); frag.appendChild(listing('CalcWrink')); @@ -1152,6 +1251,7 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(listing('ToolWarnCautPos')); frag.appendChild(listing('TooltipGrim')); frag.appendChild(listing('ToolWrink')); + frag.appendChild(listing('TooltipLump')); frag.appendChild(header('Statistics')); frag.appendChild(listing('Stats')); @@ -1429,8 +1529,8 @@ CM.Disp.AddMenuStats = function(title) { if (CM.Config.StatsPref.Prestige) { var possiblePresMax = Math.floor(Game.HowMuchPrestige(CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinkGodBank + (choEgg ? CM.Cache.lastChoEgg : 0))); var neededCook = Game.HowManyCookiesReset(possiblePresMax + 1) - (CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinkGodBank + (choEgg ? CM.Cache.lastChoEgg : 0)); - 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'); @@ -1438,6 +1538,7 @@ CM.Disp.AddMenuStats = function(title) { cookiesNextFrag.appendChild(cookiesNextSmall); 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))); @@ -1448,6 +1549,57 @@ CM.Disp.AddMenuStats = function(title) { resetFrag.appendChild(resetSmall); } stats.appendChild(listing(listingQuest('Reset Bonus Income', 'ResetTooltipPlaceholder'), resetFrag)); + + var currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset)); + var willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)); + var willGet = willHave - currentPrestige; + var addCommas = (n) => + { + var s1 = n.toString(); + var s2 = ''; + for (var i in s1) + { + if ((s1.length - i) % 3 == 0 && i > 0) + s2 += ','; + + s2 += s1[i]; + } + + return s2; + }; + + if (!Game.Has('Lucky digit')) + { + var delta7 = 7 - (willHave % 10); + if (delta7 < 0) delta7 += 10; + var next7Reset = willGet + delta7; + var next7Total = willHave + delta7; + var frag7 = document.createDocumentFragment(); + frag7.appendChild(document.createTextNode(addCommas(next7Total) + " / " + addCommas(next7Reset) + " (+" + delta7 + ")")); + stats.appendChild(listing('Next "Lucky Digit" (total / reset)', frag7)); + } + + if (!Game.Has('Lucky number')) + { + var delta777 = 777 - (willHave % 1000); + if (delta777 < 0) delta777 += 1000; + var next777Reset = willGet + delta777; + var next777Total = willHave + delta777; + var frag777 = document.createDocumentFragment(); + frag777.appendChild(document.createTextNode(addCommas(next777Total) + " / " + addCommas(next777Reset) + " (+" + delta777 + ")")); + stats.appendChild(listing('Next "Lucky Number" (total / reset)', frag777)); + } + + if (!Game.Has('Lucky payout')) + { + var delta777777 = 777777 - (willHave % 1000000); + if (delta777777 < 0) delta777777 += 1000000; + var next777777Reset = willGet + delta777777; + var next777777Total = willHave + delta777777; + var frag777777 = document.createDocumentFragment(); + frag777777.appendChild(document.createTextNode(addCommas(next777777Total) + " / " + addCommas(next777777Reset) + " (+" + delta777777 + ")")); + stats.appendChild(listing('Next "Lucky Payout" (total / reset)', frag777777)); + } } if (Game.cpsSucked > 0) { @@ -1697,6 +1849,17 @@ CM.Disp.AddTooltipGrimoire = function() { } } +/** + * This function improves Sugar Lump tooltip by adding extra infromation. + * @constructor + */ +CM.Disp.AddTooltipLump = function() { + if (Game.canLumps()) { + CM.Disp.TooltipLumpBack = l('lumps').onmouseover; + eval('l(\'lumps\').onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'s\', \'Lump\');}, \'this\'); Game.tooltip.wobble();}'); + } +}; + CM.Disp.Tooltip = function(type, name) { if (type == 'b') { l('tooltip').innerHTML = Game.Objects[name].tooltip(); @@ -1737,6 +1900,10 @@ CM.Disp.Tooltip = function(type, name) { if (!Game.UpgradesInStore[name]) return ''; l('tooltip').innerHTML = Game.crateTooltip(Game.UpgradesInStore[name], 'store'); } + else if (type === 's') { + // Sugar Lump + l('tooltip').innerHTML = Game.lumpTooltip(); + } else { // Grimoire l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); } @@ -1886,6 +2053,40 @@ CM.Disp.UpdateTooltip = function() { CM.Disp.TooltipWarnCaut.style.display = 'none'; } } + else if (CM.Disp.tooltipType === 's') { + // Adding information about Sugar Lumps. + + CM.Disp.TooltipWarnCaut.style.display = 'none'; + l('CMDispTooltipWarn').style.display = 'none'; + l('CMDispTooltipCaut').style.display = 'none'; + + if (CM.Config.TooltipLump === 1) { + l('CMTooltipArea').innerHTML = ''; + + l('tooltip').firstChild.style.paddingBottom = '4px'; + var lumpTooltip = document.createElement('div'); + lumpTooltip.style.border = '1px solid'; + lumpTooltip.style.padding = '4px'; + lumpTooltip.style.margin = '0px -4px'; + lumpTooltip.id = 'CMTooltipBorder'; + lumpTooltip.className = CM.Disp.colorTextPre + CM.Disp.colorGray; + + var lumpHeader = document.createElement('div'); + lumpHeader.style.fontWeight = 'bold'; + lumpHeader.className = CM.Disp.colorTextPre + CM.Disp.colorBlue; + lumpHeader.textContent = 'Current Sugar Lump'; + + lumpTooltip.appendChild(lumpHeader); + var lumpType = document.createElement('div'); + lumpType.id = 'CMTooltipTime'; + lumpTooltip.appendChild(lumpType); + var lumpColor = CM.Disp.GetLumpColor(Game.lumpCurrentType); + lumpType.textContent = lumpColor.text; + lumpType.className = CM.Disp.colorTextPre + lumpColor.color; + + l('CMTooltipArea').appendChild(lumpTooltip); + } + } else { // Grimoire CM.Disp.TooltipWarnCaut.style.display = 'none'; l('CMDispTooltipWarn').style.display = 'none'; diff --git a/src/Main.js b/src/Main.js index b5a582e5..3eb16e64 100644 --- a/src/Main.js +++ b/src/Main.js @@ -232,6 +232,7 @@ CM.DelayInit = function() { CM.Disp.CreateTooltipWarnCaut(); CM.Disp.AddTooltipBuild(); CM.Disp.AddTooltipGrimoire(); + CM.Disp.AddTooltipLump(); CM.Disp.AddWrinklerAreaDetect(); CM.Cache.InitCookiesDiff(); CM.ReplaceNative(); @@ -258,6 +259,7 @@ CM.ConfigDefault = { BuildColor: 1, BulkBuildColor: 0, UpBarColor: 1, + UpgradeBarFixedPos: 1, CalcWrink: 0, CPSMode: 1, AvgCPSHist: 3, @@ -288,6 +290,7 @@ CM.ConfigDefault = { ToolWarnCautPos: 1, TooltipGrim:1, ToolWrink: 1, + TooltipLump: 1, Stats: 1, UpStats: 1, TimeFormat: 0, @@ -295,10 +298,12 @@ CM.ConfigDefault = { GrimoireBar: 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'} + Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'}, + SortBuildings: 0, + SortUpgrades: 0 }; CM.ConfigPrefix = 'CMConfig'; -CM.VersionMajor = '2.021'; -CM.VersionMinor = '2'; +CM.VersionMajor = '2.031'; +CM.VersionMinor = '1'; diff --git a/src/Sim.js b/src/Sim.js index feed0f60..1baab394 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -65,8 +65,9 @@ CM.Sim.BuildingSell = function(build, basePrice, start, free, amount, emuAura) { } CM.Sim.Has = function(what) { - if (Game.ascensionMode == 1 && Game.Upgrades[what].pool == 'prestige') return 0; - return (CM.Sim.Upgrades[what] ? CM.Sim.Upgrades[what].bought : 0); + var it = CM.Sim.Upgrades[what]; + if (Game.ascensionMode == 1 && (it.pool == 'prestige' || it.tier == 'fortune')) return 0; + return (it ? it.bought : 0); } @@ -220,6 +221,8 @@ CM.Sim.CalculateGains = function() { if (CM.Sim.Has('Fortune #100')) mult *= 1.01; if (CM.Sim.Has('Fortune #101')) mult *= 1.07; + if (CM.Sim.Has('Dragon scale')) mult *= 1.03; + var buildMult = 1; if (Game.hasGod) { var godLvl = Game.hasGod('asceticism'); @@ -250,16 +253,8 @@ CM.Sim.CalculateGains = function() { if (CM.Sim.Has('Santa\'s legacy')) mult *= 1 + (Game.santaLevel + 1) * 0.03; - for (var i in CM.Sim.Objects) { - var me = CM.Sim.Objects[i]; - var storedCps = (typeof(me.cps) == 'function' ? me.cps(me) : me.cps); - if (Game.ascensionMode != 1) storedCps *= (1 + me.level * 0.01) * buildMult; - CM.Sim.cookiesPs += me.amount * storedCps; - } - - if (CM.Sim.Has('"egg"')) CM.Sim.cookiesPs += 9; // "egg" - - var milkMult=1; + var milkProgress = CM.Sim.AchievementsOwned / 25; + var milkMult = 1; if (CM.Sim.Has('Santa\'s milk and cookies')) milkMult *= 1.05; //if (CM.Sim.hasAura('Breath of Milk')) milkMult *= 1.05; milkMult *= 1 + CM.Sim.auraMult('Breath of Milk') * 0.05; @@ -274,21 +269,31 @@ CM.Sim.CalculateGains = function() { var catMult = 1; - if (CM.Sim.Has('Kitten helpers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.1 * milkMult); - if (CM.Sim.Has('Kitten workers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.125 * milkMult); - if (CM.Sim.Has('Kitten engineers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.15 * milkMult); - if (CM.Sim.Has('Kitten overseers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.175 * milkMult); - if (CM.Sim.Has('Kitten managers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten accountants')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten specialists')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten experts')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten consultants')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten assistants to the regional manager')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.175 * milkMult); - if (CM.Sim.Has('Kitten marketeers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.15 * milkMult); - if (CM.Sim.Has('Kitten analysts')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.125 * milkMult); - if (CM.Sim.Has('Kitten executives')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.115 * milkMult); - if (CM.Sim.Has('Kitten angels')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.1 * milkMult); - if (CM.Sim.Has('Fortune #103')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.05 * milkMult); + if (CM.Sim.Has('Kitten helpers')) catMult *= (1 + milkProgress * 0.1 * milkMult); + if (CM.Sim.Has('Kitten workers')) catMult *= (1 + milkProgress * 0.125 * milkMult); + if (CM.Sim.Has('Kitten engineers')) catMult *= (1 + milkProgress * 0.15 * milkMult); + if (CM.Sim.Has('Kitten overseers')) catMult *= (1 + milkProgress * 0.175 * milkMult); + if (CM.Sim.Has('Kitten managers')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten accountants')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten specialists')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten experts')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten consultants')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten assistants to the regional manager')) catMult *= (1 + milkProgress * 0.175 * milkMult); + if (CM.Sim.Has('Kitten marketeers')) catMult *= (1 + milkProgress * 0.15 * milkMult); + if (CM.Sim.Has('Kitten analysts')) catMult *= (1 + milkProgress * 0.125 * milkMult); + if (CM.Sim.Has('Kitten executives')) catMult *= (1 + milkProgress * 0.115 * milkMult); + if (CM.Sim.Has('Kitten angels')) catMult *= (1 + milkProgress * 0.1 * milkMult); + if (CM.Sim.Has('Fortune #103')) catMult *= (1 + milkProgress * 0.05 * milkMult); + + for (var i in CM.Sim.Objects) { + var me = CM.Sim.Objects[i]; + var storedCps = (typeof(me.cps) == 'function' ? me.cps(me) : me.cps); + if (Game.ascensionMode != 1) storedCps *= (1 + me.level * 0.01) * buildMult; + if (me.name == "Grandma" && CM.Sim.Has('Milkhelp® lactose intolerance relief tablets')) storedCps *= 1 + 0.05 * milkProgress * milkMult; + CM.Sim.cookiesPs += me.amount * storedCps; + } + + if (CM.Sim.Has('"egg"')) CM.Sim.cookiesPs += 9;//"egg" mult *= catMult; @@ -337,7 +342,7 @@ CM.Sim.CalculateGains = function() { mult *= CM.Sim.getCPSBuffMult(); // Pointless? - name = Game.bakeryName.toLowerCase(); + var name = Game.bakeryName.toLowerCase(); if (name == 'orteil') mult *= 0.99; else if (name == 'ortiel') mult *= 0.98; //or so help me @@ -402,19 +407,25 @@ CM.Sim.CheckOtherAchiev = function() { if (minAmount >= 400) CM.Sim.Win('Quadricentennial'); if (minAmount >= 450) CM.Sim.Win('Quadricentennial and a half'); if (minAmount >= 500) CM.Sim.Win('Quincentennial'); + if (minAmount >= 550) CM.Sim.Win('Quincentennial and a half'); + if (minAmount >= 600) CM.Sim.Win('Sexcentennial'); if (buildingsOwned >= 100) CM.Sim.Win('Builder'); if (buildingsOwned >= 500) CM.Sim.Win('Architect'); if (buildingsOwned >= 1000) CM.Sim.Win('Engineer'); if (buildingsOwned >= 2000) CM.Sim.Win('Lord of Constructs'); + if (buildingsOwned >= 4000) CM.Sim.Win('Grand design'); + if (buildingsOwned >= 8000) CM.Sim.Win('Ecumenopolis'); if (CM.Sim.UpgradesOwned >= 20) CM.Sim.Win('Enhancer'); if (CM.Sim.UpgradesOwned >= 50) CM.Sim.Win('Augmenter'); if (CM.Sim.UpgradesOwned >= 100) CM.Sim.Win('Upgrader'); if (CM.Sim.UpgradesOwned >= 200) CM.Sim.Win('Lord of Progress'); + if (CM.Sim.UpgradesOwned >= 300) CM.Sim.Win('The full picture'); + if (CM.Sim.UpgradesOwned >= 400) CM.Sim.Win('When there\'s nothing left to add'); - if (buildingsOwned >= 3000 && CM.Sim.UpgradesOwned >= 300) CM.Sim.Win('Polymath'); - if (buildingsOwned >= 4000 && CM.Sim.UpgradesOwned >= 400) CM.Sim.Win('Renaissance baker'); + if (buildingsOwned >= 4000 && CM.Sim.UpgradesOwned >= 300) CM.Sim.Win('Polymath'); + if (buildingsOwned >= 8000 && CM.Sim.UpgradesOwned >= 400) CM.Sim.Win('Renaissance baker'); if (CM.Sim.Objects['Cursor'].amount + CM.Sim.Objects['Grandma'].amount >= 777) CM.Sim.Win('The elder scrolls'); @@ -457,6 +468,8 @@ CM.Sim.BuyBuildings = function(amount, target) { if (me.amount >= 400) CM.Sim.Win('Dr. T'); if (me.amount >= 500) CM.Sim.Win('Thumbs, phalanges, metacarpals'); if (me.amount >= 600) CM.Sim.Win('With her finger and her thumb'); + if (me.amount >= 700) CM.Sim.Win('Gotta hand it to you'); + if (me.amount >= 800) CM.Sim.Win('The devil\'s workshop'); } else { for (var j in Game.Objects[me.name].tieredAchievs) { @@ -500,7 +513,7 @@ CM.Sim.BuyUpgrades = function() { else if (i == 'Elder Covenant') { CM.Sim.Win('Elder calm') } - else if (i == 'Eternal heart biscuits') { + else if (i == 'Prism heart biscuits') { CM.Sim.Win('Lovely cookies'); } else if (i == 'Heavenly key') {