diff --git a/src/Infiltration/ui/BribeGame.tsx b/src/Infiltration/ui/BribeGame.tsx index 9a91e8cf4..cd67def9c 100644 --- a/src/Infiltration/ui/BribeGame.tsx +++ b/src/Infiltration/ui/BribeGame.tsx @@ -50,9 +50,23 @@ export function BribeGame(props: IMinigameProps): React.ReactElement { const hasAugment = Player.hasAugmentation(AugmentationNames.AmuletOfPersuasion, true); if (hasAugment) { - upColor = correctIndex < index ? upColor : disabledColor; - downColor = correctIndex > index ? upColor : disabledColor; - choiceColor = correctIndex == index ? Settings.theme.success : disabledColor; + const upIndex = index + 1 >= choices.length ? 0 : index + 1; + let upDistance = correctIndex - upIndex; + if (upIndex > correctIndex) { + upDistance = choices.length - 1 - upIndex + correctIndex; + } + + const downIndex = index - 1 < 0 ? choices.length - 1 : index - 1; + let downDistance = downIndex - correctIndex; + if (downIndex < correctIndex) { + downDistance = downIndex + choices.length - 1 - correctIndex; + } + + const onCorrectIndex = correctIndex == index; + + upColor = upDistance <= downDistance && !onCorrectIndex ? upColor : disabledColor; + downColor = upDistance >= downDistance && !onCorrectIndex ? downColor : disabledColor; + choiceColor = onCorrectIndex ? defaultColor : disabledColor; } function press(this: Document, event: KeyboardEvent): void { diff --git a/src/Infiltration/ui/WireCuttingGame.tsx b/src/Infiltration/ui/WireCuttingGame.tsx index e236c4351..7592cbec5 100644 --- a/src/Infiltration/ui/WireCuttingGame.tsx +++ b/src/Infiltration/ui/WireCuttingGame.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import Grid from "@mui/material/Grid"; import Typography from "@mui/material/Typography"; import { IMinigameProps } from "./IMinigameProps"; @@ -70,6 +70,21 @@ export function WireCuttingGame(props: IMinigameProps): React.ReactElement { return questions.some((q) => q.shouldCut(wires[wireNum - 1], wireNum - 1)); } + useEffect(() => { + // check if we won + const wiresToBeCut = []; + for (let j = 0; j < wires.length; j++) { + let shouldBeCut = false; + for (let i = 0; i < questions.length; i++) { + shouldBeCut = shouldBeCut || questions[i].shouldCut(wires[j], j); + } + wiresToBeCut.push(shouldBeCut); + } + if (wiresToBeCut.every((b, i) => b === cutWires[i])) { + props.onSuccess(); + } + }, [cutWires]); + function press(this: Document, event: KeyboardEvent): void { event.preventDefault(); const wireNum = parseInt(event.key); @@ -82,19 +97,6 @@ export function WireCuttingGame(props: IMinigameProps): React.ReactElement { props.onFailure(); } - // check if we won - const wiresToBeCut = []; - for (let j = 0; j < wires.length; j++) { - let shouldBeCut = false; - for (let i = 0; i < questions.length; i++) { - shouldBeCut = shouldBeCut || questions[i].shouldCut(wires[j], j); - } - wiresToBeCut.push(shouldBeCut); - } - if (wiresToBeCut.every((b, i) => b === next[i])) { - props.onSuccess(); - } - return next; }); }