Merge pull request #1847 from danielyxie/dev

formulas for ascension
This commit is contained in:
hydroflame 2021-12-09 12:53:04 -05:00 committed by GitHub
commit d86986555c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 59 additions and 23 deletions

24
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -6,7 +6,13 @@ import { IAscensionResult } from "./IAscensionResult";
import { IPlayer } from "../PersonObjects/IPlayer"; import { IPlayer } from "../PersonObjects/IPlayer";
import { IGang } from "./IGang"; import { IGang } from "./IGang";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; 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 { interface IMults {
hack: number; hack: number;
@ -63,7 +69,7 @@ export class GangMember {
} }
calculateAscensionMult(points: number): number { calculateAscensionMult(points: number): number {
return Math.max(Math.pow(points / 2000, 0.5), 1); return calculateAscensionMult(points);
} }
updateSkillLevels(): void { updateSkillLevels(): void {
@ -191,12 +197,12 @@ export class GangMember {
getGainedAscensionPoints(): IMults { getGainedAscensionPoints(): IMults {
return { return {
hack: Math.max(this.hack_exp - 1000, 0), hack: calculateAscensionPointsGain(this.hack_exp),
str: Math.max(this.str_exp - 1000, 0), str: calculateAscensionPointsGain(this.str_exp),
def: Math.max(this.def_exp - 1000, 0), def: calculateAscensionPointsGain(this.def_exp),
dex: Math.max(this.dex_exp - 1000, 0), dex: calculateAscensionPointsGain(this.dex_exp),
agi: Math.max(this.agi_exp - 1000, 0), agi: calculateAscensionPointsGain(this.agi_exp),
cha: Math.max(this.cha_exp - 1000, 0), 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; const territoryPenalty = (0.2 * gang.territory + 0.8) * BitNodeMultipliers.GangSoftcap;
return Math.pow(5 * task.baseMoney * statWeight * territoryMult * respectMult, territoryPenalty); 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, calculateWantedLevelGain,
calculateMoneyGain, calculateMoneyGain,
calculateWantedPenalty, calculateWantedPenalty,
calculateAscensionMult,
calculateAscensionPointsGain,
} from "../Gang/formulas/formulas"; } from "../Gang/formulas/formulas";
export interface INetscriptFormulas { export interface INetscriptFormulas {
@ -197,6 +199,12 @@ export function NetscriptFormulas(player: IPlayer, workerScript: WorkerScript, h
moneyGain: function (gang: any, member: any, task: any): number { moneyGain: function (gang: any, member: any, task: any): number {
return calculateMoneyGain(gang, member, task); return calculateMoneyGain(gang, member, task);
}, },
ascensionPointsGain: function (exp: any): number {
return calculateAscensionPointsGain(exp);
},
ascensionMultiplier: function (points: any): number {
return calculateAscensionMult(points);
},
}, },
}; };
} }

@ -3544,6 +3544,20 @@ interface GangFormulas {
* @returns The calculated money gain. * @returns The calculated money gain.
*/ */
moneyGain(gang: GangGenInfo, member: GangMemberInfo, task: GangTaskStats): number; 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;
} }
/** /**