Gang-rework bugfixes and rebalancing. Started adding Gang API

This commit is contained in:
danielyxie
2018-10-19 19:30:02 -05:00
parent a0ebcff0aa
commit e73ebe843f
7 changed files with 471 additions and 103 deletions
+17
View File
@@ -0,0 +1,17 @@
import {Player} from "./Player";
import {Gang} from "./Gang";
import {makeRuntimeRejectMsg} from "./NetscriptEvaluator";
function unknownGangApiExceptionMessage(functionName, err) {
return `gang.${functionName}() failed with exception: ` + err;
}
function checkGangApiAccess(workerScript, functionName) {
const accessDenied = `gang.${functionName}() failed because you do not currently have a Gang`;
const hasAccess = Player.gang instanceof Gang;
if (!hasAccess) {
throw makeRuntimeRejectMsg(workerScript, accessDenied);
}
}
export {unknownBladeburnerActionErrorMessage, unknownBladeburnerExceptionMessage, checkBladeburnerAccess};