first commit

This commit is contained in:
Hussar
2026-04-12 16:43:45 +01:00
commit 9213df4828
79 changed files with 2204 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
{
"name": "api-interfaces",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/api-interfaces/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/api-interfaces",
"main": "libs/api-interfaces/src/index.ts",
"tsConfig": "libs/api-interfaces/tsconfig.lib.json"
}
}
},
"tags": ["scope:shared"]
}

View File

@@ -0,0 +1,5 @@
export * from './lib/survivor';
export * from './lib/mission';
export * from './lib/perk';
export * from './lib/encounter';
export * from './lib/channel-config';

View File

@@ -0,0 +1,8 @@
import { MissionDifficulty } from './mission';
export interface ChannelConfig {
channelId: string;
difficultyPreset: MissionDifficulty;
maxPartySize: number;
featureFlags: Record<string, boolean>;
}

View File

@@ -0,0 +1,19 @@
import { MissionDifficulty, MissionState } from './mission';
import { SurvivorStats } from './survivor';
export interface EncounterResult {
outcome: 'success' | 'injury' | 'sacrifice';
text: string;
successChance: number;
roll: number;
nextState: MissionState;
nextStats: SurvivorStats;
}
export interface ResolveEncounterInput {
stats: SurvivorStats;
difficulty: MissionDifficulty;
perkIds: string[];
tickIndex: number;
seed?: number;
}

View File

@@ -0,0 +1,35 @@
import { SurvivorStats } from './survivor';
export enum MissionState {
Lobby = 'Lobby',
InProgress = 'InProgress',
Completed = 'Completed',
Failed = 'Failed'
}
export enum MissionDifficulty {
Easy = 'Easy',
Normal = 'Normal',
Hard = 'Hard',
Nightmare = 'Nightmare'
}
export interface EncounterLogLine {
sequence: number;
event: string;
text: string;
successChance: number;
roll: number;
}
export interface MissionSnapshot {
id: string;
channelId: string;
survivorId: string;
state: MissionState;
difficulty: MissionDifficulty;
tickIndex: number;
recentLog: EncounterLogLine[];
stats: SurvivorStats;
perkIds: string[];
}

View File

@@ -0,0 +1,19 @@
export enum ModifierKind {
Additive = 'additive',
Multiplicative = 'multiplicative',
FlatReroll = 'flat_reroll'
}
export interface PerkModifier {
id: string;
kind: ModifierKind;
value: number;
teamPerk?: boolean;
}
export interface Perk {
id: string;
name: string;
description: string;
modifiers: PerkModifier[];
}

View File

@@ -0,0 +1,18 @@
export enum SurvivorState {
Active = 'Active',
Injured = 'Injured',
Sacrificed = 'Sacrificed'
}
export interface SurvivorStats {
health: number;
stealth: number;
teamwork: number;
luck: number;
}
export interface Survivor {
id: string;
state: SurvivorState;
stats: SurvivorStats;
}

View File

@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": []
},
"include": ["src/**/*.ts"]
}