Small naming fixes

This commit is contained in:
Daniël van Noord
2021-02-19 20:59:29 +01:00
parent 1e92ff6b92
commit d3aa2c30db
3 changed files with 41 additions and 40 deletions

File diff suppressed because one or more lines are too long

View File

@@ -15,13 +15,14 @@ CM.Cache.InitCache = function() {
CM.Cache.CacheDragonAuras(); CM.Cache.CacheDragonAuras();
CM.Cache.CacheWrinklers(); CM.Cache.CacheWrinklers();
CM.Cache.CacheStats(); CM.Cache.CacheStats();
CM.Cache.RemakeGoldenAndWrathCookiesMults(); CM.Cache.CacheGoldenAndWrathCookiesMults();
CM.Cache.RemakeChain(); CM.Cache.CacheChain();
CM.Cache.CacheMissingUpgrades(); CM.Cache.CacheMissingUpgrades();
CM.Cache.RemakeSeaSpec(); CM.Cache.CacheSeaSpec();
CM.Cache.RemakeIncome(); CM.Cache.CacheAvgCPS();
CM.Cache.RemakeBuildingsPrices(); CM.Cache.CacheIncome();
CM.Cache.RemakePP(); CM.Cache.CacheBuildingsPrices();
CM.Cache.CachePP();
}; };
/******** /********
@@ -53,7 +54,7 @@ CM.Cache.CacheWrinklers = function() {
CM.Cache.WrinklersTotal = 0; CM.Cache.WrinklersTotal = 0;
CM.Cache.WrinklersNormal = 0; CM.Cache.WrinklersNormal = 0;
CM.Cache.WrinklersFattest = [0, null]; CM.Cache.WrinklersFattest = [0, null];
for (let i; i < Game.wrinklers.length; i++) { for (let i = 0; i < Game.wrinklers.length; i++) {
var sucked = Game.wrinklers[i].sucked; var sucked = Game.wrinklers[i].sucked;
var toSuck = 1.1; var toSuck = 1.1;
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05; if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
@@ -124,13 +125,13 @@ CM.Cache.CacheStats = function() {
/** /**
* This functions calculates the multipliers of Golden and Wrath cookie rewards * This functions calculates the multipliers of Golden and Wrath cookie rewards
* It is mostly used by CM.Cache.MaxChainMoni() and CM.Cache.RemakeChain() * It is mostly used by CM.Cache.MaxChainMoni() and CM.Cache.CacheChain()
* It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.RemakeChain() * It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.CacheChain()
* @param {number} CM.Cache.GoldenCookiesMult Multiplier for golden cookies * @param {number} CM.Cache.GoldenCookiesMult Multiplier for golden cookies
* @param {number} CM.Cache.WrathCookiesMult Multiplier for wrath cookies * @param {number} CM.Cache.WrathCookiesMult Multiplier for wrath cookies
* @param {number} CM.Cache.DragonsFortuneMultAdjustment Multiplier for dragon fortune + active golden cookie * @param {number} CM.Cache.DragonsFortuneMultAdjustment Multiplier for dragon fortune + active golden cookie
*/ */
CM.Cache.RemakeGoldenAndWrathCookiesMults = function() { CM.Cache.CacheGoldenAndWrathCookiesMults = function() {
if (CM.Footer.isInitzializing) { if (CM.Footer.isInitzializing) {
CM.Cache.GoldenCookiesMult = 1; CM.Cache.GoldenCookiesMult = 1;
CM.Cache.WrathCookiesMult = 1; CM.Cache.WrathCookiesMult = 1;
@@ -166,7 +167,7 @@ CM.Cache.RemakeGoldenAndWrathCookiesMults = function() {
/** /**
* This functions calculates the max possible payout * This functions calculates the max possible payout
* It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.RemakeChain() * It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.CacheChain()
* @param {number} digit Number of Golden Cookies in chain * @param {number} digit Number of Golden Cookies in chain
* @param {number} maxPayout Maximum payout * @param {number} maxPayout Maximum payout
* @param {number} mult Multiplier * @param {number} mult Multiplier
@@ -203,7 +204,7 @@ CM.Cache.MaxChainMoni = function(digit, maxPayout, mult) {
* @global {number} CM.Cache.ChainFrenzyWrathRequired Cookies needed for maximum reward for wrath frenzy chain * @global {number} CM.Cache.ChainFrenzyWrathRequired Cookies needed for maximum reward for wrath frenzy chain
* @global {number} CM.Cache.ChainFrenzyWrathRequiredNext Total cookies needed for next level for wrath frenzy chain * @global {number} CM.Cache.ChainFrenzyWrathRequiredNext Total cookies needed for next level for wrath frenzy chain
*/ */
CM.Cache.RemakeChain = function() { CM.Cache.CacheChain = function() {
let maxPayout = CM.Cache.NoGoldSwitchCookiesPS * 60 * 60 * 6 * CM.Cache.DragonsFortuneMultAdjustment; let maxPayout = CM.Cache.NoGoldSwitchCookiesPS * 60 * 60 * 6 * CM.Cache.DragonsFortuneMultAdjustment;
// Removes effect of Frenzy etc. // Removes effect of Frenzy etc.
let cpsBuffMult = CM.Sim.getCPSBuffMult(); let cpsBuffMult = CM.Sim.getCPSBuffMult();
@@ -270,7 +271,7 @@ CM.Cache.CacheMissingUpgrades = function() {
* It is called by CM.Loop() and CM.Cache.InitCache() * It is called by CM.Loop() and CM.Cache.InitCache()
* @global {number} CM.Cache.SeaSpec The reward for popping a reindeer * @global {number} CM.Cache.SeaSpec The reward for popping a reindeer
*/ */
CM.Cache.RemakeSeaSpec = function() { CM.Cache.CacheSeaSpec = function() {
if (Game.season === 'christmas') { if (Game.season === 'christmas') {
var val = Game.cookiesPs * 60; var val = Game.cookiesPs * 60;
if (Game.hasBuff('Elder frenzy')) val *= 0.5; if (Game.hasBuff('Elder frenzy')) val *= 0.5;
@@ -316,7 +317,7 @@ class CMAvgQueue {
} }
/** /**
* This functions caches creates the CMAvgQueue used by CM.Cache.UpdateAvgCPS() to calculate CPS * This functions caches creates the CMAvgQueue used by CM.Cache.CacheAvgCPS() to calculate CPS
* Called by CM.DelayInit() * Called by CM.DelayInit()
*/ */
CM.Cache.InitCookiesDiff = function() { CM.Cache.InitCookiesDiff = function() {
@@ -336,7 +337,7 @@ CM.Cache.InitCookiesDiff = function() {
* @global {number} CM.Cache.AverageClicks Average cookies from clicking over time-period as defined by AvgClicksHist * @global {number} CM.Cache.AverageClicks Average cookies from clicking over time-period as defined by AvgClicksHist
* @global {number} CM.Cache.AvgCPSChoEgg Average cookies from combination of normal CPS and average Chocolate Cookie CPS * @global {number} CM.Cache.AvgCPSChoEgg Average cookies from combination of normal CPS and average Chocolate Cookie CPS
*/ */
CM.Cache.UpdateAvgCPS = function() { CM.Cache.CacheAvgCPS = function() {
var currDate = Math.floor(Date.now() / 1000); var currDate = Math.floor(Date.now() / 1000);
// Only calculate every new second // Only calculate every new second
if ((Game.T / Game.fps) % 1 === 0) { if ((Game.T / Game.fps) % 1 === 0) {
@@ -396,7 +397,7 @@ CM.Cache.UpdateAvgCPS = function() {
* It is called by CM.Loop() * It is called by CM.Loop()
* @global {number} CM.Cache.SellForChoEgg Total cookies to be gained from selling Chocolate egg * @global {number} CM.Cache.SellForChoEgg Total cookies to be gained from selling Chocolate egg
*/ */
CM.Cache.RemakeSellForChoEgg = function() { CM.Cache.CacheSellForChoEgg = function() {
var sellTotal = 0; var sellTotal = 0;
// Compute cookies earned by selling stock market goods // Compute cookies earned by selling stock market goods
if (Game.Objects.Bank.minigameLoaded) { if (Game.Objects.Bank.minigameLoaded) {
@@ -419,7 +420,7 @@ CM.Cache.RemakeSellForChoEgg = function() {
* @global {number} CM.Cache.CurrWrinklerCount Current number of wrinklers * @global {number} CM.Cache.CurrWrinklerCount Current number of wrinklers
* @global {number} CM.Cache.CurrWrinklerCPSMult Current multiplier of CPS because of wrinklers (excluding their negative sucking effect) * @global {number} CM.Cache.CurrWrinklerCPSMult Current multiplier of CPS because of wrinklers (excluding their negative sucking effect)
*/ */
CM.Cache.UpdateCurrWrinklerCPS = function() { CM.Cache.CacheCurrWrinklerCPS = function() {
CM.Cache.CurrWrinklerCPSMult = 0; CM.Cache.CurrWrinklerCPSMult = 0;
let count = 0; let count = 0;
for (let i in Game.wrinklers) { for (let i in Game.wrinklers) {
@@ -501,7 +502,7 @@ CM.Cache.CacheDragonCost = function() {
* This functions caches the income gain of each building and upgrade and stores it in the cache * This functions caches the income gain of each building and upgrade and stores it in the cache
* It is called by CM.Loop() and CM.Cache.InitCache() * It is called by CM.Loop() and CM.Cache.InitCache()
*/ */
CM.Cache.RemakeIncome = function() { CM.Cache.CacheIncome = function() {
// Simulate Building Buys for 1, 10 and 100 amount // Simulate Building Buys for 1, 10 and 100 amount
CM.Sim.BuyBuildings(1, 'Objects1'); CM.Sim.BuyBuildings(1, 'Objects1');
CM.Sim.BuyBuildings(10, 'Objects10'); CM.Sim.BuyBuildings(10, 'Objects10');
@@ -518,7 +519,7 @@ CM.Cache.RemakeIncome = function() {
* This functions caches the price of each building and stores it in the cache * This functions caches the price of each building and stores it in the cache
* It is called by CM.Loop() and CM.Cache.InitCache() * It is called by CM.Loop() and CM.Cache.InitCache()
*/ */
CM.Cache.RemakeBuildingsPrices = function() { CM.Cache.CacheBuildingsPrices = function() {
for (let i of Object.keys(Game.Objects)) { for (let i of Object.keys(Game.Objects)) {
CM.Cache.Objects1[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 1); CM.Cache.Objects1[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 1);
CM.Cache.Objects10[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 10); CM.Cache.Objects10[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 10);
@@ -533,16 +534,16 @@ CM.Cache.RemakeBuildingsPrices = function() {
* This functions caches the PP of each building and upgrade and stores it in the cache * This functions caches the PP of each building and upgrade and stores it in the cache
* It is called by CM.Loop() and CM.Cache.InitCache() * It is called by CM.Loop() and CM.Cache.InitCache()
*/ */
CM.Cache.RemakePP = function() { CM.Cache.CachePP = function() {
CM.Cache.RemakeBuildingsPP(); CM.Cache.CacheBuildingsPP();
CM.Cache.RemakeUpgradePP(); CM.Cache.CacheUpgradePP();
}; };
/** /**
* This functions caches the PP of each building it saves all date in CM.Cache.Objects... * This functions caches the PP of each building it saves all date in CM.Cache.Objects...
* It is called by CM.Cache.RemakePP() * It is called by CM.Cache.CachePP()
*/ */
CM.Cache.RemakeBuildingsPP = function() { CM.Cache.CacheBuildingsPP = 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;
@@ -565,8 +566,8 @@ CM.Cache.RemakeBuildingsPP = function() {
CM.Cache.Objects1[i].color = color; CM.Cache.Objects1[i].color = color;
} }
// Calculate PP of bulk-buy modes // Calculate PP of bulk-buy modes
CM.Cache.RemakeBuildingsBulkPP('Objects10'); CM.Cache.CacheBuildingsBulkPP('Objects10');
CM.Cache.RemakeBuildingsBulkPP('Objects100'); CM.Cache.CacheBuildingsBulkPP('Objects100');
} }
// Calculate PP and colors when compared to purchase of selected bulk mode // Calculate PP and colors when compared to purchase of selected bulk mode
else { else {
@@ -593,9 +594,9 @@ CM.Cache.RemakeBuildingsPP = function() {
/** /**
* This functions caches the buildings of bulk-buy mode when PP is compared against optimal single-purchase building * This functions caches the buildings of bulk-buy mode when PP is compared against optimal single-purchase building
* It saves all date in CM.Cache.Objects... * It saves all date in CM.Cache.Objects...
* It is called by CM.Cache.RemakeBuildingsPP() * It is called by CM.Cache.CacheBuildingsPP()
*/ */
CM.Cache.RemakeBuildingsBulkPP = function(target) { CM.Cache.CacheBuildingsBulkPP = function(target) {
for (let i of Object.keys(CM.Cache[target])) { for (let i of Object.keys(CM.Cache[target])) {
if (Game.cookiesPs) { if (Game.cookiesPs) {
CM.Cache[target][i].pp = (Math.max(CM.Cache[target][i].price - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (CM.Cache[target][i].price / CM.Cache[target][i].bonus); CM.Cache[target][i].pp = (Math.max(CM.Cache[target][i].price - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (CM.Cache[target][i].price / CM.Cache[target][i].bonus);
@@ -615,9 +616,9 @@ CM.Cache.RemakeBuildingsBulkPP = function(target) {
/** /**
* This functions caches the PP of each building it saves all date in CM.Cache.Upgrades * This functions caches the PP of each building it saves all date in CM.Cache.Upgrades
* It is called by CM.Cache.RemakePP() * It is called by CM.Cache.CachePP()
*/ */
CM.Cache.RemakeUpgradePP = function() { CM.Cache.CacheUpgradePP = function() {
for (let i of Object.keys(CM.Cache.Upgrades)) { for (let i of Object.keys(CM.Cache.Upgrades)) {
if (Game.cookiesPs) { if (Game.cookiesPs) {
CM.Cache.Upgrades[i].pp = (Math.max(Game.Upgrades[i].getPrice() - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus); CM.Cache.Upgrades[i].pp = (Math.max(Game.Upgrades[i].getPrice() - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus);

View File

@@ -145,17 +145,17 @@ CM.Loop = function() {
if (!Game.OnAscend && Game.AscendTimer === 0) { if (!Game.OnAscend && Game.AscendTimer === 0) {
// CM.Sim.DoSims is set whenever CPS has changed // CM.Sim.DoSims is set whenever CPS has changed
if (CM.Sim.DoSims) { if (CM.Sim.DoSims) {
CM.Cache.RemakeIncome(); CM.Cache.CacheIncome();
CM.Sim.NoGoldSwitchCookiesPS(); // Needed first CM.Sim.NoGoldSwitchCookiesPS(); // Needed first
CM.Cache.RemakeGoldenAndWrathCookiesMults(); CM.Cache.CacheGoldenAndWrathCookiesMults();
CM.Cache.CacheStats(); CM.Cache.CacheStats();
CM.Cache.CacheMissingUpgrades(); CM.Cache.CacheMissingUpgrades();
CM.Cache.RemakeChain(); CM.Cache.CacheChain();
CM.Cache.CacheDragonCost(); CM.Cache.CacheDragonCost();
CM.Cache.RemakeSeaSpec(); CM.Cache.CacheSeaSpec();
CM.Cache.RemakeSellForChoEgg(); CM.Cache.CacheSellForChoEgg();
CM.Sim.DoSims = 0; CM.Sim.DoSims = 0;
@@ -173,7 +173,7 @@ CM.Loop = function() {
} }
if (CM.Cache.DoRemakeBuildPrices) { if (CM.Cache.DoRemakeBuildPrices) {
CM.Cache.RemakeBuildingsPrices(); CM.Cache.CacheBuildingsPrices();
CM.Cache.DoRemakeBuildPrices = 0; CM.Cache.DoRemakeBuildPrices = 0;
} }
@@ -181,7 +181,7 @@ CM.Loop = function() {
CM.Cache.CacheWrinklers(); CM.Cache.CacheWrinklers();
// Calculate PP // Calculate PP
CM.Cache.RemakePP(); CM.Cache.CachePP();
} }
// Check all changing minigames and game-states // Check all changing minigames and game-states
@@ -193,8 +193,8 @@ CM.Loop = function() {
CM.Main.CheckWrinklerCount(); CM.Main.CheckWrinklerCount();
// Update Average CPS (might need to move) // Update Average CPS (might need to move)
CM.Cache.UpdateCurrWrinklerCPS(); CM.Cache.CacheCurrWrinklerCPS();
CM.Cache.UpdateAvgCPS(); CM.Cache.CacheAvgCPS();
}; };
CM.DelayInit = function() { CM.DelayInit = function() {