-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtypes.ts
More file actions
524 lines (472 loc) · 14.9 KB
/
Copy pathtypes.ts
File metadata and controls
524 lines (472 loc) · 14.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
export enum GameState {
MENU = 'MENU',
BRIEFING = 'BRIEFING',
COMBAT = 'COMBAT',
HANGAR = 'HANGAR',
EVENT = 'EVENT',
VICTORY = 'VICTORY',
DEFEAT = 'DEFEAT',
ENDLESS = 'ENDLESS'
}
export enum PilotId {
VANGUARD = 'vanguard',
SOLARIS = 'solaris',
HYDRA = 'hydra',
WYRM = 'wyrm',
GHOST = 'ghost'
}
export type PilotModule = 'ASSAULT' | 'DEFENSE';
export type HazardType = 'NONE' | 'ACID_RAIN' | 'ION_STORM' | 'SEISMIC_ACTIVITY';
export type EnemyIntent = 'ATTACK' | 'HEAL' | 'CHARGE' | 'DEFEND';
export type StatusType = 'SHIELDED' | 'OVERDRIVE' | 'STUNNED' | 'BURNING';
export type MissionType = 'ASSAULT' | 'DEFENSE' | 'SURVIVAL';
export type EnemyAffix = 'NONE' | 'VOLATILE' | 'SHIELDED' | 'VAMPIRIC' | 'SWIFT' | 'ARMORED';
// Difficulty & Modifiers System
export type DifficultyLevel = 'RECRUIT' | 'VETERAN' | 'ELITE' | 'NIGHTMARE';
export type DailyModifier = 'DOUBLE_HAZARDS' | 'BOSS_RUSH' | 'PACIFIST' | 'NONE';
export interface DifficultyConfig {
id: DifficultyLevel;
name: string;
icon: string;
enemyHpMult: number;
enemyDmgMult: number;
scrapMult: number;
permadeath: boolean;
lives: number;
description: string;
}
// Crafting System
export interface CraftingRecipe {
id: string;
name: string;
result: Consumable;
requirements: {
consumableId?: string;
count: number;
scrap?: number;
}[];
description: string;
unlockedAtStage?: number; // New property: stage at which the recipe unlocks
}
export type BossAbilityType =
| 'AOE_LASER_BARRAGE' // Damages player (multi-hit)
| 'SHIELD_WALL' // Gains temporary invulnerability
| 'SUMMON_ADDS' // Spawns minion enemies
| 'OVERLOAD' // High damage single target
| 'REGENERATE' // Heals HP over time
| 'PHASE_SHIFT' // Becomes evasive
| 'GRAVITY_WELL' // Slows player charge rate
| 'CORRUPTED_DATA' // DoT effect on player
| 'ENERGY_DRAIN' // Drains player energy (Solaris)
| 'HEAT_SURGE'; // Increases player heat (Hydra)
export interface BossPhase {
hpThreshold: number; // HP% to trigger this phase (100, 66, 33, 0)
abilities: BossAbilityType[]; // Available abilities in this phase
pattern: 'AGGRESSIVE' | 'DEFENSIVE' | 'BERSERK' | 'TACTICAL';
statusImmunities?: StatusType[]; // Immune to specific statuses
dialogue?: string; // Phase transition dialogue
damageMultiplier?: number; // Optional damage modifier
speedMultiplier?: number; // Optional speed modifier
}
export interface BossDialogue {
intro: string[]; // Lines before combat
phaseTransitions: string[]; // Lines when changing phases
defeat: string; // Final words
victory?: string; // If player loses
}
export interface BossTemplate {
id: string;
name: string;
title: string; // e.g., "ALPHA SENTINEL: PERIMETER GUARDIAN"
maxHp: number;
speed: number;
damage: number;
flavorText: string;
scrapValue: number;
phases: BossPhase[];
dialogue: BossDialogue;
minionsTemplate?: { // For bosses that summon
name: string;
maxHp: number;
damage: number;
speed: number;
};
}
export interface BossData {
templateId: string;
currentPhaseIndex: number;
phasesTriggered: number[];
lastAbilityUsed: number; // timestamp
abilityChargeProgress: number; // 0-100 for charged abilities
}
export interface ActiveStatus {
id: string;
type: StatusType;
durationMs: number;
value?: number; // e.g., burn damage per tick
}
export interface Consumable {
id: string;
name: string;
description: string;
count: number;
maxCount: number;
color: string;
cost: number;
}
export interface Loadout {
id: string; // Unique identifier
name: string;
pilotId: PilotId;
module: PilotModule;
consumables: Consumable[];
color: string; // Hex color for customization
createdAt: number; // Timestamp
lastUsed?: number; // Track usage
}
export interface Augmentation {
id: string;
name: string;
description: string;
rarity: 'COMMON' | 'RARE' | 'LEGENDARY';
cost: number;
icon: string; // Brief ASCII or Symbol representation
synergyId?: SynergyId;
}
export interface Ability {
id: string;
name: string;
description: string;
damageMult: number;
cooldownMs: number; // Time in MS before reuse
energyCost?: number;
heatCost?: number;
isAoe?: boolean; // Hits all enemies?
stuns?: boolean; // Resets enemy ATB?
}
export interface PilotConfig {
id: PilotId;
name: string;
mechName: string;
flavor: string;
color: string;
textColor: string;
borderColor: string;
statsDescription: string;
mechanicDescription: string;
baseHp: number;
baseSpeed: number;
baseDamage: number;
abilities: Ability[];
unlockLevel?: number;
unlockKills?: number;
}
export interface CombatLogEntry {
id: string;
text: string;
type: 'info' | 'damage' | 'enemy' | 'alert' | 'special' | 'hazard' | 'crit' | 'status' | 'loot';
timestamp: number;
}
export interface Enemy {
id: string;
name: string;
maxHp: number;
currentHp: number;
speed: number;
damage: number;
scrapValue: number;
flavorText: string;
intent: EnemyIntent;
isCharged: boolean;
actionCharge: number; // 0-100% ATB Gauge
statuses: ActiveStatus[];
isBoss?: boolean;
affix?: EnemyAffix; // Elite modifier
bossData?: BossData; // Only for boss enemies
weakPoint?: WeakPoint; // NEW: Optional weak point for advanced combat
}
// Combo state tracking for combo system
export interface ComboState {
count: number;
lastHitTime: number;
multiplier: number;
}
// Enemy weak point definition
export interface WeakPoint {
abilityType?: string; // Specific ability ID substring that triggers (e.g., 'emp', 'laser')
damageMultiplier: number; // Usually 2.0
description: string;
}
export type CombatEffect = 'NORMAL' | 'CRITICAL' | 'COUNTER' | 'WEAK_POINT' | 'COMBO';
// Synergy System
export type SynergyId =
// Augmentation Synergies
| 'INFERNO'
| 'BLOOD_SHELL'
// Talent Synergies
| 'vanguard_unbreakable'
| 'vanguard_iron_will'
| 'solaris_solar_flare'
| 'solaris_energy_overload'
| 'hydra_phantom_protocol'
| 'wyrm_living_tank'
| 'ghost_shadow_assassin';
export interface SynergyEffect {
type: string;
value: number;
}
export interface Synergy {
id: SynergyId;
name: string;
description: string;
augmentationIds: string[]; // Augmentations or Talents required for this synergy
effects?: SynergyEffect[]; // Optional effects for the synergy
}
export interface PlayerProfile {
xp: number;
level: number;
missionsCompleted: number;
totalKills: number;
}
export interface RunState {
isActive: boolean;
currentStage: number; // 1 to 5
scrap: number;
currentHp: number; // Persist HP between stages
maxHpUpgrade: number;
damageUpgrade: number;
consumables: Consumable[];
augmentations: string[]; // IDs of acquired augmentations
pilotId?: PilotId;
moduleId?: PilotModule;
missionType?: MissionType;
}
export interface GameEvent {
id: string;
title: string;
text: string;
choices: {
text: string;
outcomeText: string;
effect: (runState: RunState) => Partial<RunState>; // Returns state updates
}[];
}
export interface GameSettings {
reduceMotion: boolean;
slowLogs: boolean;
// Audio Settings
volume: number; // 0.0 - 1.0
musicVolume: number; // 0.0 - 1.0
sfxVolume: number; // 0.0 - 1.0
isMuted: boolean;
voiceLinesEnabled: boolean;
// Visual Settings
showDamageNumbers: boolean;
screenShake: boolean;
performanceMode?: boolean;
combatLogFontSize?: number;
colorblindMode?: 'none' | 'protanopia' | 'deuteranopia' | 'tritanopia';
keybindings?: Record<string, string>;
// Gameplay Settings
combatSpeed: 'slow' | 'normal' | 'fast';
tutorialCompleted: boolean;
autoSaveInterval?: number;
}
export interface GameStats {
// Combat Stats
totalDamageDealt: number;
totalDamageTaken: number;
criticalHits: number;
abilitiesUsed: number;
// Victory Stats
fastestWinTime: number; // in seconds, 0 = not set
longestWinStreak: number;
currentWinStreak: number;
perfectRuns: number; // Runs completed without taking damage
// Boss Stats
bossesDefeated: number;
bossesDefeatedLowHp: number; // < 20% HP
bossesPerfect: number; // No damage taken
// Item Stats
consumablesUsed: number;
augmentationsOwned: string[];
pilotsUnlocked: string[];
// Survival Stats
survivalWins: number;
defenseWins: number;
highestStageReached: number;
// Time Stats
totalPlayTimeSeconds: number;
runStartTime?: number; // Track current run start
// Flags for specific achievements
noDamageTakenThisRun: boolean;
noConsumablesUsedThisRun: boolean;
// NEW: Detailed Statistics
runsCompleted: number;
runsFailed: number;
pilotUsageCount: Record<string, number>; // PilotId -> count
pilotStats: Record<string, {
wins: number;
losses: number;
totalDamageDealt: number;
totalDamageTaken: number;
kills: number;
timePlayed: number;
}>;
enemiesKilledByType: Record<string, number>; // Enemy name -> count
hazardsSurvived: Record<string, number>; // HazardType -> count
itemsUsedByType: Record<string, number>; // Consumable ID -> count
abilitiesUsedByType: Record<string, number>; // Ability ID -> count
stageStats: Record<number, {
wins: number;
losses: number;
totalDamageDealt: number;
totalDamageTaken: number;
kills: number;
timePlayed: number;
}>;
killTimestamps: { enemyName: string, timestamp: number }[];
// Endless Mode Stats
endlessHighestWave?: number;
endlessHighScore?: number;
endlessRunsCompleted?: number;
}
export interface Achievement {
id: string;
name: string;
description: string;
category: 'COMBAT' | 'SURVIVAL' | 'SPEED' | 'COLLECTION' | 'MASTERY';
icon: string; // Emoji or symbol
rarity: 'COMMON' | 'RARE' | 'EPIC' | 'LEGENDARY';
hidden?: boolean; // Hide from UI until unlocked
condition: (stats: GameStats, profile: PlayerProfile) => boolean;
reward?: {
type: 'TITLE' | 'XP' | 'UNLOCK';
value: string | number;
};
}
export interface AchievementProgress {
achievementId: string;
unlockedAt: number; // Timestamp
justUnlocked?: boolean; // For notification display
}
export interface GameContextType {
profile: PlayerProfile;
settings: GameSettings;
runState: RunState;
hasActiveRun: boolean;
stats: GameStats;
achievements: AchievementProgress[];
loadouts: Loadout[];
addXp: (amount: number) => void;
addKill: () => void;
addScrap: (amount: number) => void;
startRun: (pilot: PilotConfig, module: PilotModule, consumables: Consumable[]) => void;
endRun: () => void;
updateRunHp: (hp: number) => void;
updateRunConsumables: (consumables: Consumable[]) => void;
updateRunState: (updates: Partial<RunState>) => void;
purchaseUpgrade: (type: 'hp' | 'dmg' | 'repair' | 'item' | 'aug', itemId?: string, cost?: number) => void;
purchaseAugmentation: (augmentationId: string, cost: number) => void;
advanceStage: () => void;
toggleSetting: (setting: keyof GameSettings) => void;
updateSettings: (updates: Partial<GameSettings>) => void;
isPilotUnlocked: (pilot: PilotConfig) => boolean;
// Achievement system
checkAchievements: () => AchievementProgress[];
recordStat: (stat: keyof GameStats, value: number | string | string[]) => void;
incrementStat: (stat: keyof GameStats, amount?: number) => void;
startRunTimer: () => void;
endRunTimer: () => number;
recordDamageDealt: (amount: number) => void;
recordDamageTaken: (amount: number) => void;
recordCriticalHit: () => void;
// NEW: Detailed statistics tracking
recordRunOutcome: (success: boolean) => void;
recordPilotUsage: (pilotId: PilotId) => void;
recordEnemyKill: (enemyName: string) => void;
recordHazardSurvival: (hazardType: HazardType) => void;
recordItemUsage: (itemId: string) => void;
recordAbilityUsage: (abilityId: string) => void;
// NEW: Loadout management
createLoadout: (name: string, pilotId: PilotId, module: PilotModule, consumables: Consumable[], color: string) => void;
updateLoadout: (id: string, updates: Partial<Loadout>) => void;
deleteLoadout: (id: string) => void;
applyLoadout: (id: string) => { pilot: PilotConfig, module: PilotModule, consumables: Consumable[] } | null;
// NEW: Difficulty & Modifiers System
difficulty: DifficultyLevel;
dailyModifier: DailyModifier;
lives: number;
setDifficulty: (level: DifficultyLevel) => void;
getDailyModifier: () => DailyModifier;
loseLife: () => void;
// NEW: Crafting System
craftedItems: Consumable[];
craftItem: (recipeId: string) => boolean;
canCraft: (recipeId: string) => boolean;
// NEW: Endless Mode System
endlessState: EndlessRunState;
leaderboard: EndlessLeaderboardEntry[];
startEndlessRun: (pilot: PilotConfig, module: PilotModule, consumables: Consumable[]) => void;
endEndlessRun: () => void;
advanceEndlessWave: () => void;
applyEndlessUpgrade: (upgradeId: string) => void;
getLeaderboard: (filters?: { difficulty?: DifficultyLevel; pilotId?: PilotId }) => EndlessLeaderboardEntry[];
calculateEndlessScore: () => number;
updateEndlessState: (updates: Partial<EndlessRunState>) => void;
// NEW: Codex/Lore System
codex: import('./types/codex').CodexState;
unlockCodexPilot: (pilotId: PilotId) => void;
unlockCodexLore: (loreId: string) => void;
unlockCodexAudioLog: (chance?: number) => void;
recordCodexEnemyKill: (enemyType: string) => void;
markCodexEntryRead: (entryId: string) => void;
getCodexProgress: () => import('./types/codex').CodexProgress;
// NEW: Replay System
replayState: import('./types/replay').ReplayState;
saveReplay: (replay: import('./types/replay').CombatReplay) => void;
deleteReplay: (replayId: string) => void;
clearAllReplays: () => void;
getReplayById: (id: string) => import('./types/replay').CombatReplay | undefined;
// NEW: Talent System
talentState: import('./types/talents').PlayerTalentState;
unlockTalent: (pilotId: PilotId, talent: import('./types/talents').Talent) => void;
resetTalents: (pilotId: PilotId) => void;
}
// Endless Mode System Types
export interface EndlessRunState {
isActive: boolean;
currentWave: number;
totalKills: number;
waveKills: number;
startTime: number;
lastUpgradeWave: number;
currentHp: number;
maxHp: number;
baseDamage: number;
scrap: number;
consumables: Consumable[];
augmentations: string[];
pilotId?: PilotId;
moduleId?: PilotModule;
appliedUpgrades: string[]; // Track which upgrades have been applied
cooldownReduction: number; // Percentage cooldown reduction from upgrades
}
export interface EndlessLeaderboardEntry {
id: string;
wave: number;
kills: number;
score: number;
pilotId: PilotId;
difficulty: DifficultyLevel;
date: number;
survivalTimeSeconds: number;
}
export interface EndlessUpgrade {
id: string;
name: string;
description: string;
rarity: 'COMMON' | 'RARE' | 'LEGENDARY';
icon: string;
apply: (state: EndlessRunState) => EndlessRunState;
}