refactor(api): move RandomSource to shared and add rollInclusive
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ import { Hunt } from './entities/hunt.entity';
|
||||
import { HuntEncounter } from './entities/hunt-encounter.entity';
|
||||
import { HuntingController } from './hunting.controller';
|
||||
import { HuntingService } from './hunting.service';
|
||||
import { RANDOM_SOURCE, systemRandomSource } from './random-source';
|
||||
import { RANDOM_SOURCE, systemRandomSource } from '../shared/random-source';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
||||
@@ -12,7 +12,7 @@ import { HuntEncounter } from './entities/hunt-encounter.entity';
|
||||
import { HuntStatus } from './hunt-status.enum';
|
||||
import { HuntingDomainError } from './hunting.errors';
|
||||
import { HuntingService } from './hunting.service';
|
||||
import type { RandomSource } from './random-source';
|
||||
import type { RandomSource } from '../shared/random-source';
|
||||
|
||||
const CHARACTER_ID = '10000000-0000-4000-8000-000000000001';
|
||||
const HUNTING_LOCATION_ID = '20000000-0000-4000-8000-000000000001';
|
||||
|
||||
@@ -16,8 +16,8 @@ import {
|
||||
huntingNotAvailable,
|
||||
noHuntEncountersAvailable,
|
||||
} from './hunting.errors';
|
||||
import { RANDOM_SOURCE } from './random-source';
|
||||
import type { RandomSource } from './random-source';
|
||||
import { RANDOM_SOURCE } from '../shared/random-source';
|
||||
import type { RandomSource } from '../shared/random-source';
|
||||
|
||||
export interface MonsterSummary {
|
||||
key: string;
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
export interface RandomSource {
|
||||
next(): number; // uniform value in [0, 1)
|
||||
}
|
||||
|
||||
export const RANDOM_SOURCE = Symbol('RANDOM_SOURCE');
|
||||
|
||||
export const systemRandomSource: RandomSource = {
|
||||
next: () => Math.random(),
|
||||
};
|
||||
Reference in New Issue
Block a user