From b44dbf3bc9534ec83e931da71e54c619ae7f4716 Mon Sep 17 00:00:00 2001 From: Alexandre Sanchez Date: Tue, 17 Dec 2024 13:18:26 +0100 Subject: [PATCH] feat(livesplit): wip on timer penalty rules update --- components/livesplit/liveSplitManager.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/components/livesplit/liveSplitManager.ts b/components/livesplit/liveSplitManager.ts index 699225753..94c0b4796 100644 --- a/components/livesplit/liveSplitManager.ts +++ b/components/livesplit/liveSplitManager.ts @@ -64,14 +64,15 @@ export class LiveSplitManager { missionIntentResolved(contractId: string, startId: string): void { if ( - LiveSplitManager._isClub27(contractId) && - LiveSplitManager._isBangkokDefaultStartLocation(startId) + (LiveSplitManager._isClub27(contractId) && + LiveSplitManager._isBangkokDefaultStartLocation(startId)) || + LiveSplitManager._isSarajevoSixLevel(contractId) ) { this._resetMinimum = 10 return } - this._resetMinimum = 0 + this._resetMinimum = 1 } async startMission( @@ -393,6 +394,13 @@ export class LiveSplitManager { ].includes(startLocationId) } + private static _isSarajevoSixLevel(contractId: string): boolean { + return [ + "*contractId*", + // TODO: Add S6 level contract IDs + ].includes(contractId) + } + private async _setGameTime(totalTime: Seconds): Promise { // IMPORTANT to floor to int before sending to livesplit or else parsing will fail silently... const flooredTime = Math.floor(totalTime) @@ -412,13 +420,10 @@ export class LiveSplitManager { private _addMissionTime(time: Seconds): Seconds { let computedTime = Math.floor(time) - // always add at least minimum, which is usually 0 except on cutscenes where + // always add a minimum reset penalty, which is 1s except on cutscenes where // you can gain an advantage by restarting in cs (bangkok, sgail specific starts) if (time <= this._resetMinimum) { computedTime = this._resetMinimum - } else if (time > 0 && time <= 1) { - // if in game time is between 0 and 1, add full second - computedTime = 1 } this._currentMissionTotalTime += computedTime