2019-04-14 11:08:10 +02:00
|
|
|
/**
|
|
|
|
* React component for general information about the faction. This includes the
|
|
|
|
* factions "motto", reputation, favor, and gameplay instructions
|
|
|
|
*/
|
2021-09-22 18:56:55 +02:00
|
|
|
import React, { useState, useEffect } from "react";
|
2019-04-14 11:08:10 +02:00
|
|
|
|
2022-03-06 05:05:55 +01:00
|
|
|
import { Faction } from "../Faction";
|
|
|
|
import { FactionInfo } from "../FactionInfo";
|
2019-04-14 11:08:10 +02:00
|
|
|
|
2021-03-31 06:45:21 +02:00
|
|
|
import { Reputation } from "../../ui/React/Reputation";
|
|
|
|
import { Favor } from "../../ui/React/Favor";
|
2022-01-08 13:48:10 +01:00
|
|
|
import { MathJaxWrapper } from "../../MathJaxWrapper";
|
2019-04-14 11:08:10 +02:00
|
|
|
|
2021-09-21 02:42:13 +02:00
|
|
|
import makeStyles from "@mui/styles/makeStyles";
|
|
|
|
import createStyles from "@mui/styles/createStyles";
|
|
|
|
import Typography from "@mui/material/Typography";
|
|
|
|
import Tooltip from "@mui/material/Tooltip";
|
|
|
|
import Box from "@mui/material/Box";
|
|
|
|
|
2019-04-14 11:08:10 +02:00
|
|
|
type IProps = {
|
2021-09-05 01:09:30 +02:00
|
|
|
faction: Faction;
|
|
|
|
factionInfo: FactionInfo;
|
|
|
|
};
|
2019-04-14 11:08:10 +02:00
|
|
|
|
2021-09-25 08:36:49 +02:00
|
|
|
const useStyles = makeStyles(() =>
|
2021-09-21 02:42:13 +02:00
|
|
|
createStyles({
|
|
|
|
noformat: {
|
2021-09-21 23:12:16 +02:00
|
|
|
whiteSpace: "pre-wrap",
|
2021-09-25 17:23:56 +02:00
|
|
|
lineHeight: "1em",
|
2021-09-21 02:42:13 +02:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
);
|
2019-05-02 00:20:14 +02:00
|
|
|
|
2021-09-21 02:42:13 +02:00
|
|
|
export function Info(props: IProps): React.ReactElement {
|
2021-09-22 18:56:55 +02:00
|
|
|
const setRerender = useState(false)[1];
|
2021-09-22 18:49:29 +02:00
|
|
|
function rerender(): void {
|
|
|
|
setRerender((old) => !old);
|
|
|
|
}
|
|
|
|
|
|
|
|
useEffect(() => {
|
2021-09-25 19:31:42 +02:00
|
|
|
const id = setInterval(rerender, 200);
|
2021-09-22 18:49:29 +02:00
|
|
|
return () => clearInterval(id);
|
|
|
|
}, []);
|
|
|
|
|
2021-09-21 02:42:13 +02:00
|
|
|
const classes = useStyles();
|
2019-05-02 00:20:14 +02:00
|
|
|
|
2021-11-05 21:09:19 +01:00
|
|
|
const favorGain = props.faction.getFavorGain();
|
2021-09-21 02:42:13 +02:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Typography classes={{ root: classes.noformat }}>{props.factionInfo.infoText}</Typography>
|
|
|
|
<Typography>-------------------------</Typography>
|
|
|
|
<Box display="flex">
|
|
|
|
<Tooltip
|
|
|
|
title={
|
2021-09-21 19:08:05 +02:00
|
|
|
<>
|
|
|
|
<Typography>
|
2021-11-05 21:09:19 +01:00
|
|
|
You will have <Favor favor={Math.floor(props.faction.favor + favorGain)} /> faction favor after
|
|
|
|
installing an Augmentation.
|
2021-09-21 19:08:05 +02:00
|
|
|
</Typography>
|
2022-01-08 13:48:10 +01:00
|
|
|
<MathJaxWrapper>{"\\(\\huge{r = \\text{total faction reputation}}\\)"}</MathJaxWrapper>
|
|
|
|
<MathJaxWrapper>
|
|
|
|
{
|
|
|
|
"\\(\\huge{favor=1+\\left\\lfloor\\log_{1.02}\\left(\\frac{r+25000}{25500}\\right)\\right\\rfloor}\\)"
|
|
|
|
}
|
|
|
|
</MathJaxWrapper>
|
2021-09-21 19:08:05 +02:00
|
|
|
</>
|
2021-09-21 02:42:13 +02:00
|
|
|
}
|
|
|
|
>
|
2021-10-01 19:08:37 +02:00
|
|
|
<Typography>
|
|
|
|
Reputation: <Reputation reputation={props.faction.playerReputation} />
|
|
|
|
</Typography>
|
2021-09-21 02:42:13 +02:00
|
|
|
</Tooltip>
|
|
|
|
</Box>
|
2019-04-14 11:08:10 +02:00
|
|
|
|
2021-09-21 02:42:13 +02:00
|
|
|
<Typography>-------------------------</Typography>
|
2021-09-03 23:12:55 +02:00
|
|
|
|
2021-09-21 02:42:13 +02:00
|
|
|
<Box display="flex">
|
|
|
|
<Tooltip
|
|
|
|
title={
|
2021-09-21 19:08:05 +02:00
|
|
|
<>
|
|
|
|
<Typography>
|
|
|
|
Faction favor increases the rate at which you earn reputation for this faction by 1% per favor. Faction
|
|
|
|
favor is gained whenever you install an Augmentation. The amount of favor you gain depends on the total
|
|
|
|
amount of reputation you earned with this faction. Across all resets.
|
|
|
|
</Typography>
|
2021-10-13 08:15:29 +02:00
|
|
|
|
2022-01-08 13:48:10 +01:00
|
|
|
<MathJaxWrapper>{"\\(\\huge{r = reputation}\\)"}</MathJaxWrapper>
|
|
|
|
<MathJaxWrapper>{"\\(\\huge{\\Delta r = \\Delta r \\times \\frac{100+favor}{100}}\\)"}</MathJaxWrapper>
|
|
|
|
|
2021-09-21 19:08:05 +02:00
|
|
|
</>
|
2021-09-21 02:42:13 +02:00
|
|
|
}
|
|
|
|
>
|
2021-10-01 19:08:37 +02:00
|
|
|
<Typography>
|
2021-11-05 21:09:19 +01:00
|
|
|
Faction Favor: <Favor favor={Math.floor(props.faction.favor)} />
|
2021-10-01 19:08:37 +02:00
|
|
|
</Typography>
|
2021-09-21 02:42:13 +02:00
|
|
|
</Tooltip>
|
|
|
|
</Box>
|
2019-04-14 11:08:10 +02:00
|
|
|
|
2021-09-21 02:42:13 +02:00
|
|
|
<Typography>-------------------------</Typography>
|
|
|
|
<Typography>
|
|
|
|
Perform work/carry out assignments for your faction to help further its cause! By doing so you will earn
|
|
|
|
reputation for your faction. You will also gain reputation passively over time, although at a very slow rate.
|
|
|
|
Earning reputation will allow you to purchase Augmentations through this faction, which are powerful upgrades
|
|
|
|
that enhance your abilities.
|
|
|
|
</Typography>
|
|
|
|
</>
|
|
|
|
);
|
2019-04-14 11:08:10 +02:00
|
|
|
}
|