2021-08-21 20:00:28 +02:00
|
|
|
import React from "react";
|
2021-09-25 20:42:57 +02:00
|
|
|
import { formatNumber } from "../../utils/StringHelperFunctions";
|
2021-09-27 23:09:48 +02:00
|
|
|
import { StealthIcon } from "./StealthIcon";
|
|
|
|
import { KillIcon } from "./KillIcon";
|
2022-09-20 08:15:58 +02:00
|
|
|
import { Action } from "../Action";
|
|
|
|
import { Bladeburner } from "../Bladeburner";
|
2022-10-10 00:42:14 +02:00
|
|
|
import { Player } from "@player";
|
2021-08-21 20:00:28 +02:00
|
|
|
|
|
|
|
interface IProps {
|
2022-09-20 08:15:58 +02:00
|
|
|
bladeburner: Bladeburner;
|
|
|
|
action: Action;
|
2021-08-21 20:00:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export function SuccessChance(props: IProps): React.ReactElement {
|
2022-04-14 17:40:59 +02:00
|
|
|
const estimatedSuccessChance = props.action.getEstSuccessChance(props.bladeburner, Player);
|
2021-09-27 23:09:48 +02:00
|
|
|
|
|
|
|
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)}%
|
|
|
|
</>
|
|
|
|
);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2021-08-21 20:00:28 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
return (
|
|
|
|
<>
|
2021-09-27 23:09:48 +02:00
|
|
|
Estimated success chance: {chance} {props.action.isStealth ? <StealthIcon /> : <></>}
|
|
|
|
{props.action.isKill ? <KillIcon /> : <></>}
|
2021-09-05 01:09:30 +02:00
|
|
|
</>
|
|
|
|
);
|
2021-08-21 20:00:28 +02:00
|
|
|
}
|