import React, { useState } from "react"; import { Location } from "../../Locations/Location"; import { Router } from "../../ui/GameRoot"; import { Player } from "../../Player"; import { calculateDifficulty, calculateReward } from "../formulas/game"; import { Game } from "./Game"; import { Intro } from "./Intro"; interface IProps { location: Location; } export function InfiltrationRoot(props: IProps): React.ReactElement { const [start, setStart] = useState(false); if (props.location.infiltrationData === undefined) throw new Error("Trying to do infiltration on invalid location."); const startingSecurityLevel = props.location.infiltrationData.startingSecurityLevel; const difficulty = calculateDifficulty(Player, startingSecurityLevel); const reward = calculateReward(Player, startingSecurityLevel); function cancel(): void { Router.toCity(); } return (
{start ? ( ) : ( setStart(true)} cancel={cancel} /> )}
); }