Merge pull request #459 from DanielNoord/wrinklers (#177, #245)

Added some functionality related to wrinklers
This commit is contained in:
DanielNoord
2020-12-19 18:34:48 +01:00
committed by GitHub
6 changed files with 162 additions and 114 deletions

View File

@@ -31,16 +31,69 @@ if (typeof CM == "undefined") {
* Cache * * Cache *
*********/ *********/
/********
* Section: General Cache related functions */
/**
* This functions runs all cache-functions to generate all "full" cache
* The declaration follows the structure of the CM.Cache.js file
* It is called by CM.DelayInit
* TODO: Add all functions that should be here and remove them from CM.Loop()
*/
CM.Cache.InitCache = function() {
CM.Cache.CacheDragonAuras();
CM.Cache.CacheWrinklers();
}
/********
* Section: Functions related to Dragon Auras */
/** /**
* This functions caches the currently selected Dragon Auras * 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 * 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() { CM.Cache.CacheDragonAuras = function() {
/** @global */
CM.Cache.dragonAura = Game.dragonAura; CM.Cache.dragonAura = Game.dragonAura;
CM.Cache.dragonAura2 = Game.dragonAura2; CM.Cache.dragonAura2 = Game.dragonAura2;
} }
/********
* Section: Functions related to Wrinklers */
/**
* This functions caches data related to Wrinklers
* 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.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;
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 = CM.Sim.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];
}
}
/******** /********
* Section: UNSORTED */ * Section: UNSORTED */
@@ -81,35 +134,6 @@ CM.Cache.RemakeIncome = function() {
CM.Sim.BuyBuildings(100, 'Objects100'); CM.Sim.BuyBuildings(100, 'Objects100');
} }
CM.Cache.RemakeWrinkBank = function() {
CM.Cache.WrinkBankTotal = 0;
CM.Cache.WrinkBankNormal = 0;
var totalSucked = 0;
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;
if (CM.Sim.Objects.Temple.minigameLoaded) {
var godLvl = CM.Sim.hasGod('scorn');
if (godLvl == 1) sucked *= 1.15;
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.RemakeBuildingsPP = function() { CM.Cache.RemakeBuildingsPP = function() {
CM.Cache.min = -1; CM.Cache.min = -1;
CM.Cache.max = -1; CM.Cache.max = -1;
@@ -410,7 +434,7 @@ CM.Cache.UpdateAvgCPS = function() {
if (CM.Cache.lastDate != currDate) { if (CM.Cache.lastDate != currDate) {
var choEggTotal = Game.cookies + CM.Cache.SellForChoEgg; var choEggTotal = Game.cookies + CM.Cache.SellForChoEgg;
if (Game.cpsSucked > 0) { if (Game.cpsSucked > 0) {
choEggTotal += CM.Cache.WrinkGodBank; choEggTotal += CM.Cache.WrinklersTotal;
} }
CM.Cache.RealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal); CM.Cache.RealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal);
choEggTotal *= 0.05; choEggTotal *= 0.05;
@@ -418,7 +442,7 @@ CM.Cache.UpdateAvgCPS = function() {
if (CM.Cache.lastDate != -1) { if (CM.Cache.lastDate != -1) {
var timeDiff = currDate - CM.Cache.lastDate var timeDiff = currDate - CM.Cache.lastDate
var bankDiffAvg = Math.max(0, (Game.cookies - CM.Cache.lastCookies)) / timeDiff; 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 choEggDiffAvg = Math.max(0,(choEggTotal - CM.Cache.lastChoEgg)) / timeDiff;
var clicksDiffAvg = (Game.cookieClicks - CM.Cache.lastClicks) / timeDiff; var clicksDiffAvg = (Game.cookieClicks - CM.Cache.lastClicks) / timeDiff;
for (var i = 0; i < timeDiff; i++) { for (var i = 0; i < timeDiff; i++) {
@@ -440,7 +464,7 @@ CM.Cache.UpdateAvgCPS = function() {
} }
CM.Cache.lastDate = currDate; CM.Cache.lastDate = currDate;
CM.Cache.lastCookies = Game.cookies; CM.Cache.lastCookies = Game.cookies;
CM.Cache.lastWrinkCookies = CM.Cache.WrinkBankTotal; CM.Cache.lastWrinkCookies = CM.Cache.WrinklersTotal;
CM.Cache.lastChoEgg = choEggTotal; CM.Cache.lastChoEgg = choEggTotal;
CM.Cache.lastClicks = Game.cookieClicks; CM.Cache.lastClicks = Game.cookieClicks;
@@ -482,7 +506,8 @@ CM.Cache.UpdateAvgCPS = function() {
totalGainWrink += sortedGainWrink[i]; totalGainWrink += sortedGainWrink[i];
totalGainChoEgg += sortedGainChoEgg[i]; totalGainChoEgg += sortedGainChoEgg[i];
} }
CM.Cache.AvgCPS = (totalGainBank + (CM.Options.CalcWrink ? totalGainWrink : 0)) / sortedGainBank.length; // TODO: Incorporate situation if CM.Options.CalcWrink == 2
CM.Cache.AvgCPS = (totalGainBank + (CM.Options.CalcWrink == 1 ? totalGainWrink : 0)) / sortedGainBank.length;
var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg'));
@@ -523,9 +548,6 @@ CM.Cache.CalcMissingUpgrades = function() {
CM.Cache.min = -1; CM.Cache.min = -1;
CM.Cache.max = -1; CM.Cache.max = -1;
CM.Cache.mid = -1; CM.Cache.mid = -1;
CM.Cache.WrinkBankTotal = -1;
CM.Cache.WrinkBankNormal = -1;
CM.Cache.WrinkGodBank = -1;
CM.Cache.GoldenCookiesMult = 1; CM.Cache.GoldenCookiesMult = 1;
CM.Cache.WrathCookiesMult = 1; CM.Cache.WrathCookiesMult = 1;
CM.Cache.DragonsFortuneMultAdjustment = 1; CM.Cache.DragonsFortuneMultAdjustment = 1;
@@ -573,12 +595,6 @@ CM.Cache.seasonPopShimmer;
CM.Cache.goldenShimmersByID = {}; CM.Cache.goldenShimmersByID = {};
CM.Cache.spawnedGoldenShimmer = 0; CM.Cache.spawnedGoldenShimmer = 0;
/**
* This variables are used by CM.Cache.CacheDragonAuras(), naming follows naming in Game
*/
CM.Cache.dragonAura = 0;
CM.Cache.dragonAura2 = 0;
/********** /**********
* Config * * Config *
**********/ **********/
@@ -854,7 +870,7 @@ CM.ConfigData.Colors = { type: 'color', group: 'BarsColors',
CM.ConfigData.UpgradeBarFixedPos = {type: 'bool', group: 'BarsColors', 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.UpgradeBarFixedPos = {type: 'bool', group: 'BarsColors', 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();}};
// Calculation // Calculation
CM.ConfigData.CalcWrink = {type: 'bool', group: 'Calculation', label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON'], desc: 'Calculate times and average Cookies Per Second with Wrinklers', toggle: true}; CM.ConfigData.CalcWrink = {type: 'bool', group: 'Calculation', label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON', 'Calculate with Single Fattest Wrinkler ON'], desc: 'Calculate times and average Cookies Per Second with (only the single fattest) Wrinklers', toggle: true};
CM.ConfigData.CPSMode = {type: 'bool', group: 'Calculation', 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.CPSMode = {type: 'bool', group: 'Calculation', 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 = {type: 'bool', group: 'Calculation', 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}; CM.ConfigData.AvgCPSHist = {type: 'bool', group: 'Calculation', 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};
CM.ConfigData.AvgClicksHist = {type: 'bool', group: 'Calculation', label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false}; CM.ConfigData.AvgClicksHist = {type: 'bool', group: 'Calculation', label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false};
@@ -1039,14 +1055,16 @@ CM.Data.ConfigDefault = {
/** /**
* This function returns the total amount stored in the Wrinkler Bank * This function returns the total amount stored in the Wrinkler Bank
* as calculated by CM.Cache.RemakeWrinkBank() if CM.Options.CalcWrink is set * as calculated by CM.Cache.CacheWrinklers() if CM.Options.CalcWrink is set
* @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinkBankTotal) * @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinklersTotal)
*/ */
CM.Disp.GetWrinkConfigBank = function() { CM.Disp.GetWrinkConfigBank = function() {
if (CM.Options.CalcWrink) if (CM.Options.CalcWrink == 1) {
return CM.Cache.WrinkBankTotal; return CM.Cache.WrinklersTotal;}
else else if (CM.Options.CalcWrink == 2) {
return 0; return CM.Cache.WrinklersFattest[0];}
else {
return 0;}
} }
/** /**
@@ -3146,13 +3164,21 @@ CM.Disp.AddMenuStats = function(title) {
stats.appendChild(CM.Disp.CreateStatsHeader('Wrinklers', 'Wrink')); stats.appendChild(CM.Disp.CreateStatsHeader('Wrinklers', 'Wrink'));
if (CM.Options.Header.Wrink) { if (CM.Options.Header.Wrink) {
var popAllFrag = document.createDocumentFragment(); var popAllFrag = document.createDocumentFragment();
popAllFrag.appendChild(document.createTextNode(Beautify(CM.Cache.WrinkBankTotal) + ' / ' + Beautify(CM.Cache.WrinkBankNormal) + ' ')); popAllFrag.appendChild(document.createTextNode(Beautify(CM.Cache.WrinklersTotal) + ' / ' + Beautify(CM.Cache.WrinklersNormal) + ' '));
var popAllA = document.createElement('a'); var popAllA = document.createElement('a');
popAllA.textContent = 'Pop All Normal'; popAllA.textContent = 'Pop All Normal';
popAllA.className = 'option'; popAllA.className = 'option';
popAllA.onclick = function() { CM.Disp.PopAllNormalWrinklers(); }; popAllA.onclick = function() { CM.Disp.PopAllNormalWrinklers(); };
popAllFrag.appendChild(popAllA); popAllFrag.appendChild(popAllA);
stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping (All/Normal)', popAllFrag)); stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping (All/Normal)', popAllFrag));
var popFattestFrag = document.createDocumentFragment();
popFattestFrag.appendChild(document.createTextNode(Beautify(CM.Cache.WrinklersFattest[0]) + ' '));
var popFattestA = document.createElement('a');
popFattestA.textContent = 'Pop single fattest';
popFattestA.className = 'option';
popFattestA.onclick = function() { Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; };
popFattestFrag.appendChild(popFattestA);
stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping Single Fattest Wrinkler (id: ' + CM.Cache.WrinklersFattest[1] + ")", popFattestFrag));
} }
} }
@@ -3557,11 +3583,11 @@ CM.Disp.CreateStatsPrestigeSection = function() {
section.className = 'CMStatsPrestigeSection'; section.className = 'CMStatsPrestigeSection';
var possiblePresMax = Math.floor(Game.HowMuchPrestige(CM.Cache.RealCookiesEarned + var possiblePresMax = Math.floor(Game.HowMuchPrestige(CM.Cache.RealCookiesEarned +
Game.cookiesReset + CM.Cache.WrinkGodBank + Game.cookiesReset + CM.Cache.WrinklersTotal +
(Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CM.Cache.lastChoEgg : 0))); (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CM.Cache.lastChoEgg : 0)));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", 'Prestige Level (CUR / MAX)', document.createTextNode(Beautify(Game.prestige) + ' / ' + Beautify(possiblePresMax)), 'PrestMaxTooltipPlaceholder')); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", 'Prestige Level (CUR / MAX)', document.createTextNode(Beautify(Game.prestige) + ' / ' + Beautify(possiblePresMax)), 'PrestMaxTooltipPlaceholder'));
var neededCook = Game.HowManyCookiesReset(possiblePresMax + 1) - (CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinkGodBank + ((Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CM.Cache.lastChoEgg : 0) ? CM.Cache.lastChoEgg : 0)); var neededCook = Game.HowManyCookiesReset(possiblePresMax + 1) - (CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinklersTotal + ((Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CM.Cache.lastChoEgg : 0) ? CM.Cache.lastChoEgg : 0));
var cookiesNextFrag = document.createDocumentFragment(); var cookiesNextFrag = document.createDocumentFragment();
cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook))); cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook)));
var cookiesNextSmall = document.createElement('small'); var cookiesNextSmall = document.createElement('small');
@@ -3941,7 +3967,7 @@ CM.Loop = function() {
} }
// Update Wrinkler Bank // Update Wrinkler Bank
CM.Cache.RemakeWrinkBank(); CM.Cache.CacheWrinklers();
// Calculate PP // Calculate PP
CM.Cache.RemakePP(); CM.Cache.RemakePP();
@@ -3999,6 +4025,7 @@ CM.Init = function() {
CM.DelayInit = function() { CM.DelayInit = function() {
CM.Sim.InitData(); CM.Sim.InitData();
CM.Cache.InitCache();
CM.Disp.CreateCssArea(); CM.Disp.CreateCssArea();
CM.Disp.CreateBotBar(); CM.Disp.CreateBotBar();
CM.Disp.CreateTimerBar(); CM.Disp.CreateTimerBar();
@@ -4468,9 +4495,6 @@ CM.Sim.InitData = function() {
for (var i in Game.Achievements) { for (var i in Game.Achievements) {
CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i); CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i);
} }
// Auras
CM.Cache.CacheDragonAuras();
} }
CM.Sim.CopyData = function() { CM.Sim.CopyData = function() {

View File

@@ -2,16 +2,69 @@
* Cache * * Cache *
*********/ *********/
/********
* Section: General Cache related functions */
/**
* This functions runs all cache-functions to generate all "full" cache
* The declaration follows the structure of the CM.Cache.js file
* It is called by CM.DelayInit
* TODO: Add all functions that should be here and remove them from CM.Loop()
*/
CM.Cache.InitCache = function() {
CM.Cache.CacheDragonAuras();
CM.Cache.CacheWrinklers();
}
/********
* Section: Functions related to Dragon Auras */
/** /**
* This functions caches the currently selected Dragon Auras * 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 * 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() { CM.Cache.CacheDragonAuras = function() {
/** @global */
CM.Cache.dragonAura = Game.dragonAura; CM.Cache.dragonAura = Game.dragonAura;
CM.Cache.dragonAura2 = Game.dragonAura2; CM.Cache.dragonAura2 = Game.dragonAura2;
} }
/********
* Section: Functions related to Wrinklers */
/**
* This functions caches data related to Wrinklers
* 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.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;
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 = CM.Sim.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];
}
}
/******** /********
* Section: UNSORTED */ * Section: UNSORTED */
@@ -52,35 +105,6 @@ CM.Cache.RemakeIncome = function() {
CM.Sim.BuyBuildings(100, 'Objects100'); CM.Sim.BuyBuildings(100, 'Objects100');
} }
CM.Cache.RemakeWrinkBank = function() {
CM.Cache.WrinkBankTotal = 0;
CM.Cache.WrinkBankNormal = 0;
var totalSucked = 0;
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;
if (CM.Sim.Objects.Temple.minigameLoaded) {
var godLvl = CM.Sim.hasGod('scorn');
if (godLvl == 1) sucked *= 1.15;
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.RemakeBuildingsPP = function() { CM.Cache.RemakeBuildingsPP = function() {
CM.Cache.min = -1; CM.Cache.min = -1;
CM.Cache.max = -1; CM.Cache.max = -1;
@@ -381,7 +405,7 @@ CM.Cache.UpdateAvgCPS = function() {
if (CM.Cache.lastDate != currDate) { if (CM.Cache.lastDate != currDate) {
var choEggTotal = Game.cookies + CM.Cache.SellForChoEgg; var choEggTotal = Game.cookies + CM.Cache.SellForChoEgg;
if (Game.cpsSucked > 0) { if (Game.cpsSucked > 0) {
choEggTotal += CM.Cache.WrinkGodBank; choEggTotal += CM.Cache.WrinklersTotal;
} }
CM.Cache.RealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal); CM.Cache.RealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal);
choEggTotal *= 0.05; choEggTotal *= 0.05;
@@ -389,7 +413,7 @@ CM.Cache.UpdateAvgCPS = function() {
if (CM.Cache.lastDate != -1) { if (CM.Cache.lastDate != -1) {
var timeDiff = currDate - CM.Cache.lastDate var timeDiff = currDate - CM.Cache.lastDate
var bankDiffAvg = Math.max(0, (Game.cookies - CM.Cache.lastCookies)) / timeDiff; 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 choEggDiffAvg = Math.max(0,(choEggTotal - CM.Cache.lastChoEgg)) / timeDiff;
var clicksDiffAvg = (Game.cookieClicks - CM.Cache.lastClicks) / timeDiff; var clicksDiffAvg = (Game.cookieClicks - CM.Cache.lastClicks) / timeDiff;
for (var i = 0; i < timeDiff; i++) { for (var i = 0; i < timeDiff; i++) {
@@ -411,7 +435,7 @@ CM.Cache.UpdateAvgCPS = function() {
} }
CM.Cache.lastDate = currDate; CM.Cache.lastDate = currDate;
CM.Cache.lastCookies = Game.cookies; CM.Cache.lastCookies = Game.cookies;
CM.Cache.lastWrinkCookies = CM.Cache.WrinkBankTotal; CM.Cache.lastWrinkCookies = CM.Cache.WrinklersTotal;
CM.Cache.lastChoEgg = choEggTotal; CM.Cache.lastChoEgg = choEggTotal;
CM.Cache.lastClicks = Game.cookieClicks; CM.Cache.lastClicks = Game.cookieClicks;
@@ -453,7 +477,8 @@ CM.Cache.UpdateAvgCPS = function() {
totalGainWrink += sortedGainWrink[i]; totalGainWrink += sortedGainWrink[i];
totalGainChoEgg += sortedGainChoEgg[i]; totalGainChoEgg += sortedGainChoEgg[i];
} }
CM.Cache.AvgCPS = (totalGainBank + (CM.Options.CalcWrink ? totalGainWrink : 0)) / sortedGainBank.length; // TODO: Incorporate situation if CM.Options.CalcWrink == 2
CM.Cache.AvgCPS = (totalGainBank + (CM.Options.CalcWrink == 1 ? totalGainWrink : 0)) / sortedGainBank.length;
var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg'));
@@ -494,9 +519,6 @@ CM.Cache.CalcMissingUpgrades = function() {
CM.Cache.min = -1; CM.Cache.min = -1;
CM.Cache.max = -1; CM.Cache.max = -1;
CM.Cache.mid = -1; CM.Cache.mid = -1;
CM.Cache.WrinkBankTotal = -1;
CM.Cache.WrinkBankNormal = -1;
CM.Cache.WrinkGodBank = -1;
CM.Cache.GoldenCookiesMult = 1; CM.Cache.GoldenCookiesMult = 1;
CM.Cache.WrathCookiesMult = 1; CM.Cache.WrathCookiesMult = 1;
CM.Cache.DragonsFortuneMultAdjustment = 1; CM.Cache.DragonsFortuneMultAdjustment = 1;
@@ -544,9 +566,3 @@ CM.Cache.seasonPopShimmer;
CM.Cache.goldenShimmersByID = {}; CM.Cache.goldenShimmersByID = {};
CM.Cache.spawnedGoldenShimmer = 0; CM.Cache.spawnedGoldenShimmer = 0;
/**
* This variables are used by CM.Cache.CacheDragonAuras(), naming follows naming in Game
*/
CM.Cache.dragonAura = 0;
CM.Cache.dragonAura2 = 0;

View File

@@ -103,7 +103,7 @@ CM.ConfigData.Colors = { type: 'color', group: 'BarsColors',
CM.ConfigData.UpgradeBarFixedPos = {type: 'bool', group: 'BarsColors', 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.UpgradeBarFixedPos = {type: 'bool', group: 'BarsColors', 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();}};
// Calculation // Calculation
CM.ConfigData.CalcWrink = {type: 'bool', group: 'Calculation', label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON'], desc: 'Calculate times and average Cookies Per Second with Wrinklers', toggle: true}; CM.ConfigData.CalcWrink = {type: 'bool', group: 'Calculation', label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON', 'Calculate with Single Fattest Wrinkler ON'], desc: 'Calculate times and average Cookies Per Second with (only the single fattest) Wrinklers', toggle: true};
CM.ConfigData.CPSMode = {type: 'bool', group: 'Calculation', 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.CPSMode = {type: 'bool', group: 'Calculation', 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 = {type: 'bool', group: 'Calculation', 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}; CM.ConfigData.AvgCPSHist = {type: 'bool', group: 'Calculation', 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};
CM.ConfigData.AvgClicksHist = {type: 'bool', group: 'Calculation', label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false}; CM.ConfigData.AvgClicksHist = {type: 'bool', group: 'Calculation', label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false};

View File

@@ -12,14 +12,16 @@
/** /**
* This function returns the total amount stored in the Wrinkler Bank * This function returns the total amount stored in the Wrinkler Bank
* as calculated by CM.Cache.RemakeWrinkBank() if CM.Options.CalcWrink is set * as calculated by CM.Cache.CacheWrinklers() if CM.Options.CalcWrink is set
* @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinkBankTotal) * @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinklersTotal)
*/ */
CM.Disp.GetWrinkConfigBank = function() { CM.Disp.GetWrinkConfigBank = function() {
if (CM.Options.CalcWrink) if (CM.Options.CalcWrink == 1) {
return CM.Cache.WrinkBankTotal; return CM.Cache.WrinklersTotal;}
else else if (CM.Options.CalcWrink == 2) {
return 0; return CM.Cache.WrinklersFattest[0];}
else {
return 0;}
} }
/** /**
@@ -2119,13 +2121,21 @@ CM.Disp.AddMenuStats = function(title) {
stats.appendChild(CM.Disp.CreateStatsHeader('Wrinklers', 'Wrink')); stats.appendChild(CM.Disp.CreateStatsHeader('Wrinklers', 'Wrink'));
if (CM.Options.Header.Wrink) { if (CM.Options.Header.Wrink) {
var popAllFrag = document.createDocumentFragment(); var popAllFrag = document.createDocumentFragment();
popAllFrag.appendChild(document.createTextNode(Beautify(CM.Cache.WrinkBankTotal) + ' / ' + Beautify(CM.Cache.WrinkBankNormal) + ' ')); popAllFrag.appendChild(document.createTextNode(Beautify(CM.Cache.WrinklersTotal) + ' / ' + Beautify(CM.Cache.WrinklersNormal) + ' '));
var popAllA = document.createElement('a'); var popAllA = document.createElement('a');
popAllA.textContent = 'Pop All Normal'; popAllA.textContent = 'Pop All Normal';
popAllA.className = 'option'; popAllA.className = 'option';
popAllA.onclick = function() { CM.Disp.PopAllNormalWrinklers(); }; popAllA.onclick = function() { CM.Disp.PopAllNormalWrinklers(); };
popAllFrag.appendChild(popAllA); popAllFrag.appendChild(popAllA);
stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping (All/Normal)', popAllFrag)); stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping (All/Normal)', popAllFrag));
var popFattestFrag = document.createDocumentFragment();
popFattestFrag.appendChild(document.createTextNode(Beautify(CM.Cache.WrinklersFattest[0]) + ' '));
var popFattestA = document.createElement('a');
popFattestA.textContent = 'Pop single fattest';
popFattestA.className = 'option';
popFattestA.onclick = function() { Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; };
popFattestFrag.appendChild(popFattestA);
stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping Single Fattest Wrinkler (id: ' + CM.Cache.WrinklersFattest[1] + ")", popFattestFrag));
} }
} }
@@ -2530,11 +2540,11 @@ CM.Disp.CreateStatsPrestigeSection = function() {
section.className = 'CMStatsPrestigeSection'; section.className = 'CMStatsPrestigeSection';
var possiblePresMax = Math.floor(Game.HowMuchPrestige(CM.Cache.RealCookiesEarned + var possiblePresMax = Math.floor(Game.HowMuchPrestige(CM.Cache.RealCookiesEarned +
Game.cookiesReset + CM.Cache.WrinkGodBank + Game.cookiesReset + CM.Cache.WrinklersTotal +
(Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CM.Cache.lastChoEgg : 0))); (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CM.Cache.lastChoEgg : 0)));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", 'Prestige Level (CUR / MAX)', document.createTextNode(Beautify(Game.prestige) + ' / ' + Beautify(possiblePresMax)), 'PrestMaxTooltipPlaceholder')); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", 'Prestige Level (CUR / MAX)', document.createTextNode(Beautify(Game.prestige) + ' / ' + Beautify(possiblePresMax)), 'PrestMaxTooltipPlaceholder'));
var neededCook = Game.HowManyCookiesReset(possiblePresMax + 1) - (CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinkGodBank + ((Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CM.Cache.lastChoEgg : 0) ? CM.Cache.lastChoEgg : 0)); var neededCook = Game.HowManyCookiesReset(possiblePresMax + 1) - (CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinklersTotal + ((Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CM.Cache.lastChoEgg : 0) ? CM.Cache.lastChoEgg : 0));
var cookiesNextFrag = document.createDocumentFragment(); var cookiesNextFrag = document.createDocumentFragment();
cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook))); cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook)));
var cookiesNextSmall = document.createElement('small'); var cookiesNextSmall = document.createElement('small');

View File

@@ -171,7 +171,7 @@ CM.Loop = function() {
} }
// Update Wrinkler Bank // Update Wrinkler Bank
CM.Cache.RemakeWrinkBank(); CM.Cache.CacheWrinklers();
// Calculate PP // Calculate PP
CM.Cache.RemakePP(); CM.Cache.RemakePP();
@@ -229,6 +229,7 @@ CM.Init = function() {
CM.DelayInit = function() { CM.DelayInit = function() {
CM.Sim.InitData(); CM.Sim.InitData();
CM.Cache.InitCache();
CM.Disp.CreateCssArea(); CM.Disp.CreateCssArea();
CM.Disp.CreateBotBar(); CM.Disp.CreateBotBar();
CM.Disp.CreateTimerBar(); CM.Disp.CreateTimerBar();

View File

@@ -207,9 +207,6 @@ CM.Sim.InitData = function() {
for (var i in Game.Achievements) { for (var i in Game.Achievements) {
CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i); CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i);
} }
// Auras
CM.Cache.CacheDragonAuras();
} }
CM.Sim.CopyData = function() { CM.Sim.CopyData = function() {