dungeon-sdk-drikkx
Version:
Shared types and entities for the Dungeon game
171 lines (157 loc) • 3.97 kB
text/typescript
import { CharacterDatabase, CharacterInDungeon } from './character.types';
import { Item } from './item.types';
import { CombatTurn } from './combat.types';
// ====================================
// Dungeon Enums
// ====================================
export enum DungeonTheme {
CAVE = 'CAVE',
FOREST = 'FOREST',
RUINS = 'RUINS',
CASTLE = 'CASTLE'
}
export enum DungeonDifficulty {
EASY = 'EASY',
MEDIUM = 'MEDIUM',
HARD = 'HARD',
ELITE = 'ELITE'
}
export enum DungeonStatus {
WAITING = 'WAITING',
IN_PROGRESS = 'IN_PROGRESS',
COMPLETED = 'COMPLETED',
FAILED = 'FAILED'
}
export enum RoomType {
COMBAT = 'COMBAT',
ELITE = 'ELITE',
BOSS = 'BOSS'
}
export enum RoomStatus {
PENDING = 'PENDING',
IN_PROGRESS = 'IN_PROGRESS',
COMPLETED = 'COMPLETED'
}
export enum WaveStatus {
PENDING = 'PENDING',
IN_PROGRESS = 'IN_PROGRESS',
COMPLETED = 'COMPLETED'
}
// ====================================
// Wave Types
// ====================================
export interface DungeonWaveDatabase {
id: string;
roomId: string;
waveNumber: number;
status: WaveStatus;
enemies: CharacterDatabase[];
rewards: Item[];
startTime?: Date | null;
endTime?: Date | null;
completed: boolean;
createdAt: Date;
}
export interface ExtendedDungeonWave {
id: string;
roomId: string;
waveNumber: number;
status: WaveStatus;
rewards: Item[];
startTime?: Date | null;
endTime?: Date | null;
completed: boolean;
createdAt: Date;
enemies: CharacterInDungeon[];
}
// ====================================
// Room Types
// ====================================
export interface DungeonRoomDatabase {
id: string;
dungeonId: string;
type: RoomType;
roomNumber: number;
status: RoomStatus;
completed: boolean;
description: string;
createdAt: Date;
completedAt?: Date | null;
waves: DungeonWaveDatabase[];
}
export interface ExtendedDungeonRoom {
id: string;
dungeonId: string;
type: RoomType;
roomNumber: number;
status: RoomStatus;
completed: boolean;
description: string;
createdAt: Date;
completedAt?: Date | null;
waves: ExtendedDungeonWave[];
}
// ====================================
// Dungeon Types
// ====================================
export interface DungeonDatabase {
id: string;
theme: DungeonTheme;
difficulty: DungeonDifficulty;
status: DungeonStatus;
currentRoom: number;
currentWave: number;
totalRooms: number;
totalWaves: number;
party: CharacterDatabase[];
combatHistory: CombatTurn[];
completed: boolean;
createdAt: Date;
startedAt: Date;
completedAt?: Date | null;
createdById: string;
rooms: DungeonRoomDatabase[];
}
export interface ExtendedDungeon {
id: string;
theme: DungeonTheme;
difficulty: DungeonDifficulty;
status: DungeonStatus;
currentRoom: number;
currentWave: number;
totalRooms: number;
totalWaves: number;
party: CharacterInDungeon[];
combatHistory: CombatTurn[];
completed: boolean;
createdAt: Date;
startedAt: Date;
completedAt?: Date | null;
createdById: string;
rooms: ExtendedDungeonRoom[];
}
// ====================================
// State Types
// ====================================
export interface DungeonDatabaseState {
dungeon: DungeonDatabase;
currentRoom: number;
currentWave: number;
activeEnemies: CharacterDatabase[];
waveNumber: number;
combatLog: CombatResultDatabase[];
isComplete: boolean;
}
// ====================================
// Combat Result Types
// ====================================
export interface CombatResultDatabase {
success: boolean;
action: string;
source: CharacterDatabase;
target: CharacterDatabase;
damage: number;
isCritical: boolean;
effects: string[];
waveCompleted: boolean;
}