slashGame fix (#132)

* difficulty scales correct phase
* player loses game immediately after guard attacks
This commit is contained in:
Snarling
2022-10-19 15:24:29 -04:00
committed by GitHub
parent ab70591a35
commit b6efe46d4c

View File

@ -40,18 +40,18 @@ export function SlashGame(props: IMinigameProps): React.ReactElement {
}
}
const hasAugment = Player.hasAugmentation(AugmentationNames.MightOfAres, true);
const phaseZeroTime = Math.random() * 3250 + 1500 - (250 + difficulty.window);
const phaseOneTime = 250;
const timeUntilAttacking = phaseZeroTime;
const guardingTime = Math.random() * 3250 + 1500 - (250 + difficulty.window);
const preparingTime = difficulty.window;
const attackingTime = 250;
useEffect(() => {
let id = window.setTimeout(() => {
setPhase(1);
id = window.setTimeout(() => {
setPhase(2);
id = window.setTimeout(() => setPhase(0), difficulty.window);
}, phaseOneTime);
}, phaseZeroTime);
id = window.setTimeout(() => props.onFailure(), attackingTime);
}, preparingTime);
}, guardingTime);
return () => {
clearInterval(id);
};
@ -66,7 +66,7 @@ export function SlashGame(props: IMinigameProps): React.ReactElement {
{hasAugment ? (
<Box sx={{ my: 1 }}>
<Typography variant="h5">Guard will drop in...</Typography>
<GameTimer millis={timeUntilAttacking} onExpire={() => null} ignoreAugment_WKSharmonizer noPaper />
<GameTimer millis={guardingTime} onExpire={() => null} ignoreAugment_WKSharmonizer noPaper />
</Box>
) : (
<></>