Only iterate over UpgradesInStore
This commit is contained in:
@@ -38,22 +38,25 @@ function CacheBuildingIncome(amount) {
|
|||||||
* It is called by CM.Cache.CacheIncome()
|
* It is called by CM.Cache.CacheIncome()
|
||||||
*/
|
*/
|
||||||
function CacheUpgradeIncome() {
|
function CacheUpgradeIncome() {
|
||||||
CacheUpgrades = [];
|
CacheUpgrades = {};
|
||||||
Object.keys(Game.Upgrades).forEach((i) => {
|
for (let i = 0; i < Game.UpgradesInStore.length; i++) {
|
||||||
const bonusIncome = BuyUpgradesBonusIncome(i);
|
const upgradeName = Game.UpgradesInStore[i].name;
|
||||||
if (i === 'Elder Pledge') {
|
const bonusIncome = BuyUpgradesBonusIncome(upgradeName);
|
||||||
CacheUpgrades[i] = { bonus: Game.cookiesPs - CacheAverageGainBank };
|
if (upgradeName === 'Elder Pledge') {
|
||||||
|
CacheUpgrades[upgradeName] = {
|
||||||
|
bonus: Game.cookiesPs - CacheAverageGainBank,
|
||||||
|
};
|
||||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 1)
|
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 1)
|
||||||
CacheUpgrades[i].bonus -= CacheAverageGainWrink;
|
CacheUpgrades[upgradeName].bonus -= CacheAverageGainWrink;
|
||||||
else if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 2)
|
else if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 2)
|
||||||
CacheUpgrades[i].bonus -= CacheAverageGainWrinkFattest;
|
CacheUpgrades[upgradeName].bonus -= CacheAverageGainWrinkFattest;
|
||||||
if (!Number.isFinite(CacheUpgrades[i].bonus)) CacheUpgrades[i].bonus = 0;
|
if (!Number.isFinite(CacheUpgrades[upgradeName].bonus)) CacheUpgrades[upgradeName].bonus = 0;
|
||||||
} else {
|
} else {
|
||||||
CacheUpgrades[i] = {};
|
CacheUpgrades[upgradeName] = {};
|
||||||
if (bonusIncome[0]) CacheUpgrades[i].bonus = bonusIncome[0];
|
if (bonusIncome[0]) CacheUpgrades[upgradeName].bonus = bonusIncome[0];
|
||||||
if (bonusIncome[1]) CacheUpgrades[i].bonusMouse = bonusIncome[1];
|
if (bonusIncome[1]) CacheUpgrades[upgradeName].bonusMouse = bonusIncome[1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user