Add Week 3 polish and late-game features

VC funding system (seed through IPO with requirements gating), 15
achievements with engine checker, model tuning presets and unlockable
sliders, overload policy controls, open-source mechanic with reputation
boost, enhanced Recharts analytics (subscriber/reputation/revenue vs
expenses charts), M&A acquisition system, sidebar NEW badges on era
transitions, tutorial hints, and wired-up settings toggles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-24 17:56:40 -04:00
parent 8ea6c771a1
commit 8a8b49d934
20 changed files with 907 additions and 75 deletions
+44 -2
View File
@@ -1,4 +1,4 @@
import type { GameState, EventDefinition } from '@ai-tycoon/shared';
import type { GameState, EventDefinition, AchievementDefinition } from '@ai-tycoon/shared';
import { processEconomy } from './systems/economySystem';
import { processInfrastructure } from './systems/infrastructureSystem';
import { processCompute } from './systems/computeSystem';
@@ -11,6 +11,8 @@ import { processEvents } from './systems/eventSystem';
import { processCompetitors } from './systems/competitorSystem';
import { processData } from './systems/dataSystem';
import { checkEraTransition } from './systems/eraSystem';
import { processAchievements } from './systems/achievementSystem';
import { computeValuation } from './systems/fundingSystem';
export interface TickResult {
state: Partial<GameState>;
@@ -24,11 +26,16 @@ export interface TickNotification {
}
let cachedEventDefs: EventDefinition[] | null = null;
let cachedAchievementDefs: AchievementDefinition[] | null = null;
export function setEventDefinitions(defs: EventDefinition[]) {
cachedEventDefs = defs;
}
export function setAchievementDefinitions(defs: AchievementDefinition[]) {
cachedAchievementDefs = defs;
}
export function processTick(state: GameState): Partial<GameState> {
const notifications: TickNotification[] = [];
@@ -102,9 +109,43 @@ export function processTick(state: GameState): Partial<GameState> {
});
}
const valuation = computeValuation({ ...stateWithTalent, economy, reputation, research: researchResult.research });
const updatedEconomy = {
...economy,
funding: { ...economy.funding, valuation },
};
const stateForAchievements: GameState = {
...stateWithTalent,
meta,
economy: updatedEconomy,
infrastructure,
compute,
research: researchResult.research,
models: modelResult.modelsState,
market: market.marketState,
reputation,
data,
competitors,
events: eventResult.events,
achievements: state.achievements,
};
const achievementResult = cachedAchievementDefs
? processAchievements(stateForAchievements, cachedAchievementDefs)
: { achievements: state.achievements, newAchievements: [] };
for (const name of achievementResult.newAchievements) {
notifications.push({
title: 'Achievement Unlocked!',
message: name,
type: 'success',
});
}
const result: Partial<GameState> = {
meta,
economy,
economy: updatedEconomy,
infrastructure,
compute,
research: researchResult.research,
@@ -115,6 +156,7 @@ export function processTick(state: GameState): Partial<GameState> {
data,
competitors,
events: eventResult.events,
achievements: achievementResult.achievements,
};
(result as Record<string, unknown>)['_notifications'] = notifications;