From 65214c0322a5608cc328de74c046891565cef327 Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Sat, 10 Feb 2024 18:48:52 +0700 Subject: [PATCH] Change the calculation of valuation (#1056) --- src/Corporation/Corporation.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Corporation/Corporation.ts b/src/Corporation/Corporation.ts index 8241f0fef..20b043c29 100644 --- a/src/Corporation/Corporation.ts +++ b/src/Corporation/Corporation.ts @@ -199,6 +199,11 @@ export class Corporation { assetDelta = (this.totalAssets - this.previousTotalAssets) / corpConstants.secondsPerMarketCycle; // Handle pre-totalAssets saves assetDelta ??= this.revenue - this.expenses; + const numberOfOfficesAndWarehouses = [...this.divisions.values()] + .map( + (division: Division) => getRecordValues(division.offices).length + getRecordValues(division.warehouses).length, + ) + .reduce((sum: number, currentValue: number) => sum + currentValue, 0); if (this.public) { // Account for dividends if (this.dividendRate > 0) { @@ -206,14 +211,14 @@ export class Corporation { } val = this.funds + assetDelta * 85e3; - val *= Math.pow(1.1, this.divisions.size); + val *= Math.pow(Math.pow(1.1, 1 / 12), numberOfOfficesAndWarehouses); val = Math.max(val, 0); } else { val = 10e9 + this.funds / 3; if (assetDelta > 0) { val += assetDelta * 315e3; } - val *= Math.pow(1.1, this.divisions.size); + val *= Math.pow(Math.pow(1.1, 1 / 12), numberOfOfficesAndWarehouses); val -= val % 1e6; //Round down to nearest million } if (val < 10e9) val = 10e9; // Base valuation