@ai-rpg-engine/modules 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/pressure-resolution.d.ts +67 -0
- package/dist/pressure-resolution.d.ts.map +1 -0
- package/dist/pressure-resolution.js +445 -0
- package/dist/pressure-resolution.js.map +1 -0
- package/dist/pressure-system.d.ts +101 -0
- package/dist/pressure-system.d.ts.map +1 -0
- package/dist/pressure-system.js +579 -0
- package/dist/pressure-system.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { PlayerRumor } from './player-rumor.js';
|
|
2
|
+
import type { PressureResolution } from './pressure-resolution.js';
|
|
3
|
+
export type PressureKind = 'bounty-issued' | 'faction-summons' | 'merchant-blacklist' | 'revenge-attempt' | 'investigation-opened' | 'heresy-whisper' | 'chapel-sanction' | 'case-opened' | 'witness-vanished' | 'mutiny-brewing' | 'navy-bounty' | 'infection-suspicion' | 'camp-panic' | 'corp-manhunt' | 'ice-escalation';
|
|
4
|
+
export type PressureVisibility = 'hidden' | 'rumored' | 'known' | 'public';
|
|
5
|
+
export type WorldPressure = {
|
|
6
|
+
id: string;
|
|
7
|
+
kind: PressureKind;
|
|
8
|
+
/** Faction that generated this pressure */
|
|
9
|
+
sourceFactionId: string;
|
|
10
|
+
/** Structured claim about what this pressure represents */
|
|
11
|
+
description: string;
|
|
12
|
+
/** What triggered it — rumor id, milestone label, or event type */
|
|
13
|
+
triggeredBy: string;
|
|
14
|
+
/** 0-1, higher = more imminent */
|
|
15
|
+
urgency: number;
|
|
16
|
+
/** How widely known this pressure is */
|
|
17
|
+
visibility: PressureVisibility;
|
|
18
|
+
/** Turns remaining before expiry (null = permanent until resolved) */
|
|
19
|
+
turnsRemaining: number | null;
|
|
20
|
+
/** Possible outcomes if the player engages or ignores */
|
|
21
|
+
potentialOutcomes: string[];
|
|
22
|
+
/** Genre/thematic tags */
|
|
23
|
+
tags: string[];
|
|
24
|
+
/** Engine tick when created */
|
|
25
|
+
createdAtTick: number;
|
|
26
|
+
/** Set when pressure is resolved (transitions from active to resolved) */
|
|
27
|
+
resolution?: PressureResolution;
|
|
28
|
+
/** If this pressure was spawned by fallout from another pressure */
|
|
29
|
+
chainedFrom?: string;
|
|
30
|
+
};
|
|
31
|
+
export type PressureInputs = {
|
|
32
|
+
playerRumors: PlayerRumor[];
|
|
33
|
+
reputation: Array<{
|
|
34
|
+
factionId: string;
|
|
35
|
+
value: number;
|
|
36
|
+
}>;
|
|
37
|
+
milestones: Array<{
|
|
38
|
+
label: string;
|
|
39
|
+
tags: string[];
|
|
40
|
+
}>;
|
|
41
|
+
factionStates: Record<string, {
|
|
42
|
+
alertLevel: number;
|
|
43
|
+
cohesion: number;
|
|
44
|
+
}>;
|
|
45
|
+
districtMetrics?: Record<string, {
|
|
46
|
+
alertPressure: number;
|
|
47
|
+
rumorDensity: number;
|
|
48
|
+
stability: number;
|
|
49
|
+
}>;
|
|
50
|
+
playerLevel: number;
|
|
51
|
+
totalTurns: number;
|
|
52
|
+
activePressures: WorldPressure[];
|
|
53
|
+
/** From PackMetadata.genres[0], e.g. 'fantasy', 'cyberpunk' */
|
|
54
|
+
genre: string;
|
|
55
|
+
/** Current engine tick for timestamps */
|
|
56
|
+
currentTick: number;
|
|
57
|
+
};
|
|
58
|
+
export type PressureSpawnResult = {
|
|
59
|
+
pressure: WorldPressure;
|
|
60
|
+
/** One-line reason for director mode */
|
|
61
|
+
reason: string;
|
|
62
|
+
};
|
|
63
|
+
export type PressureTickResult = {
|
|
64
|
+
/** Pressures still active after this tick */
|
|
65
|
+
active: WorldPressure[];
|
|
66
|
+
/** Pressures that expired this tick (turnsRemaining hit 0) */
|
|
67
|
+
expired: WorldPressure[];
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Tick all active pressures: decrement timers, remove expired,
|
|
71
|
+
* escalate visibility over time. Returns active + expired arrays.
|
|
72
|
+
*/
|
|
73
|
+
export declare function tickPressures(pressures: WorldPressure[], currentTick: number): PressureTickResult;
|
|
74
|
+
/**
|
|
75
|
+
* Evaluate simulation state for new pressure. Returns at most ONE new pressure.
|
|
76
|
+
* Returns null most turns — scarcity by design.
|
|
77
|
+
*/
|
|
78
|
+
export declare function evaluatePressures(inputs: PressureInputs): PressureSpawnResult | null;
|
|
79
|
+
/** Get pressures originating from a specific faction. */
|
|
80
|
+
export declare function getPressuresForFaction(pressures: WorldPressure[], factionId: string): WorldPressure[];
|
|
81
|
+
/** Get pressures the player would be aware of (not hidden). */
|
|
82
|
+
export declare function getVisiblePressures(pressures: WorldPressure[]): WorldPressure[];
|
|
83
|
+
/** Format a single pressure for the director /pressures view. */
|
|
84
|
+
export declare function formatPressureForDirector(pressure: WorldPressure): string;
|
|
85
|
+
/** Compact summary for narrator prompt injection (~15 tokens). */
|
|
86
|
+
export declare function formatPressureForNarrator(pressure: WorldPressure): string;
|
|
87
|
+
/** NPC-facing description for dialogue context. */
|
|
88
|
+
export declare function formatPressureForDialogue(pressure: WorldPressure): string;
|
|
89
|
+
export declare function makePressure(opts: {
|
|
90
|
+
kind: PressureKind;
|
|
91
|
+
sourceFactionId: string;
|
|
92
|
+
description: string;
|
|
93
|
+
triggeredBy: string;
|
|
94
|
+
urgency: number;
|
|
95
|
+
visibility: PressureVisibility;
|
|
96
|
+
turnsRemaining: number | null;
|
|
97
|
+
potentialOutcomes: string[];
|
|
98
|
+
tags: string[];
|
|
99
|
+
currentTick: number;
|
|
100
|
+
}): WorldPressure;
|
|
101
|
+
//# sourceMappingURL=pressure-system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pressure-system.d.ts","sourceRoot":"","sources":["../src/pressure-system.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC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