first commit
This commit is contained in:
18
fog/libs/api-interfaces/project.json
Executable file
18
fog/libs/api-interfaces/project.json
Executable 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"]
|
||||
}
|
||||
5
fog/libs/api-interfaces/src/index.ts
Executable file
5
fog/libs/api-interfaces/src/index.ts
Executable 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';
|
||||
8
fog/libs/api-interfaces/src/lib/channel-config.ts
Executable file
8
fog/libs/api-interfaces/src/lib/channel-config.ts
Executable file
@@ -0,0 +1,8 @@
|
||||
import { MissionDifficulty } from './mission';
|
||||
|
||||
export interface ChannelConfig {
|
||||
channelId: string;
|
||||
difficultyPreset: MissionDifficulty;
|
||||
maxPartySize: number;
|
||||
featureFlags: Record<string, boolean>;
|
||||
}
|
||||
19
fog/libs/api-interfaces/src/lib/encounter.ts
Executable file
19
fog/libs/api-interfaces/src/lib/encounter.ts
Executable 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;
|
||||
}
|
||||
35
fog/libs/api-interfaces/src/lib/mission.ts
Executable file
35
fog/libs/api-interfaces/src/lib/mission.ts
Executable 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[];
|
||||
}
|
||||
19
fog/libs/api-interfaces/src/lib/perk.ts
Executable file
19
fog/libs/api-interfaces/src/lib/perk.ts
Executable 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[];
|
||||
}
|
||||
18
fog/libs/api-interfaces/src/lib/survivor.ts
Executable file
18
fog/libs/api-interfaces/src/lib/survivor.ts
Executable 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;
|
||||
}
|
||||
9
fog/libs/api-interfaces/tsconfig.lib.json
Executable file
9
fog/libs/api-interfaces/tsconfig.lib.json
Executable file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"declaration": true,
|
||||
"types": []
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user