mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 14:59:16 +02:00
formulas for ascension
This commit is contained in:
@@ -6,7 +6,13 @@ import { IAscensionResult } from "./IAscensionResult";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
import { IGang } from "./IGang";
|
||||
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver";
|
||||
import { calculateRespectGain, calculateMoneyGain, calculateWantedLevelGain } from "./formulas/formulas";
|
||||
import {
|
||||
calculateRespectGain,
|
||||
calculateMoneyGain,
|
||||
calculateWantedLevelGain,
|
||||
calculateAscensionMult,
|
||||
calculateAscensionPointsGain,
|
||||
} from "./formulas/formulas";
|
||||
|
||||
interface IMults {
|
||||
hack: number;
|
||||
@@ -63,7 +69,7 @@ export class GangMember {
|
||||
}
|
||||
|
||||
calculateAscensionMult(points: number): number {
|
||||
return Math.max(Math.pow(points / 2000, 0.5), 1);
|
||||
return calculateAscensionMult(points);
|
||||
}
|
||||
|
||||
updateSkillLevels(): void {
|
||||
@@ -191,12 +197,12 @@ export class GangMember {
|
||||
|
||||
getGainedAscensionPoints(): IMults {
|
||||
return {
|
||||
hack: Math.max(this.hack_exp - 1000, 0),
|
||||
str: Math.max(this.str_exp - 1000, 0),
|
||||
def: Math.max(this.def_exp - 1000, 0),
|
||||
dex: Math.max(this.dex_exp - 1000, 0),
|
||||
agi: Math.max(this.agi_exp - 1000, 0),
|
||||
cha: Math.max(this.cha_exp - 1000, 0),
|
||||
hack: calculateAscensionPointsGain(this.hack_exp),
|
||||
str: calculateAscensionPointsGain(this.str_exp),
|
||||
def: calculateAscensionPointsGain(this.def_exp),
|
||||
dex: calculateAscensionPointsGain(this.dex_exp),
|
||||
agi: calculateAscensionPointsGain(this.agi_exp),
|
||||
cha: calculateAscensionPointsGain(this.cha_exp),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -71,3 +71,11 @@ export function calculateMoneyGain(gang: Gang, member: GangMember, task: GangMem
|
||||
const territoryPenalty = (0.2 * gang.territory + 0.8) * BitNodeMultipliers.GangSoftcap;
|
||||
return Math.pow(5 * task.baseMoney * statWeight * territoryMult * respectMult, territoryPenalty);
|
||||
}
|
||||
|
||||
export function calculateAscensionPointsGain(exp: number): number {
|
||||
return Math.max(exp - 1000, 0);
|
||||
}
|
||||
|
||||
export function calculateAscensionMult(points: number): number {
|
||||
return Math.max(Math.pow(points / 2000, 0.5), 1);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ import {
|
||||
calculateWantedLevelGain,
|
||||
calculateMoneyGain,
|
||||
calculateWantedPenalty,
|
||||
calculateAscensionMult,
|
||||
calculateAscensionPointsGain,
|
||||
} from "../Gang/formulas/formulas";
|
||||
|
||||
export interface INetscriptFormulas {
|
||||
@@ -197,6 +199,12 @@ export function NetscriptFormulas(player: IPlayer, workerScript: WorkerScript, h
|
||||
moneyGain: function (gang: any, member: any, task: any): number {
|
||||
return calculateMoneyGain(gang, member, task);
|
||||
},
|
||||
ascensionPointsGain: function (exp: any): number {
|
||||
return calculateAscensionPointsGain(exp);
|
||||
},
|
||||
ascensionMultiplier: function (points: any): number {
|
||||
return calculateAscensionMult(points);
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
14
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
14
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@@ -3544,6 +3544,20 @@ interface GangFormulas {
|
||||
* @returns The calculated money gain.
|
||||
*/
|
||||
moneyGain(gang: GangGenInfo, member: GangMemberInfo, task: GangTaskStats): number;
|
||||
|
||||
/**
|
||||
* Calculate ascension point gain.
|
||||
* @param exp - Experience point before ascension.
|
||||
* @returns The calculated ascension point gain.
|
||||
*/
|
||||
ascensionPointsGain(exp: number): number;
|
||||
|
||||
/**
|
||||
* Calculate ascension mult.
|
||||
* @param points - Amount of ascension points.
|
||||
* @returns The calculated ascension mult.
|
||||
*/
|
||||
ascensionMultiplier(points: number): number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user