nerf investors fraud

This commit is contained in:
Olivier Gagnon 2022-04-13 18:08:35 -04:00
parent 49164b5d36
commit 88ae27e84d
3 changed files with 10 additions and 1 deletions

@ -45,6 +45,8 @@ export class Corporation {
upgrades: number[]; upgrades: number[];
upgradeMultipliers: number[]; upgradeMultipliers: number[];
avgProfit = 0;
state = new CorporationState(); state = new CorporationState();
constructor(params: IParams = {}) { constructor(params: IParams = {}) {
@ -106,6 +108,8 @@ export class Corporation {
this.expenses = this.expenses + ind.lastCycleExpenses; this.expenses = this.expenses + ind.lastCycleExpenses;
}); });
const profit = this.revenue - this.expenses; const profit = this.revenue - this.expenses;
this.avgProfit =
(this.avgProfit * (CorporationConstants.AvgProfitLength - 1) + profit) / CorporationConstants.AvgProfitLength;
const cycleProfit = profit * (marketCycles * CorporationConstants.SecsPerMarketCycle); const cycleProfit = profit * (marketCycles * CorporationConstants.SecsPerMarketCycle);
if (isNaN(this.funds) || this.funds === Infinity || this.funds === -Infinity) { if (isNaN(this.funds) || this.funds === Infinity || this.funds === -Infinity) {
dialogBoxCreate( dialogBoxCreate(
@ -160,7 +164,7 @@ export class Corporation {
determineValuation(): number { determineValuation(): number {
let val, let val,
profit = this.revenue - this.expenses; profit = this.avgProfit;
if (this.public) { if (this.public) {
// Account for dividends // Account for dividends
if (this.dividendPercentage > 0) { if (this.dividendPercentage > 0) {

@ -28,6 +28,7 @@ export const CorporationConstants: {
AllMaterials: string[]; AllMaterials: string[];
FundingRoundShares: number[]; FundingRoundShares: number[];
FundingRoundMultiplier: number[]; FundingRoundMultiplier: number[];
AvgProfitLength: number;
} = { } = {
INITIALSHARES: 1e9, //Total number of shares you have at your company INITIALSHARES: 1e9, //Total number of shares you have at your company
SHARESPERPRICEUPDATE: 1e6, //When selling large number of shares, price is dynamically updated for every batch of this amount SHARESPERPRICEUPDATE: 1e6, //When selling large number of shares, price is dynamically updated for every batch of this amount
@ -83,4 +84,6 @@ export const CorporationConstants: {
], ],
FundingRoundShares: [0.1, 0.35, 0.25, 0.2], FundingRoundShares: [0.1, 0.35, 0.25, 0.2],
FundingRoundMultiplier: [4, 3, 3, 2.5], FundingRoundMultiplier: [4, 3, 3, 2.5],
AvgProfitLength: 20,
}; };

@ -1342,6 +1342,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
(_nextBN: unknown, _callbackScript: unknown = ""): void => { (_nextBN: unknown, _callbackScript: unknown = ""): void => {
const nextBN = _ctx.helper.number("nextBN", _nextBN); const nextBN = _ctx.helper.number("nextBN", _nextBN);
const callbackScript = _ctx.helper.string("callbackScript", _callbackScript); const callbackScript = _ctx.helper.string("callbackScript", _callbackScript);
_ctx.helper.checkSingularityAccess();
enterBitNode(Router, true, player.bitNodeN, nextBN); enterBitNode(Router, true, player.bitNodeN, nextBN);
if (callbackScript) if (callbackScript)
setTimeout(() => { setTimeout(() => {
@ -1353,6 +1354,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
(_nextBN: unknown, _callbackScript: unknown = ""): void => { (_nextBN: unknown, _callbackScript: unknown = ""): void => {
const nextBN = _ctx.helper.number("nextBN", _nextBN); const nextBN = _ctx.helper.number("nextBN", _nextBN);
const callbackScript = _ctx.helper.string("callbackScript", _callbackScript); const callbackScript = _ctx.helper.string("callbackScript", _callbackScript);
_ctx.helper.checkSingularityAccess();
const hackingRequirements = (): boolean => { const hackingRequirements = (): boolean => {
const wd = GetServer(SpecialServers.WorldDaemon); const wd = GetServer(SpecialServers.WorldDaemon);