From a83a09946b20a5d425af8b0c9a797a1d13af23c3 Mon Sep 17 00:00:00 2001 From: TorsteinTenstad <99toten@gmail.com> Date: Sun, 8 Oct 2023 19:41:28 +0200 Subject: [PATCH 1/2] Add RTC fast mode. Fix multiplier not being reset on segment selection. --- src/components/RtcGameInput.vue | 48 ++++++++++++++++++++++++++++-- src/components/RtcOptionsInput.vue | 18 ++++++++++- src/components/X01GameInput.vue | 1 + src/games/rtc.ts | 18 ++++++++--- 4 files changed, 77 insertions(+), 8 deletions(-) diff --git a/src/components/RtcGameInput.vue b/src/components/RtcGameInput.vue index d46236b..3ea7f1e 100644 --- a/src/components/RtcGameInput.vue +++ b/src/components/RtcGameInput.vue @@ -1,14 +1,56 @@ diff --git a/src/components/X01GameInput.vue b/src/components/X01GameInput.vue index 75c7773..02ed247 100644 --- a/src/components/X01GameInput.vue +++ b/src/components/X01GameInput.vue @@ -64,6 +64,7 @@ const selectSector = (sector: number) => { sector: sector, }) } + selectedMultiplier.value = 1 } diff --git a/src/games/rtc.ts b/src/games/rtc.ts index b5b65ba..16ff096 100644 --- a/src/games/rtc.ts +++ b/src/games/rtc.ts @@ -28,9 +28,13 @@ export const getRtcController = (game: Game): GameController => { getSegmentText(segment) { return segment ? `${segment.sector}` : '-' }, - recordHit() { + recordHit(segment) { + console.log(getTypeAttribute(game, 'fast', false)) + if (!segment) return gameStore.saveScore({ - multiplier: getTypeAttribute(game, 'mode', 1), + multiplier: getTypeAttribute(game, 'fast', false) + ? segment.multiplier + : getTypeAttribute(game, 'mode', 1), sector: getCurrentSector(getVisitsOfUser(game, gameStore.userId)), }) }, @@ -41,7 +45,7 @@ export const getRtcController = (game: Game): GameController => { } const getCurrentSector = (visits: Visit[]) => { - return Math.max(1, ...visits.flat().map((s) => (s ? s.sector + 1 : 0))) + return getRtcLegScore(visits) + 1 } const sumNumbers = (numbers: number[]) => { @@ -53,5 +57,11 @@ export const getRtcLegScore = (visits: Visit[]) => { } const getVisitScore = (visit: Visit) => { - return visit.filter((seg) => seg != null && seg.sector != 0).length + const gameStore = useGameStore() + const isFast = gameStore.game + ? getTypeAttribute(gameStore.game, 'fast', false) + : false + return sumNumbers( + visit.map((seg) => (seg ? (isFast ? seg.multiplier : 1) : 0)) + ) } From d3935fd6f16815c71b2573de1221298fa34d9443 Mon Sep 17 00:00:00 2001 From: magnetenstad Date: Sun, 8 Oct 2023 20:24:59 +0200 Subject: [PATCH 2/2] Fix bugs in RTC modes --- src/components/RtcGameInput.vue | 29 ++++++++++++++-------- src/components/RtcOptionsInput.vue | 12 ++++++--- src/games/rtc-random.ts | 28 +++------------------ src/games/rtc.ts | 39 ++++++++++++++---------------- src/types/game.ts | 2 +- 5 files changed, 51 insertions(+), 59 deletions(-) diff --git a/src/components/RtcGameInput.vue b/src/components/RtcGameInput.vue index 3ea7f1e..347fddf 100644 --- a/src/components/RtcGameInput.vue +++ b/src/components/RtcGameInput.vue @@ -27,14 +27,24 @@