feat(complement-race): add infinite win condition for Steam Sprint mode
PROBLEM: After a few routes in Steam Sprint mode, the "victory!" page was appearing. Steam Sprint is designed to be an infinite game that never ends. ROOT CAUSE: The default config had: winCondition: 'route-based' routeCount: 3 So after completing 3 routes, the validator's checkWinCondition method would find a winner and trigger the results/victory screen (line 835 in Validator). FIX: 1. Added 'infinite' as a new valid winCondition type (game-configs.ts:92) 2. Updated default config to use winCondition: 'infinite' (both in arcade-games/complement-race/index.tsx and lib/arcade/game-configs.ts) 3. Updated checkWinCondition to return null immediately when winCondition === 'infinite' (Validator.ts:815-818) BEHAVIOR: - Steam Sprint now runs indefinitely with infinite routes - Train automatically advances to next route after completing each one - Game never ends unless player manually quits or leaves room - Score and deliveries continue to accumulate across all routes - Other win conditions (route-based, score-based, time-based) still work for custom game modes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -812,6 +812,11 @@ export class ComplementRaceValidator
|
||||
private checkWinCondition(state: ComplementRaceState): string | null {
|
||||
const { config, players } = state
|
||||
|
||||
// Infinite mode: Never end the game
|
||||
if (config.winCondition === 'infinite') {
|
||||
return null
|
||||
}
|
||||
|
||||
// Practice mode: First to reach goal
|
||||
if (config.style === 'practice') {
|
||||
for (const [playerId, player] of Object.entries(players)) {
|
||||
|
||||
@@ -41,7 +41,7 @@ const defaultConfig: ComplementRaceConfig = {
|
||||
passengerCount: 6,
|
||||
maxConcurrentPassengers: 3,
|
||||
raceGoal: 20,
|
||||
winCondition: 'route-based',
|
||||
winCondition: 'infinite', // Sprint mode is infinite by default (Steam Sprint)
|
||||
routeCount: 3,
|
||||
targetScore: 100,
|
||||
timeLimit: 300,
|
||||
|
||||
@@ -89,7 +89,7 @@ export interface ComplementRaceGameConfig {
|
||||
raceGoal: number // questions to win practice mode (default 20)
|
||||
|
||||
// Win Conditions
|
||||
winCondition: 'route-based' | 'score-based' | 'time-based'
|
||||
winCondition: 'route-based' | 'score-based' | 'time-based' | 'infinite'
|
||||
targetScore?: number // for score-based (e.g., 100)
|
||||
timeLimit?: number // for time-based (e.g., 300 seconds)
|
||||
routeCount?: number // for route-based (e.g., 3 routes)
|
||||
@@ -171,7 +171,7 @@ export const DEFAULT_COMPLEMENT_RACE_CONFIG: ComplementRaceGameConfig = {
|
||||
raceGoal: 20,
|
||||
|
||||
// Win conditions
|
||||
winCondition: 'route-based',
|
||||
winCondition: 'infinite', // Sprint mode is infinite by default (Steam Sprint)
|
||||
routeCount: 3,
|
||||
targetScore: 100,
|
||||
timeLimit: 300,
|
||||
|
||||
Reference in New Issue
Block a user