Change the calculation of valuation ()

This commit is contained in:
catloversg 2024-02-10 18:48:52 +07:00 committed by GitHub
parent 903f812424
commit 65214c0322
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -199,6 +199,11 @@ export class Corporation {
assetDelta = (this.totalAssets - this.previousTotalAssets) / corpConstants.secondsPerMarketCycle; assetDelta = (this.totalAssets - this.previousTotalAssets) / corpConstants.secondsPerMarketCycle;
// Handle pre-totalAssets saves // Handle pre-totalAssets saves
assetDelta ??= this.revenue - this.expenses; 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) { if (this.public) {
// Account for dividends // Account for dividends
if (this.dividendRate > 0) { if (this.dividendRate > 0) {
@ -206,14 +211,14 @@ export class Corporation {
} }
val = this.funds + assetDelta * 85e3; 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); val = Math.max(val, 0);
} else { } else {
val = 10e9 + this.funds / 3; val = 10e9 + this.funds / 3;
if (assetDelta > 0) { if (assetDelta > 0) {
val += assetDelta * 315e3; 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 val -= val % 1e6; //Round down to nearest million
} }
if (val < 10e9) val = 10e9; // Base valuation if (val < 10e9) val = 10e9; // Base valuation