diff --git a/src/Infiltration/ui/Victory.tsx b/src/Infiltration/ui/Victory.tsx index de3e181f0..1c63fb74f 100644 --- a/src/Infiltration/ui/Victory.tsx +++ b/src/Infiltration/ui/Victory.tsx @@ -9,6 +9,7 @@ import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; import MenuItem from "@mui/material/MenuItem"; import Select, { SelectChangeEvent } from "@mui/material/Select"; +import { FactionNames } from "../../Faction/data/FactionNames"; interface IProps { StartingDifficulty: number; @@ -23,6 +24,7 @@ export function Victory(props: IProps): React.ReactElement { const [faction, setFaction] = useState("none"); function quitInfiltration(): void { + handleInfiltrators(); router.toCity(); } @@ -35,6 +37,11 @@ export function Victory(props: IProps): React.ReactElement { levelBonus * BitNodeMultipliers.InfiltrationRep; + // TODO: add two augmentations to infiltrators to increase this by 5 and * 2 + const infiltratorsRepGain = 5; + const infiltratorFaction = Factions[FactionNames.Infiltrators]; + const isMemberOfInfiltrators = infiltratorFaction && infiltratorFaction.isMember; + const moneyGain = Math.pow(props.Reward + 1, 2) * Math.pow(props.StartingDifficulty, 3) * @@ -43,11 +50,13 @@ export function Victory(props: IProps): React.ReactElement { BitNodeMultipliers.InfiltrationMoney; function sell(): void { + handleInfiltrators(); player.gainMoney(moneyGain, "infiltration"); quitInfiltration(); } function trade(): void { + handleInfiltrators(); if (faction === "none") return; Factions[faction].playerReputation += repGain; quitInfiltration(); @@ -57,6 +66,13 @@ export function Victory(props: IProps): React.ReactElement { setFaction(event.target.value); } + function handleInfiltrators(): void { + player.hasCompletedAnInfiltration = true; + if (isMemberOfInfiltrators) { + infiltratorFaction.playerReputation += infiltratorsRepGain; + } + } + return ( <> @@ -65,7 +81,15 @@ export function Victory(props: IProps): React.ReactElement { - You can trade the confidential information you found for money or reputation. + You{" "} + {isMemberOfInfiltrators ? ( + <> + have gained {infiltratorsRepGain} rep for {FactionNames.Infiltrators} and + + ) : ( + <> + )} + can trade the confidential information you found for money or reputation. + {!(details.first.length === 1 && details.first[0] === "------") && ( <> - {details.first.map((detail) => ( {detail} @@ -299,7 +299,7 @@ export function TaskSelector(props: IProps): React.ReactElement { )} {!(details2.length === 1 && details2[0] === "------") && ( <> - {details2.map((detail) => ( {detail}