import { Report } from "@mui/icons-material";
import { Box, Button, Container, Paper, Tooltip, Typography } from "@mui/material";
import React from "react";
import { Location } from "../../Locations/Location";
import { Settings } from "../../Settings/Settings";
import { formatHp, formatNumberNoSuffix } from "../../ui/formatNumber";
import { Player } from "@player";
import { calculateDamageAfterFailingInfiltration } from "../utils";
interface IProps {
Location: Location;
StartingDifficulty: number;
Difficulty: number;
MaxLevel: number;
start: () => void;
cancel: () => void;
}
function arrowPart(color: string, length: number): JSX.Element {
let arrow = "";
if (length <= 0) length = 0;
else if (length > 13) length = 13;
else {
length--;
arrow = ">";
}
return (
{"=".repeat(length)}
{arrow}
{" ".repeat(13 - arrow.length - length)}
);
}
function coloredArrow(difficulty: number): JSX.Element {
if (difficulty === 0) {
return (
{">"}
{" ".repeat(38)}
);
} else {
return (
<>
{arrowPart(Settings.theme.primary, difficulty * 13)}
{arrowPart(Settings.theme.warning, (difficulty - 1) * 13)}
{arrowPart(Settings.theme.error, (difficulty - 2) * 13)}
>
);
}
}
export function Intro(props: IProps): React.ReactElement {
return (
Infiltrating {props.Location.name}
HP: {`${formatHp(Player.hp.current)} / ${formatHp(Player.hp.max)}`}
Lose {formatHp(calculateDamageAfterFailingInfiltration(props.StartingDifficulty))} HP for each failure
Maximum Level:
{props.MaxLevel}
2
? Settings.theme.error
: props.Difficulty > 1
? Settings.theme.warning
: Settings.theme.primary,
display: "flex",
alignItems: "center",
}}
>
Difficulty:
{formatNumberNoSuffix(props.Difficulty * 33.3333)} / 100
{props.Difficulty > 1.5 && (
This location is too heavily guarded for your current stats. It is recommended that you try training,
or finding an easier location.
}
>
)}
[{coloredArrow(props.Difficulty)}]
{`▲ ▲ ▲ ▲`}
{` Trivial Normal Hard Impossible`}
Infiltration is a series of short minigames that get progressively harder. You take damage for failing
them. Reaching the maximum level rewards you with intel that you can trade for money or reputation.
Gameplay:
-
The minigames you play are randomly selected.
It might take you a few tries to get used to them.
- No game requires use of the mouse.
-
Spacebar is the default action/confirm button.
-
The arrow keys and WASD can be used interchangeably.
- Sometimes the rest of the keyboard is used.
);
}