mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-13 11:13:50 +01:00
Use stored corporation.dividendTax in the dividend tax calculation
This commit is contained in:
parent
8d474a7610
commit
e28fe3e31d
@ -36,7 +36,7 @@ export class Corporation {
|
|||||||
shareSaleCooldown = 0; // Game cycles until player can sell shares again
|
shareSaleCooldown = 0; // Game cycles until player can sell shares again
|
||||||
issueNewSharesCooldown = 0; // Game cycles until player can issue shares again
|
issueNewSharesCooldown = 0; // Game cycles until player can issue shares again
|
||||||
dividendRate = 0;
|
dividendRate = 0;
|
||||||
dividendTaxPercentage = 100 - 100 * BitNodeMultipliers.CorporationSoftcap;
|
dividendTax = 1 - BitNodeMultipliers.CorporationSoftcap + 0.15;
|
||||||
issuedShares = 0;
|
issuedShares = 0;
|
||||||
sharePrice = 0;
|
sharePrice = 0;
|
||||||
storedCycles = 0;
|
storedCycles = 0;
|
||||||
@ -121,6 +121,7 @@ export class Corporation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Process dividends
|
// Process dividends
|
||||||
|
this.updateDividendTax();
|
||||||
if (this.dividendRate > 0 && cycleProfit > 0) {
|
if (this.dividendRate > 0 && cycleProfit > 0) {
|
||||||
// Validate input again, just to be safe
|
// Validate input again, just to be safe
|
||||||
if (
|
if (
|
||||||
@ -146,20 +147,23 @@ export class Corporation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateDividendTax(): void {
|
||||||
|
this.dividendTax = 1 - BitNodeMultipliers.CorporationSoftcap + 0.15;
|
||||||
|
if (this.unlockUpgrades[5] === 1) {
|
||||||
|
this.dividendTax -= 0.05;
|
||||||
|
}
|
||||||
|
if (this.unlockUpgrades[6] === 1) {
|
||||||
|
this.dividendTax -= 0.1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getDividends(): number {
|
getDividends(): number {
|
||||||
const profit = this.revenue - this.expenses;
|
const profit = this.revenue - this.expenses;
|
||||||
const cycleProfit = profit * CorporationConstants.SecsPerMarketCycle;
|
const cycleProfit = profit * CorporationConstants.SecsPerMarketCycle;
|
||||||
const totalDividends = this.dividendRate * cycleProfit;
|
const totalDividends = this.dividendRate * cycleProfit;
|
||||||
const dividendsPerShare = totalDividends / this.totalShares;
|
const dividendsPerShare = totalDividends / this.totalShares;
|
||||||
const dividends = this.numShares * dividendsPerShare;
|
const dividends = this.numShares * dividendsPerShare;
|
||||||
let upgrades = -0.15;
|
return Math.pow(dividends, 1 - this.dividendTax);
|
||||||
if (this.unlockUpgrades[5] === 1) {
|
|
||||||
upgrades += 0.05;
|
|
||||||
}
|
|
||||||
if (this.unlockUpgrades[6] === 1) {
|
|
||||||
upgrades += 0.1;
|
|
||||||
}
|
|
||||||
return Math.pow(dividends, BitNodeMultipliers.CorporationSoftcap + upgrades);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
determineValuation(): number {
|
determineValuation(): number {
|
||||||
@ -277,10 +281,8 @@ export class Corporation {
|
|||||||
this.funds = this.funds - price;
|
this.funds = this.funds - price;
|
||||||
|
|
||||||
// Apply effects for one-time upgrades
|
// Apply effects for one-time upgrades
|
||||||
if (upgN === 5) {
|
if (upgN === 5 || upgN === 6) {
|
||||||
this.dividendTaxPercentage -= 5;
|
this.updateDividendTax();
|
||||||
} else if (upgN === 6) {
|
|
||||||
this.dividendTaxPercentage -= 10;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ export interface ICorporation {
|
|||||||
shareSaleCooldown: number;
|
shareSaleCooldown: number;
|
||||||
issueNewSharesCooldown: number;
|
issueNewSharesCooldown: number;
|
||||||
dividendRate: number;
|
dividendRate: number;
|
||||||
dividendTaxPercentage: number;
|
dividendTax: number;
|
||||||
issuedShares: number;
|
issuedShares: number;
|
||||||
sharePrice: number;
|
sharePrice: number;
|
||||||
storedCycles: number;
|
storedCycles: number;
|
||||||
@ -54,6 +54,7 @@ export interface ICorporation {
|
|||||||
getSalesMultiplier(): number;
|
getSalesMultiplier(): number;
|
||||||
getScientificResearchMultiplier(): number;
|
getScientificResearchMultiplier(): number;
|
||||||
getStarterGuide(player: IPlayer): void;
|
getStarterGuide(player: IPlayer): void;
|
||||||
toJSON(): any;
|
updateDividendTax(): void;
|
||||||
getDividends(): number;
|
getDividends(): number;
|
||||||
|
toJSON(): any;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user