Fix BuildingGetPrice() and remove getSumPrice()
This commit is contained in:
6 files changed
+14055
-22
No files matched your search
Vendored
+14013
-2
File diff suppressed because it is too large.
Load diff
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"sources":["webpack:///./node_modules/@eastdesire/jscolor/jscolor.js","webpack:///webpack/bootstrap","webpack:///webpack/runtime/compat get default export","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/draw/drawLoop.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/saveDataFunctions/saveFramework.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/menuFunctions/toggleHeader.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/menuSections/addMenu.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/menuSections/info/addInfoMenuSection.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/menuSections/info/createFrameworkInfoMenuSection.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/data/modInfo.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/menuSections/options/addOptionsMenuSection.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/saveDataFunctions/loadMod.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/saveDataFunctions/createSaveDataObject.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/data/headers.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/data/settings.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/logic/logicLoop.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/cookieMonsterFramework.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/init.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/load.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/save.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/index.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/initFunctions/initModFramework.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/initFunctions/registerMod.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/menuFunctions/createInfoListing.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/menuFunctions/createModMenuSection.js","webpack:///./src/Config/Toggles/ToggleWrinklerButtons.js","webpack:///./src/Data/Scales.ts","webpack:///./src/Main/VariablesAndData.js","webpack:///./src/Disp/BeautifyAndFormatting/Beautify.js","webpack:///./src/Cache/VariablesAndData.js","webpack:///./src/Sim/VariablesAndData.js","webpack:///./src/Disp/VariablesAndData.js","webpack:///./src/Sim/ReplacedGameFunctions/SimAuraMult.js","webpack:///./src/Sim/ReplacedGameFunctions/SimGetSellMultiplier.js","webpack:///./src/Sim/ReplacedGameFunctions/SimEff.js","webpack:///./src/Sim/ReplacedGameFunctions/SimHas.js","webpack:///./src/Sim/ReplacedGameFunctions/SimHasGod.js","webpack:///./src/Sim/ReplacedGameFunctions/SimModifyBuidlingPrice.js","webpack:///./src/Sim/SimulationEvents/SellBuilding.js","webpack:///./src/Disp/BuildingsUpgrades/Buildings.js","webpack:///./src/Disp/BuildingsUpgrades/UpdateUpgradeSectionsHeight.js","webpack:///./src/Disp/BuildingsUpgrades/Upgrades.js","webpack:///./src/Disp/BeautifyAndFormatting/FormatTime.js","webpack:///./src/Disp/BeautifyAndFormatting/GetTimeColour.js","webpack:///./src/Disp/HelperFunctions/GetCPS.js","webpack:///./src/Disp/HelperFunctions/GetWrinkConfigBank.js","webpack:///./src/Disp/InfoBars/CreateDOMElements.js","webpack:///./src/Disp/InfoBars/BottomBar.js","webpack:///./src/Disp/HelperFunctions/UpdateBackground.js","webpack:///./src/Config/SpecificToggles.js","webpack:///./src/Cache/Dragon/CacheDragonAuras.js","webpack:///./src/Sim/InitializeData/InitAchievement.js","webpack:///./src/Sim/ReplacedGameFunctions/SimGetTieredCpsMult.js","webpack:///./src/Sim/InitializeData/InitialBuildingData.js","webpack:///./src/Sim/InitializeData/InitUpgrade.js","webpack:///./src/Sim/SimulationData/CopyData.js","webpack:///./src/Disp/Tooltips/CreateTooltip.js","webpack:///./src/Cache/PP/ColourOfPP.js","webpack:///./src/Cache/CPS/GetCPSBuffMult.js","webpack:///./src/Sim/SimulationData/SimWin.js","webpack:///./src/Sim/Calculations/CalculateGains.js","webpack:///./src/Sim/ReplacedGameFunctions/SimGetHeavenlyMultiplier.js","webpack:///./src/Data/Gamedata.ts","webpack:///./src/Sim/ReplacedGameFunctions/SimHasAchiev.js","webpack:///./src/Sim/Calculations/CheckOtherAchiev.js","webpack:///./src/Sim/SimulationEvents/BuyBuildingBonusIncome.js","webpack:/Line truncated
|
{"version":3,"sources":["webpack:///./node_modules/@eastdesire/jscolor/jscolor.js","webpack:///webpack/bootstrap","webpack:///webpack/runtime/compat get default export","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/draw/drawLoop.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/data/modInfo.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/saveDataFunctions/saveFramework.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/menuFunctions/toggleHeader.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/menuSections/info/createFrameworkInfoMenuSection.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/menuSections/info/addInfoMenuSection.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/menuSections/options/addOptionsMenuSection.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/menuSections/addMenu.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/init.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/saveDataFunctions/createSaveDataObject.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/saveDataFunctions/loadMod.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/data/headers.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/data/settings.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/logic/logicLoop.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/load.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/save.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/frameworkDataObject/cookieMonsterFramework.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/initFunctions/initModFramework.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/initFunctions/registerMod.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/menuFunctions/createInfoListing.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/menuFunctions/createModMenuSection.js","webpack:///./node_modules/@cookiemonsterteam/cookiemonsterframework/src/index.js","webpack:///./src/Data/Moddata.ts","webpack:///./src/Config/Toggles/ToggleWrinklerButtons.js","webpack:///./src/Data/Scales.ts","webpack:///./src/Main/VariablesAndData.js","webpack:///./src/Disp/BeautifyAndFormatting/Beautify.js","webpack:///./src/Cache/VariablesAndData.js","webpack:///./src/Sim/VariablesAndData.js","webpack:///./src/Sim/ReplacedGameFunctions/SimAuraMult.js","webpack:///./src/Sim/ReplacedGameFunctions/SimGetSellMultiplier.js","webpack:///./src/Sim/ReplacedGameFunctions/SimEff.js","webpack:///./src/Sim/ReplacedGameFunctions/SimHas.js","webpack:///./src/Sim/ReplacedGameFunctions/SimHasGod.js","webpack:///./src/Sim/ReplacedGameFunctions/SimModifyBuidlingPrice.js","webpack:///./src/Sim/SimulationEvents/SellBuilding.js","webpack:///./src/Disp/VariablesAndData.js","webpack:///./src/Disp/BuildingsUpgrades/Buildings.js","webpack:///./src/Disp/BuildingsUpgrades/UpdateUpgradeSectionsHeight.js","webpack:///./src/Disp/BuildingsUpgrades/Upgrades.js","webpack:///./src/Disp/BeautifyAndFormatting/FormatTime.js","webpack:///./src/Disp/BeautifyAndFormatting/GetTimeColour.js","webpack:///./src/Disp/HelperFunctions/GetCPS.js","webpack:///./src/Disp/HelperFunctions/GetWrinkConfigBank.js","webpack:///./src/Disp/InfoBars/CreateDOMElements.js","webpack:///./src/Disp/InfoBars/BottomBar.js","webpack:///./src/Disp/HelperFunctions/UpdateBackground.js","webpack:///./src/Config/SpecificToggles.js","webpack:///./src/Disp/InfoBars/TimerBar.js","webpack:///./src/Disp/MenuSections/Refreshmenu.js","webpack:///./src/Cache/Dragon/CacheDragonAuras.js","webpack:///./src/Sim/InitializeData/InitAchievement.js","webpack:///./src/Sim/ReplacedGameFunctions/SimGetTieredCpsMult.js","webpack:///./src/Sim/InitializeData/InitialBuildingData.js","webpack:///./src/Sim/InitializeData/InitUpgrade.js","webpack:///./src/Sim/SimulationData/CopyData.js","webpack:///./src/Disp/Tooltips/CreateTooltip.js","webpack:///./src/Cache/PP/ColourOfPP.js","webpack:///./src/Cache/CPS/GetCPSBuffMult.js","webpack:///./src/Sim/ReplacedGameFunctions/SimGetHeavenlyMultiplier.js","webpack:///./src/Sim/SimulationData/SimWin.js","webpack:///./src/Sim/Calculations/CalculateGains.js","webpack:///./src/Data/Gamedata.ts","webpack:///./src/Sim/ReplacedGameFunctions/SimHasAchiev.js",Line truncated
|
||||||
@@ -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 +
|
||||||
|
|||||||
@@ -65,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,
|
||||||
|
|||||||
@@ -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,
|
||||||
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user