UI: Add success chance of Bladeburner action to Sleeves UI (#1567)

This commit is contained in:
catloversg 2024-08-12 06:59:08 +07:00 committed by GitHub
parent 7029ac9bcc
commit 23f98c1ff6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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 (