Button and stat for single fattest wrinkler (#177)

This commit is contained in:
Daniel van Noord
2020-12-19 18:26:38 +01:00
parent 389dae4daa
commit 0f865f3897
4 changed files with 66 additions and 56 deletions

View File

@@ -13,6 +13,7 @@
*/
CM.Cache.InitCache = function() {
CM.Cache.CacheDragonAuras();
CM.Cache.CacheWrinklers();
}
/********
@@ -20,10 +21,13 @@ CM.Cache.InitCache = function() {
/**
* This functions caches the currently selected Dragon Auras
* It is called by CM.Sim.CopyData() and CM.Sim.InitData()
* It is called by CM.Sim.CopyData() and CM.Cache.InitCache()
* Uncapitalized dragon follows Game-naming
* @global {number} CM.Cache.dragonAura The number of the first (right) Aura
* @global {number} CM.Cache.dragonAura2 The number of the second (left) Aura
*/
CM.Cache.CacheDragonAuras = function() {
/** @global */
CM.Cache.dragonAura = Game.dragonAura;
CM.Cache.dragonAura2 = Game.dragonAura2;
}
@@ -33,12 +37,15 @@ CM.Cache.CacheDragonAuras = function() {
/**
* This functions caches data related to Wrinklers
* It is called by CM.Loop()
* It is called by CM.Loop() and CM.Cache.InitCache()
* @global {number} CM.Cache.WrinklersTotal The cookies of all wrinklers
* @global {number} CM.Cache.WrinklersNormal The cookies of all normal wrinklers
* @global {[{number}, {number}]} CM.Cache.WrinklersFattest A list containing the cookies and the id of the fattest wrinkler
*/
CM.Cache.RemakeWrinkBank = function() {
CM.Cache.WrinkBankTotal = 0;
CM.Cache.WrinkBankNormal = 0;
var totalSucked = 0;
CM.Cache.CacheWrinklers = function() {
CM.Cache.WrinklersTotal = 0;
CM.Cache.WrinklersNormal = 0;
CM.Cache.WrinklersFattest = [0, null];
for (var i in Game.wrinklers) {
var sucked = Game.wrinklers[i].sucked;
var toSuck = 1.1;
@@ -52,19 +59,12 @@ CM.Cache.RemakeWrinkBank = function() {
else if (godLvl == 2) sucked *= 1.1;
else if (godLvl == 3) sucked *= 1.05;
}
CM.Cache.WrinkBankTotal += sucked;
if (Game.wrinklers[i].type == 0) CM.Cache.WrinkBankNormal += sucked;
}
CM.Cache.WrinkGodBank = CM.Cache.WrinkBankTotal;
if (CM.Sim.Objects.Temple.minigameLoaded) {
var godLvl = CM.Sim.hasGod('scorn');
if (godLvl == 2) CM.Cache.WrinkGodBank = CM.Cache.WrinkGodBank * 1.15 / 1.1;
else if (godLvl == 3) CM.Cache.WrinkGodBank = CM.Cache.WrinkGodBank * 1.15 / 1.05;
else if (godLvl != 1) CM.Cache.WrinkGodBank *= 1.15;
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];
}
}
/********
* Section: UNSORTED */
@@ -405,7 +405,7 @@ CM.Cache.UpdateAvgCPS = function() {
if (CM.Cache.lastDate != currDate) {
var choEggTotal = Game.cookies + CM.Cache.SellForChoEgg;
if (Game.cpsSucked > 0) {
choEggTotal += CM.Cache.WrinkGodBank;
choEggTotal += CM.Cache.WrinklersTotal;
}
CM.Cache.RealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal);
choEggTotal *= 0.05;
@@ -413,7 +413,7 @@ CM.Cache.UpdateAvgCPS = function() {
if (CM.Cache.lastDate != -1) {
var timeDiff = currDate - CM.Cache.lastDate
var bankDiffAvg = Math.max(0, (Game.cookies - CM.Cache.lastCookies)) / timeDiff;
var wrinkDiffAvg = Math.max(0, (CM.Cache.WrinkBankTotal - CM.Cache.lastWrinkCookies)) / timeDiff;
var wrinkDiffAvg = Math.max(0, (CM.Cache.WrinklersTotal - CM.Cache.lastWrinkCookies)) / timeDiff;
var choEggDiffAvg = Math.max(0,(choEggTotal - CM.Cache.lastChoEgg)) / timeDiff;
var clicksDiffAvg = (Game.cookieClicks - CM.Cache.lastClicks) / timeDiff;
for (var i = 0; i < timeDiff; i++) {
@@ -435,7 +435,7 @@ CM.Cache.UpdateAvgCPS = function() {
}
CM.Cache.lastDate = currDate;
CM.Cache.lastCookies = Game.cookies;
CM.Cache.lastWrinkCookies = CM.Cache.WrinkBankTotal;
CM.Cache.lastWrinkCookies = CM.Cache.WrinklersTotal;
CM.Cache.lastChoEgg = choEggTotal;
CM.Cache.lastClicks = Game.cookieClicks;
@@ -518,9 +518,6 @@ CM.Cache.CalcMissingUpgrades = function() {
CM.Cache.min = -1;
CM.Cache.max = -1;
CM.Cache.mid = -1;
CM.Cache.WrinkBankTotal = -1;
CM.Cache.WrinkBankNormal = -1;
CM.Cache.WrinkGodBank = -1;
CM.Cache.GoldenCookiesMult = 1;
CM.Cache.WrathCookiesMult = 1;
CM.Cache.DragonsFortuneMultAdjustment = 1;