Replaced var with let

This commit is contained in:
Daniël van Noord committed 2021-02-20 16:12:16 +01:00
1 parent f3ceec3c91
commit 43fb9112a7
7 files changed
+252 -252

No files matched your search

+1 -1
View File
@@ -1 +1 @@
const CM={Backup:{},Cache:{},Config:{},Data:{Config:{}},Disp:{},Footer:{},Main:{},Options:{},Sim:{},VersionMajor:"2.031",VersionMinor:"3"};CM.Cache.InitCache=function(){CM.Cache.CacheDragonAuras();CM.Cache.CacheWrinklers();CM.Cache.CacheStats();CM.Cache.CacheGoldenAndWrathCookiesMults();CM.Cache.CacheChain();CM.Cache.CacheMissingUpgrades();CM.Cache.CacheSeaSpec();CM.Cache.InitCookiesDiff();CM.Cache.CacheAvgCPS();CM.Cache.CacheIncome();CM.Cache.CacheBuildingsPrices();CM.Cache.CachePP()};CM.Cache.CacheDragonAuras=function(){CM.Cache.dragonAura=Game.dragonAura;CM.Cache.dragonAura2=Game.dragonAura2};CM.Cache.CacheWrinklers=function(){CM.Cache.WrinklersTotal=0;CM.Cache.WrinklersNormal=0;CM.Cache.WrinklersFattest=[0,null];for(let i=0;i<Game.wrinklers.length;i++){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;sucked*=toSuck;if(Game.Has("Wrinklerspawn"))sucked*=1.05;if(CM.Sim.Objects.Temple.minigameLoaded){var godLvl=Game.hasGod("scorn");if(godLvl===1)sucked*=1.15;else if(godLvl===2)sucked*=1.1;else if(godLvl===3)sucked*=1.05}CM.Cache.WrinklersTotal+=sucked;if(Game.wrinklers[i].type===0){CM.Cache.WrinklersNormal+=sucked;if(sucked>CM.Cache.WrinklersFattest[0])CM.Cache.WrinklersFattest=[sucked,i]}}};CM.Cache.CacheStats=function(){CM.Cache.Lucky=CM.Cache.NoGoldSwitchCookiesPS*900/.15;CM.Cache.Lucky*=CM.Cache.DragonsFortuneMultAdjustment;let cpsBuffMult=CM.Cache.getCPSBuffMult();if(cpsBuffMult>0)CM.Cache.Lucky/=cpsBuffMult;else CM.Cache.Lucky=0;CM.Cache.LuckyReward=CM.Cache.GoldenCookiesMult*(CM.Cache.Lucky*.15)+13;CM.Cache.LuckyWrathReward=CM.Cache.WrathCookiesMult*(CM.Cache.Lucky*.15)+13;CM.Cache.LuckyFrenzy=CM.Cache.Lucky*7;CM.Cache.LuckyRewardFrenzy=CM.Cache.GoldenCookiesMult*(CM.Cache.LuckyFrenzy*.15)+13;CM.Cache.LuckyWrathRewardFrenzy=CM.Cache.WrathCookiesMult*(CM.Cache.LuckyFrenzy*.15)+13;CM.Cache.Conjure=CM.Cache.Lucky*2;CM.Cache.ConjureReward=CM.Cache.Conjure*.15;CM.Cache.Edifice=0;let max=0;let n=0;for(let i of Object.keys(Game.Objects)){if(Game.Objects[i].amount>max)max=Game.Objects[i].amount;if(Game.Objects[i].amount>0)n++}for(let i of Object.keys(Game.Objects)){if((Game.Objects[i].amount<max||n===1)&&Game.Objects[i].amount<400&&Game.Objects[i].price*2>CM.Cache.Edifice){CM.Cache.Edifice=Game.Objects[i].price*2;CM.Cache.EdificeBuilding=i}}};CM.Cache.CacheGoldenAndWrathCookiesMults=function(){if(CM.Footer.isInitzializing){CM.Cache.GoldenCookiesMult=1;CM.Cache.WrathCookiesMult=1;CM.Cache.DragonsFortuneMultAdjustment=1}else{var goldenMult=1;var wrathMult=1;var mult=1;if(CM.Sim.Has("Green yeast digestives"))mult*=1.01;if(CM.Sim.Has("Dragon fang"))mult*=1.03;goldenMult*=1+Game.auraMult("Ancestral Metamorphosis")*.1;goldenMult*=Game.eff("goldenCookieGain");wrathMult*=1+Game.auraMult("Unholy Dominion")*.1;wrathMult*=Game.eff("wrathCookieGain");CM.Cache.GoldenCookiesMult=mult*goldenMult;CM.Cache.WrathCookiesMult=mult*wrathMult;CM.Cache.DragonsFortuneMultAdjustment=1;if(Game.shimmerTypes.golden.n===0){CM.Cache.DragonsFortuneMultAdjustment*=1+Game.auraMult("Dragon's Fortune")*1.23}}};CM.Cache.MaxChainCookieReward=function(digit,maxPayout,mult){let totalFromChain=0;let moni=0;let nextMoni=0;var chain=1+Math.max(0,Math.ceil(Math.log(Game.cookies)/Math.LN10)-10);while(nextMoni<maxPayout){moni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,chain)*digit*mult),maxPayout));nextMoni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,chain+1)*digit*mult),maxPayout));totalFromChain+=moni;chain++}return[totalFromChain,nextMoni]};CM.Cache.CacheChain=function(){let maxPayout=CM.Cache.NoGoldSwitchCookiesPS*60*60*6*CM.Cache.DragonsFortuneMultAdjustment;let cpsBuffMult=CM.Cache.getCPSBuffMult();if(cpsBuffMult>0)maxPayout/=cpsBuffMult;else maxPayout=0;CM.Cache.ChainReward=CM.Cache.MaxChainCookieReward(7,maxPayout*CM.Cache.GoldenCookiesMult,CM.Cache.GoldenCookiesMult);CM.Cache.ChainRequired=CM.Cache.ChainReward[0]*2;CM.Cache.ChainRequiredNext=CM.Cache.ChainReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainWrathReward=CM.Cache.MaxChainCookieReward(6,maxPayout*CM.Cache.WrathCookiesMult,CM.Cache.WrathCookiesMult);CM.Cache.ChainWrathRequired=CM.Cache.ChainWrathReward[0]*2;CM.Cache.ChainWrathRequiredNext=CM.Cache.ChainWrathReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyReward=CM.Cache.MaxChainCookieReward(7,maxPayout*7*CM.Cache.GoldenCookiesMult,CM.Cache.GoldenCookiesMult);CM.Cache.ChainFrenzyRequired=CM.Cache.ChainFrenzyReward[0]*2;CM.Cache.ChainFrenzyRequiredNext=CM.Cache.ChainFrenzyReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyWrathReward=CM.Cache.MaxChainCookieReward(6,maxPayout*7*CM.Cache.WrathCookiesMult,CM.Cache.WrathCookiesMult);CM.Cache.ChainFrenzyWrathRequired=CM.Cache.ChainFrenzyReward[0]*2;CM.Cache.ChainFrenzyWrathRequiredNext=CM.Cache.ChainFrenzyReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment};CM.Cache.CacheMissingUpgrades=function(){CM.Cache.MLine truncated
const CM={Backup:{},Cache:{},Config:{},Data:{Config:{}},Disp:{},Footer:{},Main:{},Options:{},Sim:{},VersionMajor:"2.031",VersionMinor:"3"};CM.Cache.InitCache=function(){CM.Cache.CacheDragonAuras();CM.Cache.CacheWrinklers();CM.Cache.CacheStats();CM.Cache.CacheGoldenAndWrathCookiesMults();CM.Cache.CacheChain();CM.Cache.CacheMissingUpgrades();CM.Cache.CacheSeaSpec();CM.Cache.InitCookiesDiff();CM.Cache.CacheAvgCPS();CM.Cache.CacheIncome();CM.Cache.CacheBuildingsPrices();CM.Cache.CachePP()};CM.Cache.CacheDragonAuras=function(){CM.Cache.dragonAura=Game.dragonAura;CM.Cache.dragonAura2=Game.dragonAura2};CM.Cache.CacheWrinklers=function(){CM.Cache.WrinklersTotal=0;CM.Cache.WrinklersNormal=0;CM.Cache.WrinklersFattest=[0,null];for(let i=0;i<Game.wrinklers.length;i++){let sucked=Game.wrinklers[i].sucked;let toSuck=1.1;if(Game.Has("Sacrilegious corruption"))toSuck*=1.05;if(Game.wrinklers[i].type==1)toSuck*=3;sucked*=toSuck;if(Game.Has("Wrinklerspawn"))sucked*=1.05;if(CM.Sim.Objects.Temple.minigameLoaded){let godLvl=Game.hasGod("scorn");if(godLvl===1)sucked*=1.15;else if(godLvl===2)sucked*=1.1;else if(godLvl===3)sucked*=1.05}CM.Cache.WrinklersTotal+=sucked;if(Game.wrinklers[i].type===0){CM.Cache.WrinklersNormal+=sucked;if(sucked>CM.Cache.WrinklersFattest[0])CM.Cache.WrinklersFattest=[sucked,i]}}};CM.Cache.CacheStats=function(){CM.Cache.Lucky=CM.Cache.NoGoldSwitchCookiesPS*900/.15;CM.Cache.Lucky*=CM.Cache.DragonsFortuneMultAdjustment;let cpsBuffMult=CM.Cache.getCPSBuffMult();if(cpsBuffMult>0)CM.Cache.Lucky/=cpsBuffMult;else CM.Cache.Lucky=0;CM.Cache.LuckyReward=CM.Cache.GoldenCookiesMult*(CM.Cache.Lucky*.15)+13;CM.Cache.LuckyWrathReward=CM.Cache.WrathCookiesMult*(CM.Cache.Lucky*.15)+13;CM.Cache.LuckyFrenzy=CM.Cache.Lucky*7;CM.Cache.LuckyRewardFrenzy=CM.Cache.GoldenCookiesMult*(CM.Cache.LuckyFrenzy*.15)+13;CM.Cache.LuckyWrathRewardFrenzy=CM.Cache.WrathCookiesMult*(CM.Cache.LuckyFrenzy*.15)+13;CM.Cache.Conjure=CM.Cache.Lucky*2;CM.Cache.ConjureReward=CM.Cache.Conjure*.15;CM.Cache.Edifice=0;let max=0;let n=0;for(let i of Object.keys(Game.Objects)){if(Game.Objects[i].amount>max)max=Game.Objects[i].amount;if(Game.Objects[i].amount>0)n++}for(let i of Object.keys(Game.Objects)){if((Game.Objects[i].amount<max||n===1)&&Game.Objects[i].amount<400&&Game.Objects[i].price*2>CM.Cache.Edifice){CM.Cache.Edifice=Game.Objects[i].price*2;CM.Cache.EdificeBuilding=i}}};CM.Cache.CacheGoldenAndWrathCookiesMults=function(){if(CM.Footer.isInitzializing){CM.Cache.GoldenCookiesMult=1;CM.Cache.WrathCookiesMult=1;CM.Cache.DragonsFortuneMultAdjustment=1}else{let goldenMult=1;let wrathMult=1;let mult=1;if(CM.Sim.Has("Green yeast digestives"))mult*=1.01;if(CM.Sim.Has("Dragon fang"))mult*=1.03;goldenMult*=1+Game.auraMult("Ancestral Metamorphosis")*.1;goldenMult*=Game.eff("goldenCookieGain");wrathMult*=1+Game.auraMult("Unholy Dominion")*.1;wrathMult*=Game.eff("wrathCookieGain");CM.Cache.GoldenCookiesMult=mult*goldenMult;CM.Cache.WrathCookiesMult=mult*wrathMult;CM.Cache.DragonsFortuneMultAdjustment=1;if(Game.shimmerTypes.golden.n===0){CM.Cache.DragonsFortuneMultAdjustment*=1+Game.auraMult("Dragon's Fortune")*1.23}}};CM.Cache.MaxChainCookieReward=function(digit,maxPayout,mult){let totalFromChain=0;let moni=0;let nextMoni=0;let chain=1+Math.max(0,Math.ceil(Math.log(Game.cookies)/Math.LN10)-10);while(nextMoni<maxPayout){moni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,chain)*digit*mult),maxPayout));nextMoni=Math.max(digit,Math.min(Math.floor(1/9*Math.pow(10,chain+1)*digit*mult),maxPayout));totalFromChain+=moni;chain++}return[totalFromChain,nextMoni]};CM.Cache.CacheChain=function(){let maxPayout=CM.Cache.NoGoldSwitchCookiesPS*60*60*6*CM.Cache.DragonsFortuneMultAdjustment;let cpsBuffMult=CM.Cache.getCPSBuffMult();if(cpsBuffMult>0)maxPayout/=cpsBuffMult;else maxPayout=0;CM.Cache.ChainReward=CM.Cache.MaxChainCookieReward(7,maxPayout*CM.Cache.GoldenCookiesMult,CM.Cache.GoldenCookiesMult);CM.Cache.ChainRequired=CM.Cache.ChainReward[0]*2;CM.Cache.ChainRequiredNext=CM.Cache.ChainReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainWrathReward=CM.Cache.MaxChainCookieReward(6,maxPayout*CM.Cache.WrathCookiesMult,CM.Cache.WrathCookiesMult);CM.Cache.ChainWrathRequired=CM.Cache.ChainWrathReward[0]*2;CM.Cache.ChainWrathRequiredNext=CM.Cache.ChainWrathReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyReward=CM.Cache.MaxChainCookieReward(7,maxPayout*7*CM.Cache.GoldenCookiesMult,CM.Cache.GoldenCookiesMult);CM.Cache.ChainFrenzyRequired=CM.Cache.ChainFrenzyReward[0]*2;CM.Cache.ChainFrenzyRequiredNext=CM.Cache.ChainFrenzyReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyWrathReward=CM.Cache.MaxChainCookieReward(6,maxPayout*7*CM.Cache.WrathCookiesMult,CM.Cache.WrathCookiesMult);CM.Cache.ChainFrenzyWrathRequired=CM.Cache.ChainFrenzyReward[0]*2;CM.Cache.ChainFrenzyWrathRequiredNext=CM.Cache.ChainFrenzyReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment};CM.Cache.CacheMissingUpgrades=function(){CM.Cache.MLine truncated
+17 -17
View File
@@ -55,14 +55,14 @@ CM.Cache.CacheWrinklers = function() {
CM.Cache.WrinklersNormal = 0;
CM.Cache.WrinklersFattest = [0, null];
for (let i = 0; i < Game.wrinklers.length; i++) {
var sucked = Game.wrinklers[i].sucked;
var toSuck = 1.1;
let sucked = Game.wrinklers[i].sucked;
let 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;
if (CM.Sim.Objects.Temple.minigameLoaded) {
var godLvl = Game.hasGod('scorn');
let godLvl = Game.hasGod('scorn');
if (godLvl === 1) sucked *= 1.15;
else if (godLvl === 2) sucked *= 1.1;
else if (godLvl === 3) sucked *= 1.05;
@@ -137,9 +137,9 @@ CM.Cache.CacheGoldenAndWrathCookiesMults = function() {
CM.Cache.WrathCookiesMult = 1;
CM.Cache.DragonsFortuneMultAdjustment = 1;
} else {
var goldenMult = 1;
var wrathMult = 1;
var mult = 1;
let goldenMult = 1;
let wrathMult = 1;
let mult = 1;
// Factor auras and upgrade in mults
if (CM.Sim.Has('Green yeast digestives')) mult *= 1.01;
@@ -177,7 +177,7 @@ CM.Cache.MaxChainCookieReward = function(digit, maxPayout, mult) {
let totalFromChain = 0;
let moni = 0;
let nextMoni = 0;
var chain = 1 + Math.max(0, Math.ceil(Math.log(Game.cookies) / Math.LN10) - 10);
let chain = 1 + Math.max(0, Math.ceil(Math.log(Game.cookies) / Math.LN10) - 10);
while (nextMoni < maxPayout) {
moni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain) * digit * mult), maxPayout));
// TODO: Calculate Cookies or cps needed for next level of chain. Related to issue #580
@@ -241,12 +241,12 @@ CM.Cache.CacheMissingUpgrades = function() {
CM.Cache.MissingUpgrades = "";
CM.Cache.MissingUpgradesCookies = "";
CM.Cache.MissingUpgradesPrestige = "";
var list = [];
let list = [];
//sort the upgrades
for (let i of Object.keys(Game.Upgrades)) {
list.push(Game.Upgrades[i]);
}
var sortMap = function(a, b) {
let sortMap = function(a, b) {
if (a.order>b.order) return 1;
else if (a.order<b.order) return -1;
else return 0;
@@ -254,10 +254,10 @@ CM.Cache.CacheMissingUpgrades = function() {
list.sort(sortMap);
for (let i of Object.keys(list)) {
var me = list[i];
let me = list[i];
if (me.bought === 0) {
var str = '';
let str = '';
str += CM.Disp.crateMissing(me);
if (me.pool === 'prestige') CM.Cache.MissingUpgradesPrestige += str;
@@ -274,7 +274,7 @@ CM.Cache.CacheMissingUpgrades = function() {
*/
CM.Cache.CacheSeaSpec = function() {
if (Game.season === 'christmas') {
var val = Game.cookiesPs * 60;
let val = Game.cookiesPs * 60;
if (Game.hasBuff('Elder frenzy')) val *= 0.5;
if (Game.hasBuff('Frenzy')) val *= 0.75;
CM.Cache.SeaSpec = Math.max(25, val);
@@ -313,7 +313,7 @@ class CMAvgQueue {
calcAverage (timePeriod) {
if (timePeriod > this.maxLength) timePeriod = this.maxLength;
if (timePeriod > this.queue.length) timePeriod = this.queue.length;
var ret = 0;
let ret = 0;
for (let i = this.queue.length - 1; i >= 0 && i > this.queue.length - 1 - timePeriod; i--) {
ret += this.queue[i];
}
@@ -430,7 +430,7 @@ CM.Cache.CacheCurrWrinklerCPS = function() {
}
let godMult = 1;
if (CM.Sim.Objects.Temple.minigameLoaded) {
var godLvl = Game.hasGod('scorn');
let godLvl = Game.hasGod('scorn');
if (godLvl === 1) godMult *= 1.15;
else if (godLvl === 2) godMult *= 1.1;
else if (godLvl === 3) godMult *= 1.05;
@@ -445,7 +445,7 @@ CM.Cache.CacheCurrWrinklerCPS = function() {
* @returns {number} mult The multiplier
*/
CM.Cache.getCPSBuffMult = function() {
var mult = 1;
let mult = 1;
for (let i of Object.keys(Game.buffs)) {
if (typeof Game.buffs[i].multCpS != 'undefined') mult *= Game.buffs[i].multCpS;
}
@@ -476,8 +476,8 @@ CM.Cache.NoGoldSwitchCPS = function() {
CM.Cache.CacheDragonCost = function() {
if (CM.Cache.lastDragonLevel != Game.dragonLevel || CM.Sim.DoSims) {
if (Game.dragonLevel < 25 && Game.dragonLevels[Game.dragonLevel].buy.toString().includes("sacrifice")) {
var target = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/)[1];
var amount = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/sacrifice\((.*?)\)/)[1];
let target = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/)[1];
let amount = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/sacrifice\((.*?)\)/)[1];
if (target != "i") {
target = target.replaceAll("'", "");
if (Game.Objects[target].amount < amount) {
+1 -1
View File
@@ -33,7 +33,7 @@ CM.Config.LoadConfig = function(settings) {
CM.Options = settings;
// Check values
var mod = false;
let mod = false;
for (let i in CM.Data.ConfigDefault) {
if (typeof CM.Options[i] === 'undefined') {
mod = true;
+211 -211
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -13,7 +13,7 @@
*/
CM.init = function() {
CM.Footer.isInitzializing = true
var proceed = true;
let proceed = true;
if (Game.version != CM.VersionMajor) {
proceed = confirm('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' is meant for Game version ' + CM.VersionMajor + '. Loading a different version may cause errors. Do you still want to load Cookie Monster?');
}
@@ -67,7 +67,7 @@ CM.Footer.AddJscolor = function() {
*/
if (typeof CM.Footer.isInitzializing === 'undefined') {
CM.Footer.AddJscolor();
var delay = setInterval(function() {
let delay = setInterval(function() {
if (typeof jscolor !== 'undefined') {
jscolor.init();
Game.registerMod('CookieMonster', CM);
+8 -8
View File
@@ -33,7 +33,7 @@ CM.Main.Loop = function() {
}
// Check for aura change to recalculate buildings prices
var hasBuildAura = Game.auraMult('Fierce Hoarder') > 0;
let hasBuildAura = Game.auraMult('Fierce Hoarder') > 0;
if (!CM.Cache.HadBuildAura && hasBuildAura) {
CM.Cache.HadBuildAura = true;
CM.Cache.DoRemakeBuildPrices = 1;
@@ -227,7 +227,7 @@ CM.Main.ReplaceNativeGrimoire = function() {
*/
CM.Main.ReplaceNativeGrimoireLaunch = function() {
if (!CM.Main.HasReplaceNativeGrimoireLaunch && Game.Objects['Wizard tower'].minigameLoaded) {
var minigame = Game.Objects['Wizard tower'].minigame;
let minigame = Game.Objects['Wizard tower'].minigame;
CM.Backup.GrimoireLaunch = minigame.launch;
eval('CM.Backup.GrimoireLaunchMod = ' + minigame.launch.toString().split('=this').join('= Game.Objects[\'Wizard tower\'].minigame'));
Game.Objects['Wizard tower'].minigame.launch = function() {
@@ -246,7 +246,7 @@ CM.Main.ReplaceNativeGrimoireLaunch = function() {
*/
CM.Main.ReplaceNativeGrimoireDraw = function() {
if (!CM.Main.HasReplaceNativeGrimoireDraw && Game.Objects['Wizard tower'].minigameLoaded) {
var minigame = Game.Objects['Wizard tower'].minigame;
let minigame = Game.Objects['Wizard tower'].minigame;
CM.Backup.GrimoireDraw = minigame.draw;
Game.Objects['Wizard tower'].minigame.draw = function() {
CM.Backup.GrimoireDraw();
@@ -292,7 +292,7 @@ CM.Main.ReplaceTooltips = function() {
CM.Main.ReplaceTooltipBuild = function() {
CM.Main.TooltipBuildBackup = [];
for (let i of Object.keys(Game.Objects)) {
var me = Game.Objects[i];
let me = Game.Objects[i];
if (l('product' + me.id).onmouseover != null) {
CM.Main.TooltipBuildBackup[i] = l('product' + me.id).onmouseover;
eval('l(\'product\' + me.id).onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'b\', \'' + i + '\');}, \'store\'); Game.tooltip.wobble();}');
@@ -338,7 +338,7 @@ CM.Main.ReplaceTooltipGarden = function() {
if (Game.Objects.Farm.minigameLoaded) {
l('gardenTool-1').onmouseover = function() {Game.tooltip.dynamic=1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('ha', 'HarvestAllButton');}, 'this'); Game.tooltip.wobble();};
Array.from(l('gardenPlot').children).forEach((child) => {
var coords = child.id.slice(-3,);
let coords = child.id.slice(-3,);
child.onmouseover = function() {Game.tooltip.dynamic=1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('p', [`${coords[0]}`,`${coords[2]}`]);}, 'this'); Game.tooltip.wobble();};
});
}
@@ -458,7 +458,7 @@ CM.Main.CheckGardenTick = function() {
*/
CM.Main.CheckMagicMeter = function() {
if (Game.Objects['Wizard tower'].minigameLoaded && CM.Options.GrimoireBar === 1) {
var minigame = Game.Objects['Wizard tower'].minigame;
let minigame = Game.Objects['Wizard tower'].minigame;
if (minigame.magic < minigame.magicM) CM.Main.lastMagicBarFull = false;
else if (!CM.Main.lastMagicBarFull) {
CM.Main.lastMagicBarFull = true;
@@ -475,7 +475,7 @@ CM.Main.CheckMagicMeter = function() {
*/
CM.Main.CheckWrinklerCount = function() {
if (Game.elderWrath > 0) {
var CurrentWrinklers = 0;
let CurrentWrinklers = 0;
for (let i in Game.wrinklers) {
if (Game.wrinklers[i].phase === 2) CurrentWrinklers++;
}
@@ -528,7 +528,7 @@ CM.Main.AddWrinklerAreaDetect = function() {
*/
CM.Main.FixMouseY = function(target) {
if (CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 0) {
var timerBarHeight = parseInt(CM.Disp.TimerBar.style.height);
let timerBarHeight = parseInt(CM.Disp.TimerBar.style.height);
Game.mouseY -= timerBarHeight;
target();
Game.mouseY += timerBarHeight;
+12 -12
View File
@@ -17,7 +17,7 @@
* @returns {number} moni Total price
*/
CM.Sim.BuildingGetPrice = function(build, basePrice, start, free, increase) {
var moni = 0;
let moni = 0;
for (let i = 0; i < increase; i++) {
let price = basePrice * Math.pow(Game.priceIncrease, Math.max(0, start - free));
price = Game.modifyBuildingPrice(build, price);
@@ -84,14 +84,14 @@ CM.Sim.BuildingSell = function(build, basePrice, start, free, amount, noSim) {
// Calculate money gains from selling buildings
// If noSim is set, use Game methods to compute price instead of Sim ones.
noSim = typeof noSim === "undefined" ? 0 : noSim;
var moni = 0;
let moni = 0;
if (amount === -1) amount = start;
if (!amount) amount = Game.buyBulk;
for (let i = 0; i < amount; i++) {
let price = basePrice * Math.pow(Game.priceIncrease, Math.max(0, start - free));
price = noSim ? Game.modifyBuildingPrice(build, price) : CM.Sim.modifyBuildingPrice(build, price);
price = Math.ceil(price);
var giveBack = noSim ? build.getSellMultiplier() : CM.Sim.getSellMultiplier();
let giveBack = noSim ? build.getSellMultiplier() : CM.Sim.getSellMultiplier();
price = Math.floor(price * giveBack);
if (start > 0) {
moni += price;
@@ -192,7 +192,7 @@ CM.Sim.hasAura = function(what) {
* @returns {number} The multiplier
*/
CM.Sim.auraMult = function(what) {
var n = 0;
let n = 0;
if (Game.dragonAuras[CM.Sim.dragonAura].name === what || Game.dragonAuras[CM.Sim.dragonAura2].name === what)
n = 1;
if (Game.dragonAuras[CM.Sim.dragonAura].name === 'Reality Bending' || Game.dragonAuras[CM.Sim.dragonAura2].name === 'Reality Bending')
@@ -211,8 +211,8 @@ CM.Sim.hasGod = function(what) {
if (!CM.Sim.Objects.Temple.minigameLoaded) {
return false;
}
var possibleGods = CM.Sim.Objects.Temple.minigame.gods;
var god=possibleGods[what];
let possibleGods = CM.Sim.Objects.Temple.minigame.gods;
let god=possibleGods[what];
for (let i=0;i<3;i++)
{
if (CM.Sim.Objects.Temple.minigame.slot[i]==god.id) return (i+1);
@@ -559,7 +559,7 @@ CM.Sim.CalculateGains = function() {
if (CM.Sim.Has('Ant larva')) eggMult *= 1.01;
if (CM.Sim.Has('Century egg')) {
// The boost increases a little every day, with diminishing returns up to +10% on the 100th day
var day = Math.floor((CM.Sim.DateCentury - Game.startDate) / 1000 / 10) * 10 / 60 / 60 / 24;
let day = Math.floor((CM.Sim.DateCentury - Game.startDate) / 1000 / 10) * 10 / 60 / 60 / 24;
day = Math.min(day, 100);
// Sets a Cache value to be displayed in the Stats page, could be moved...
CM.Cache.CentEgg = 1 + (1 - Math.pow(1 - day / 100, 3)) * 0.1;
@@ -748,7 +748,7 @@ CM.Sim.BuyBuildingsBonusIncome = function(building, amount) {
}
}
var lastAchievementsOwned = CM.Sim.AchievementsOwned;
let lastAchievementsOwned = CM.Sim.AchievementsOwned;
CM.Sim.CalculateGains();
@@ -789,7 +789,7 @@ CM.Sim.BuyUpgradesBonusIncome = function(upgrade) {
CM.Sim.Win('Wholesome');
}
var lastAchievementsOwned = CM.Sim.AchievementsOwned;
let lastAchievementsOwned = CM.Sim.AchievementsOwned;
CM.Sim.CalculateGains();
@@ -900,7 +900,7 @@ CM.Sim.CalculateChangeAura = function(aura) {
CM.Sim.CopyData();
// Check if aura being changed is first or second aura
var auraToBeChanged = l('promptContent').children[0].innerHTML.includes("secondary");
let auraToBeChanged = l('promptContent').children[0].innerHTML.includes("secondary");
if (auraToBeChanged) CM.Sim.dragonAura2 = aura;
else CM.Sim.dragonAura = aura;
@@ -909,7 +909,7 @@ CM.Sim.CalculateChangeAura = function(aura) {
if (CM.Sim.dragonAura != CM.Cache.dragonAura || CM.Sim.dragonAura2 != CM.Cache.dragonAura2) {
for (let i = Game.ObjectsById.length; i > -1, --i;) {
if (Game.ObjectsById[i].amount > 0) {
var highestBuilding = CM.Sim.Objects[Game.ObjectsById[i].name].name;
let highestBuilding = CM.Sim.Objects[Game.ObjectsById[i].name].name;
CM.Sim.Objects[highestBuilding].amount -=1;
CM.Sim.buildingsOwned -= 1;
price = CM.Sim.Objects[highestBuilding].basePrice * Math.pow(Game.priceIncrease, Math.max(0, CM.Sim.Objects[highestBuilding].amount - 1 -CM.Sim.Objects[highestBuilding].free));
@@ -1029,7 +1029,7 @@ CM.Sim.SellBuildingsForChoEgg = function() {
// Sacrifice highest buildings for the aura switch
for (let i = 0; i < buildingsToSacrifice; ++i) {
var highestBuilding = 0;
let highestBuilding = 0;
for (let j in CM.Sim.Objects) {
if (CM.Sim.Objects[j].amount > 0) {
highestBuilding = CM.Sim.Objects[j];