Merge branch 'dev' into bugfix/corp-updates

This commit is contained in:
phyzical
2022-04-02 20:12:19 +08:00
19 changed files with 185 additions and 145 deletions
+2 -1
View File
@@ -353,7 +353,8 @@ export function NetscriptBladeburner(
checkBladeburnerCity("switchCity", cityName);
const bladeburner = player.bladeburner;
if (bladeburner === null) throw new Error("Should not be called without Bladeburner");
return bladeburner.city === cityName;
bladeburner.city = cityName;
return true;
},
getStamina: function (): [number, number] {
helper.updateDynamicRam("getStamina", getRamCost(player, "bladeburner", "getStamina"));
+13
View File
@@ -37,6 +37,7 @@ import {
calculateAscensionMult,
calculateAscensionPointsGain,
} 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 {
const checkFormulasAccess = function (func: string): void {
@@ -45,6 +46,18 @@ export function NetscriptFormulas(player: IPlayer, workerScript: WorkerScript, h
}
};
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: {
calculateSkill: function (_exp: unknown, _mult: unknown = 1): number {
const exp = helper.number("calculateSkill", "exp", _exp);
+1 -1
View File
@@ -3,7 +3,7 @@ import { BaseServer } from "../Server/BaseServer";
export interface INetscriptHelper {
updateDynamicRam(functionName: string, ram: number): void;
makeRuntimeErrorMsg(functionName: string, message: string): void;
makeRuntimeErrorMsg(functionName: string, message: string): string;
string(funcName: string, argName: string, v: unknown): string;
number(funcName: string, argName: string, v: unknown): number;
city(funcName: string, argName: string, v: unknown): CityName;