From 23f98c1ff6cbff0953dd6ce348433a3d5aa2d851 Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Mon, 12 Aug 2024 06:59:08 +0700 Subject: [PATCH] UI: Add success chance of Bladeburner action to Sleeves UI (#1567) --- src/PersonObjects/Sleeve/ui/SleeveElem.tsx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/PersonObjects/Sleeve/ui/SleeveElem.tsx b/src/PersonObjects/Sleeve/ui/SleeveElem.tsx index cad99afb6..33250318f 100644 --- a/src/PersonObjects/Sleeve/ui/SleeveElem.tsx +++ b/src/PersonObjects/Sleeve/ui/SleeveElem.tsx @@ -29,12 +29,24 @@ function getWorkDescription(sleeve: Sleeve, progress: number): string { return "This sleeve is currently set to focus on shock recovery. This causes the Sleeve's shock to decrease at a faster rate."; case SleeveWorkType.SYNCHRO: return "This sleeve is currently set to synchronize with the original consciousness. This causes the Sleeve's synchronization to increase."; - case SleeveWorkType.BLADEBURNER: + case SleeveWorkType.BLADEBURNER: { + const bladeburner = Player.bladeburner; + let estimatedSuccessChance; + if (bladeburner) { + const action = bladeburner.getActionFromTypeAndName(work.actionId.type, work.actionId.name); + if (action) { + const [minChance, maxChance] = action.getSuccessRange(bladeburner, sleeve); + estimatedSuccessChance = + formatPercent(minChance, 1) + (minChance === maxChance ? "" : ` ~ ${formatPercent(maxChance, 1)}`); + } + } return ( - `This sleeve is currently attempting to perform ${work.actionId.name}.\n\nTasks Completed: ${formatInt( - work.tasksCompleted, - )}\n \n` + `Progress: ${formatPercent(progress)}` + `This sleeve is currently attempting to perform ${work.actionId.name}.\n\n` + + (estimatedSuccessChance ? `Estimated success chance: ${estimatedSuccessChance}\n\n` : "") + + `Tasks Completed: ${formatInt(work.tasksCompleted)}\n \n` + + `Progress: ${formatPercent(progress)}` ); + } case SleeveWorkType.CRIME: { const crime = work.getCrime(); return (