diff --git a/project/src/services/RaidTimeAdjustmentService.ts b/project/src/services/RaidTimeAdjustmentService.ts index 0fd2d27a..a62b2384 100644 --- a/project/src/services/RaidTimeAdjustmentService.ts +++ b/project/src/services/RaidTimeAdjustmentService.ts @@ -205,28 +205,48 @@ export class RaidTimeAdjustmentService MaxTime: null, Chance: null } + + // At what minute we simulate the player joining the raid + const simulatedRaidEntryTimeMinutes = mapBase.EscapeTimeLimit - newRaidTimeMinutes; + // How many seconds have elapsed in the raid when the player joins + const reductionSeconds = simulatedRaidEntryTimeMinutes * 60; + + // Delay between the train extract activating and it becoming available to board + // + // Test method for determining this value: + // 1) Set MinTime, MaxTime, and Count for the train extract all to 120 + // 2) Load into Reserve or Lighthouse as a PMC (both have the same result) + // 3) Board the train when it arrives + // 4) Check the raid time on the Raid Ended Screen (it should always be the same) + // + // trainArrivalDelaySeconds = [raid time on raid-ended screen] - MaxTime - Count - ExfiltrationTime + // Example: Raid Time = 5:33 = 333 seconds + // trainArrivalDelaySeconds = 333 - 120 - 120 - 5 = 88 + // + // I added 2 seconds just to be safe... + // + const trainArrivalDelaySeconds = 90; + + // Determine the earliest possible time in the raid when the train would leave + const earliestPossibleDepartureMinutes = (exit.MinTime + exit.Count + exit.ExfiltrationTime + trainArrivalDelaySeconds) / 60; + // If raid is after last moment train can leave, assume train has already left, disable extract - const latestPossibleDepartureMinutes = (exit.MaxTime + exit.Count) / 60; - if (newRaidTimeMinutes < latestPossibleDepartureMinutes) + const mostPossibleTimeRemainingAfterDeparture = mapBase.EscapeTimeLimit - earliestPossibleDepartureMinutes; + if (newRaidTimeMinutes < mostPossibleTimeRemainingAfterDeparture) { exitChange.Chance = 0; - this.logger.debug(`Train Exit: ${exit.Name} disabled as new raid time ${newRaidTimeMinutes} minutes is below ${latestPossibleDepartureMinutes} minutes`); - + this.logger.debug(`Train Exit: ${exit.Name} disabled as new raid time ${newRaidTimeMinutes} minutes is below ${mostPossibleTimeRemainingAfterDeparture} minutes`); + result.push(exitChange); continue; } - - // What minute we simulate the player joining a raid at - const simulatedRaidEntryTimeMinutes = mapBase.EscapeTimeLimit - newRaidTimeMinutes; - - // How many seconds to reduce extract arrival times by, negative values seem to make extract turn red in game - const reductionSeconds = simulatedRaidEntryTimeMinutes * 60; - - exitChange.MinTime = exit.MinTime - reductionSeconds; - exitChange.MaxTime = exit.MaxTime - reductionSeconds; + + // Reduce extract arrival times. Negative values seem to make extract turn red in game. + exitChange.MinTime = Math.max(exit.MinTime - reductionSeconds, 0); + exitChange.MaxTime = Math.max(exit.MaxTime - reductionSeconds, 0); this.logger.debug(`Train appears between: ${exitChange.MinTime} and ${exitChange.MaxTime} seconds raid time`); @@ -237,4 +257,4 @@ export class RaidTimeAdjustmentService ? result : null ; } -} \ No newline at end of file +}