dungeon-sdk-drikkx
Version:
Shared types and entities for the Dungeon game
56 lines (42 loc) • 1.39 kB
text/typescript
import { Entity, Column, PrimaryColumn, ManyToOne, OneToMany } from 'typeorm';
import { WaveStatus } from '../types/dungeon.types';
import { DungeonRoomEntity } from './dungeon-room.entity';
import { CombatActionEntity } from './combat-action.entity';
import { Item } from '../types/item.types';
import { CharacterDatabase } from '../frontend';
('dungeon_waves')
export class DungeonWaveEntity {
()
id!: string;
()
roomId!: string;
(() => DungeonRoomEntity, room => room.waves)
room!: DungeonRoomEntity;
()
waveNumber!: number;
({
type: 'enum',
enum: WaveStatus,
default: WaveStatus.PENDING
})
status!: WaveStatus;
({ default: false })
completed!: boolean;
('jsonb')
enemies!: CharacterDatabase[];
('jsonb')
rewards!: Item[];
({ type: 'timestamp', nullable: true })
startTime?: Date;
({ type: 'timestamp', nullable: true })
endTime?: Date;
({ type: 'timestamp' })
createdAt!: Date;
({ type: 'timestamp', nullable: true })
completedAt?: Date;
(() => CombatActionEntity, action => action.wave)
combatActions!: CombatActionEntity[];
constructor(partial: Partial<DungeonWaveEntity>) {
Object.assign(this, partial);
}
}