[Automated] Merge dev into gh-pages

This commit is contained in:
github-actions[bot]
2021-07-19 20:02:19 +00:00
committed by GitHub
7 changed files with 66 additions and 42 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,6 @@
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank'; import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
import { ColourGray } from '../../Disp/VariablesAndData'; import { ColourGray } from '../../Disp/VariablesAndData';
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
import { import {
CacheMinPP, // eslint-disable-line no-unused-vars CacheMinPP, // eslint-disable-line no-unused-vars
CacheMinPPBulk, // eslint-disable-line no-unused-vars CacheMinPPBulk, // eslint-disable-line no-unused-vars
@@ -25,7 +26,16 @@ function CacheColour(target, amount) {
return; return;
} }
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
target[i].color = ColourOfPP(target[i], Game.Objects[i].getSumPrice(amount)); target[i].color = ColourOfPP(
target[i],
BuildingGetPrice(
i,
Game.Objects[i].basePrice,
Game.Objects[i].amount,
Game.Objects[i].free,
amount,
),
);
// Colour based on excluding certain top-buildings // Colour based on excluding certain top-buildings
for ( for (
let j = 0; let j = 0;
@@ -39,7 +49,13 @@ function CacheColour(target, amount) {
function CachePP(target, amount) { function CachePP(target, amount) {
Object.keys(target).forEach((i) => { Object.keys(target).forEach((i) => {
const price = Game.Objects[i].getSumPrice(amount); const price = BuildingGetPrice(
i,
Game.Objects[i].basePrice,
Game.Objects[i].amount,
Game.Objects[i].free,
amount,
);
if (Game.cookiesPs) { if (Game.cookiesPs) {
target[i].pp = // eslint-disable-line no-param-reassign target[i].pp = // eslint-disable-line no-param-reassign
Math.max(price - (Game.cookies + GetWrinkConfigBank()), 0) / Game.cookiesPs + Math.max(price - (Game.cookies + GetWrinkConfigBank()), 0) / Game.cookiesPs +

View File

@@ -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];
}
} }
});
} }
/** /**
@@ -62,28 +65,28 @@ function CacheUpgradeIncome() {
export function CacheBuildingsPrices() { export function CacheBuildingsPrices() {
Object.keys(Game.Objects).forEach((i) => { Object.keys(Game.Objects).forEach((i) => {
CacheObjects1[i].price = BuildingGetPrice( CacheObjects1[i].price = BuildingGetPrice(
Game.Objects[i], i,
Game.Objects[i].basePrice, Game.Objects[i].basePrice,
Game.Objects[i].amount, Game.Objects[i].amount,
Game.Objects[i].free, Game.Objects[i].free,
1, 1,
); );
CacheObjects10[i].price = BuildingGetPrice( CacheObjects10[i].price = BuildingGetPrice(
Game.Objects[i], i,
Game.Objects[i].basePrice, Game.Objects[i].basePrice,
Game.Objects[i].amount, Game.Objects[i].amount,
Game.Objects[i].free, Game.Objects[i].free,
10, 10,
); );
CacheObjects100[i].price = BuildingGetPrice( CacheObjects100[i].price = BuildingGetPrice(
Game.Objects[i], i,
Game.Objects[i].basePrice, Game.Objects[i].basePrice,
Game.Objects[i].amount, Game.Objects[i].amount,
Game.Objects[i].free, Game.Objects[i].free,
100, 100,
); );
CacheObjectsNextAchievement[i].price = BuildingGetPrice( CacheObjectsNextAchievement[i].price = BuildingGetPrice(
Game.Objects[i], i,
Game.Objects[i].basePrice, Game.Objects[i].basePrice,
Game.Objects[i].amount, Game.Objects[i].amount,
Game.Objects[i].free, Game.Objects[i].free,

View File

@@ -1,3 +1,4 @@
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
import { CacheObjectsNextAchievement } from '../VariablesAndData'; import { CacheObjectsNextAchievement } from '../VariablesAndData';
import IndividualAmountTillNextAchievement from './IndividualAmountTillNextAchievement'; import IndividualAmountTillNextAchievement from './IndividualAmountTillNextAchievement';
@@ -17,7 +18,11 @@ export default function AllAmountTillNextAchievement(forceRecalc) {
result[i] = { result[i] = {
AmountNeeded: CacheObjectsNextAchievement[i].TotalNeeded - Game.Objects[i].amount, AmountNeeded: CacheObjectsNextAchievement[i].TotalNeeded - Game.Objects[i].amount,
TotalNeeded: CacheObjectsNextAchievement[i].TotalNeeded, TotalNeeded: CacheObjectsNextAchievement[i].TotalNeeded,
price: Game.Objects[i].getSumPrice( price: BuildingGetPrice(
i,
Game.Objects[i].basePrice,
Game.Objects[i].amount,
Game.Objects[i].free,
CacheObjectsNextAchievement[i].TotalNeeded - Game.Objects[i].amount, CacheObjectsNextAchievement[i].TotalNeeded - Game.Objects[i].amount,
), ),
}; };
@@ -26,7 +31,13 @@ export default function AllAmountTillNextAchievement(forceRecalc) {
result[i] = { result[i] = {
AmountNeeded: tillNext, AmountNeeded: tillNext,
TotalNeeded: Game.Objects[i].amount + tillNext, TotalNeeded: Game.Objects[i].amount + tillNext,
price: Game.Objects[i].getSumPrice(tillNext), price: BuildingGetPrice(
i,
Game.Objects[i].basePrice,
Game.Objects[i].amount,
Game.Objects[i].free,
tillNext,
),
}; };
} }
}); });

View File

@@ -20,16 +20,15 @@ export default function ReplaceAscendTooltip() {
); );
const startDate = Game.sayTime(((Date.now() - Game.startDate) / 1000) * Game.fps, -1); const startDate = Game.sayTime(((Date.now() - Game.startDate) / 1000) * Game.fps, -1);
let str = ''; let str = `You've been on this run for <b>${
str += `You've been on this run for <b>${
startDate === '' ? 'not very long' : startDate startDate === '' ? 'not very long' : startDate
}</b>.<br>`; }</b>.<br>
str += '<div class="line"></div>'; <div class="line"></div>`;
if (Game.prestige > 0) { if (Game.prestige > 0) {
str += `Your prestige level is currently <b>${Beautify(Game.prestige)}</b>.<br>(CpS +${Beautify( str += `Your prestige level is currently <b>${Beautify(Game.prestige)}</b>.<br>(CpS +${Beautify(
Game.prestige, Game.prestige,
)}%)`; )}%)
str += '<div class="line"></div>'; <div class="line"></div>`;
} }
if (CacheLastHeavenlyChips < 1) str += 'Ascending now would grant you no prestige.'; if (CacheLastHeavenlyChips < 1) str += 'Ascending now would grant you no prestige.';
else if (CacheLastHeavenlyChips < 2) else if (CacheLastHeavenlyChips < 2)
@@ -41,9 +40,9 @@ export default function ReplaceAscendTooltip() {
)} prestige levels</b> (+${Beautify(CacheLastHeavenlyChips)}% CpS)<br>and <b>${Beautify( )} prestige levels</b> (+${Beautify(CacheLastHeavenlyChips)}% CpS)<br>and <b>${Beautify(
CacheLastHeavenlyChips, CacheLastHeavenlyChips,
)} heavenly chips</b> to spend.`; )} heavenly chips</b> to spend.`;
str += '<div class="line"></div>'; str += `<div class="line"></div>
str += `You need <b>${Beautify(cookiesToNext)} more cookies</b> for the next level.<br>`; You need <b>${Beautify(cookiesToNext)} more cookies</b> for the next level.<br>
str += `${ ${
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipAscendButton Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipAscendButton
? `<div class='line'></div>It takes ${CacheTimeTillNextPrestige} to reach the next level and you were making ${Beautify( ? `<div class='line'></div>It takes ${CacheTimeTillNextPrestige} to reach the next level and you were making ${Beautify(
CacheHCPerSecond, CacheHCPerSecond,

View File

@@ -1,7 +1,5 @@
/** /**
* This function calculates the total price for buying "increase" of a building * This function calculates the total price for buying "increase" of a building
* Base Game does not currently allow this
* It is called by CM.Cache.CacheBuildingsPrices() and CM.Disp.Tooltip()
* @param {string} build Name of the building * @param {string} build Name of the building
* @param {number} basePrice Base Price of building * @param {number} basePrice Base Price of building
* @param {number} start Starting amount of building * @param {number} start Starting amount of building
@@ -10,14 +8,11 @@
* @returns {number} moni Total price * @returns {number} moni Total price
*/ */
export default function BuildingGetPrice(build, basePrice, start, free, increase) { export default function BuildingGetPrice(build, basePrice, start, free, increase) {
let startingAmount = start; let partialPrice = 0;
let moni = 0; for (let i = Math.max(0, start); i < Math.max(0, start + increase); i++) {
for (let i = 0; i < increase; i += 1) { partialPrice += Game.priceIncrease ** Math.max(0, i - free);
let price = basePrice * Game.priceIncrease ** Math.max(0, startingAmount - free);
price = Game.modifyBuildingPrice(build, price);
price = Math.ceil(price);
moni += price;
startingAmount += 1;
} }
return moni; let price = basePrice * partialPrice;
price = Game.modifyBuildingPrice(Game.Objects[build], price);
return Math.ceil(price);
} }