mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-10-23 10:13:13 +02:00
2613948bad
This adds bladeburner actions to sleeves. In addition this bulked out the IPerson functionality and updated bladeburner functions to be more sleeve compatible
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import React from "react";
|
|
import { formatNumber } from "../../utils/StringHelperFunctions";
|
|
import { StealthIcon } from "./StealthIcon";
|
|
import { KillIcon } from "./KillIcon";
|
|
import { IAction } from "../IAction";
|
|
import { IBladeburner } from "../IBladeburner";
|
|
import { Player } from "../../Player";
|
|
|
|
interface IProps {
|
|
bladeburner: IBladeburner;
|
|
action: IAction;
|
|
}
|
|
|
|
export function SuccessChance(props: IProps): React.ReactElement {
|
|
const estimatedSuccessChance = props.action.getEstSuccessChance(props.bladeburner, Player);
|
|
|
|
let chance = <></>;
|
|
if (estimatedSuccessChance[0] === estimatedSuccessChance[1]) {
|
|
chance = <>{formatNumber(estimatedSuccessChance[0] * 100, 1)}%</>;
|
|
} else {
|
|
chance = (
|
|
<>
|
|
{formatNumber(estimatedSuccessChance[0] * 100, 1)}% ~ {formatNumber(estimatedSuccessChance[1] * 100, 1)}%
|
|
</>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<>
|
|
Estimated success chance: {chance} {props.action.isStealth ? <StealthIcon /> : <></>}
|
|
{props.action.isKill ? <KillIcon /> : <></>}
|
|
</>
|
|
);
|
|
}
|