Complete overhaul of code structure and relevant files (#639)

This commit is contained in:
Daniël van Noord
2021-03-14 00:41:14 +01:00
committed by GitHub
parent bb34bce9a5
commit 1bffb58782
163 changed files with 7369 additions and 10882 deletions

18
src/Cache/PP/Upgrade.js Normal file
View File

@@ -0,0 +1,18 @@
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
import { CacheUpgrades } from '../VariablesAndData';
import ColourOfPP from './ColourOfPP';
/**
* This functions caches the PP of each building it saves all date in CM.Cache.Upgrades
* It is called by CM.Cache.CachePP()
*/
export default function CacheUpgradePP() {
for (const i of Object.keys(CacheUpgrades)) {
if (Game.cookiesPs) {
CacheUpgrades[i].pp = (Math.max(Game.Upgrades[i].getPrice() - (Game.cookies + GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus);
} else CacheUpgrades[i].pp = (Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus);
if (Number.isNaN(CacheUpgrades[i].pp)) CacheUpgrades[i].pp = Infinity;
CacheUpgrades[i].color = ColourOfPP(CacheUpgrades[i], Game.Upgrades[i].getPrice());
}
}