Merge pull request #3315 from danielyxie/dev

Added formulas for faction
This commit is contained in:
hydroflame 2022-03-31 15:54:39 -04:00 committed by GitHub
commit fa9aa67577
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 18 deletions

28
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

File diff suppressed because one or more lines are too long

@ -37,6 +37,7 @@ import {
calculateAscensionMult, calculateAscensionMult,
calculateAscensionPointsGain, calculateAscensionPointsGain,
} from "../Gang/formulas/formulas"; } from "../Gang/formulas/formulas";
import { favorToRep as calculateFavorToRep, repToFavor as calculateRepToFavor } from "../Faction/formulas/favor";
export function NetscriptFormulas(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): IFormulas { export function NetscriptFormulas(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): IFormulas {
const checkFormulasAccess = function (func: string): void { const checkFormulasAccess = function (func: string): void {
@ -45,6 +46,18 @@ export function NetscriptFormulas(player: IPlayer, workerScript: WorkerScript, h
} }
}; };
return { return {
reputation: {
calculateFavorToRep: function (_favor: unknown): number {
const favor = helper.number("calculateFavorToRep", "favor", _favor);
checkFormulasAccess("reputation.calculateFavorToRep");
return calculateFavorToRep(favor);
},
calculateRepToFavor: function (_rep: unknown): number {
const rep = helper.number("calculateRepToFavor", "rep", _rep);
checkFormulasAccess("reputation.calculateRepToFavor");
return calculateRepToFavor(rep);
},
},
skills: { skills: {
calculateSkill: function (_exp: unknown, _mult: unknown = 1): number { calculateSkill: function (_exp: unknown, _mult: unknown = 1): number {
const exp = helper.number("calculateSkill", "exp", _exp); const exp = helper.number("calculateSkill", "exp", _exp);

@ -3797,6 +3797,26 @@ interface SkillsFormulas {
calculateExp(skill: number, skillMult?: number): number; calculateExp(skill: number, skillMult?: number): number;
} }
/**
* Reputation formulas
* @public
*/
interface ReputationFormulas {
/**
* Calculate the total required amount of faction reputation to reach a target favor.
* @param favor - target faction favor.
* @returns The calculated faction reputation required.
*/
calculateFavorToRep(favor: number): number;
/**
* Calculate the resulting faction favor of a total amount of reputation.
* (Faction favor is gained whenever you install an Augmentation.)
* @param rep - amount of reputation.
* @returns The calculated faction favor.
*/
calculateRepToFavor(rep: number): number;
}
/** /**
* Hacking formulas * Hacking formulas
* @public * @public
@ -4039,6 +4059,8 @@ interface GangFormulas {
* @public * @public
*/ */
export interface Formulas { export interface Formulas {
/** Reputation formulas */
reputation: ReputationFormulas;
/** Skills formulas */ /** Skills formulas */
skills: SkillsFormulas; skills: SkillsFormulas;
/** Hacking formulas */ /** Hacking formulas */