From 7fdbc81594f2244590ab4ec7135985e5ba453524 Mon Sep 17 00:00:00 2001 From: phyzical Date: Sun, 20 Mar 2022 20:56:33 +0800 Subject: [PATCH] used the getSleeveStats as it seems to be a miss connection between whats displayed and whats used i.e sleeve.shock of 100 is actually a shock value of 0 for the use --- src/NetscriptFunctions/Sleeve.ts | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/NetscriptFunctions/Sleeve.ts b/src/NetscriptFunctions/Sleeve.ts index 2246f61f7..4f7669119 100644 --- a/src/NetscriptFunctions/Sleeve.ts +++ b/src/NetscriptFunctions/Sleeve.ts @@ -30,6 +30,20 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel } }; + const getSleeveStats = function (sleeveNumber: any): any { + const sl = player.sleeves[sleeveNumber]; + return { + shock: 100 - sl.shock, + sync: sl.sync, + hacking: sl.hacking, + strength: sl.strength, + defense: sl.defense, + dexterity: sl.dexterity, + agility: sl.agility, + charisma: sl.charisma, + }; + } + return { getNumSleeves: function (): number { helper.updateDynamicRam("getNumSleeves", getRamCost(player, "sleeve", "getNumSleeves")); @@ -150,18 +164,7 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel helper.updateDynamicRam("getSleeveStats", getRamCost(player, "sleeve", "getSleeveStats")); checkSleeveAPIAccess("getSleeveStats"); checkSleeveNumber("getSleeveStats", sleeveNumber); - - const sl = player.sleeves[sleeveNumber]; - return { - shock: 100 - sl.shock, - sync: sl.sync, - hacking: sl.hacking, - strength: sl.strength, - defense: sl.defense, - dexterity: sl.dexterity, - agility: sl.agility, - charisma: sl.charisma, - }; + return getSleeveStats(sleeveNumber) }, getTask: function (asleeveNumber: any = 0): { task: string; @@ -289,7 +292,7 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel checkSleeveAPIAccess("purchaseSleeveAug"); checkSleeveNumber("purchaseSleeveAug", sleeveNumber); - if (player.sleeves[sleeveNumber].shock > 0){ + if (getSleeveStats(sleeveNumber).shock > 0) { throw helper.makeRuntimeErrorMsg("sleeve.purchaseSleeveAug", `Sleeve shock too high: Sleeve ${sleeveNumber}`); }