Merge pull request #1577 from danielyxie/dev

few fixes
This commit is contained in:
hydroflame 2021-10-26 22:25:45 -04:00 committed by GitHub
commit 87f78cbc6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 18 deletions

14
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

@ -27,6 +27,10 @@ to attempt infiltrations above mid-normal.
** Slash when his guard is down! ** ** Slash when his guard is down! **
Press space when the guard is attacking you. Press space when the guard is attacking you.
There's 3 phase
The first is guarding, where attacking back will result in failure.
The 2nd is preparing, this informs you that in 250ms there will be an opening window to attack.
The 3rd is attack, during this phase you can press space to slash and kill the enemy.
** Close the brackets ** ** Close the brackets **

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -3,6 +3,7 @@ import { Location } from "../../Locations/Location";
import Grid from "@mui/material/Grid"; import Grid from "@mui/material/Grid";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import { numeralWrapper } from "../../ui/numeralFormat";
interface IProps { interface IProps {
Location: Location; Location: Location;
@ -60,6 +61,21 @@ export function Intro(props: IProps): React.ReactElement {
Maximum level: {props.MaxLevel} Maximum level: {props.MaxLevel}
</Typography> </Typography>
</Grid> </Grid>
<Grid item xs={10}>
<Typography variant="h5" color="primary">
Difficulty: {numeralWrapper.format(props.Difficulty * 33.3333, "0")} / 100
</Typography>
</Grid>
{props.Difficulty > 1.5 && (
<Grid item xs={10}>
<Typography variant="h5" color="primary">
Warning: This location is too heavily guarded for your current stats, try training or finding an easier
location.
</Typography>
</Grid>
)}
<Grid item xs={10}> <Grid item xs={10}>
<Typography sx={{ lineHeight: "1em", whiteSpace: "pre" }}>[{coloredArrow(props.Difficulty)}]</Typography> <Typography sx={{ lineHeight: "1em", whiteSpace: "pre" }}>[{coloredArrow(props.Difficulty)}]</Typography>
<Typography <Typography

@ -26,12 +26,12 @@ const difficulties: {
export function SlashGame(props: IMinigameProps): React.ReactElement { export function SlashGame(props: IMinigameProps): React.ReactElement {
const difficulty: Difficulty = { window: 0 }; const difficulty: Difficulty = { window: 0 };
interpolate(difficulties, props.difficulty, difficulty); interpolate(difficulties, props.difficulty, difficulty);
const [guarding, setGuarding] = useState(true); const [phase, setPhase] = useState(0);
function press(this: Document, event: KeyboardEvent): void { function press(this: Document, event: KeyboardEvent): void {
event.preventDefault(); event.preventDefault();
if (event.keyCode !== 32) return; if (event.keyCode !== 32) return;
if (guarding) { if (phase !== 2) {
props.onFailure(); props.onFailure();
} else { } else {
props.onSuccess(); props.onSuccess();
@ -39,14 +39,15 @@ export function SlashGame(props: IMinigameProps): React.ReactElement {
} }
useEffect(() => { useEffect(() => {
let id2 = -1; let id = window.setTimeout(() => {
const id = window.setTimeout(() => { setPhase(1);
setGuarding(false); id = window.setTimeout(() => {
id2 = window.setTimeout(() => setGuarding(true), difficulty.window); setPhase(2);
id = window.setTimeout(() => setPhase(0), difficulty.window);
}, 250);
}, Math.random() * 3250 + 1500); }, Math.random() * 3250 + 1500);
return () => { return () => {
clearInterval(id); clearInterval(id);
if (id2 !== -1) clearInterval(id2);
}; };
}, []); }, []);
@ -55,7 +56,9 @@ export function SlashGame(props: IMinigameProps): React.ReactElement {
<GameTimer millis={5000} onExpire={props.onFailure} /> <GameTimer millis={5000} onExpire={props.onFailure} />
<Grid item xs={12}> <Grid item xs={12}>
<Typography variant="h4">Slash when his guard is down!</Typography> <Typography variant="h4">Slash when his guard is down!</Typography>
<Typography variant="h4">{guarding ? "!Guarding!" : "!ATTACKING!"}</Typography> {phase === 0 && <Typography variant="h4">Guarding ...</Typography>}
{phase === 1 && <Typography variant="h4">Preparing?</Typography>}
{phase === 2 && <Typography variant="h4">ATTACKING!</Typography>}
<KeyHandler onKeyDown={press} onFailure={props.onFailure} /> <KeyHandler onKeyDown={press} onFailure={props.onFailure} />
</Grid> </Grid>
</Grid> </Grid>