@ai-rpg-engine/starter-fantasy 1.0.0
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/content.d.ts +17 -0
- package/dist/content.d.ts.map +1 -0
- package/dist/content.js +238 -0
- package/dist/content.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/ruleset.d.ts +3 -0
- package/dist/ruleset.d.ts.map +1 -0
- package/dist/ruleset.js +53 -0
- package/dist/ruleset.js.map +1 -0
- package/dist/ruleset.test.d.ts +2 -0
- package/dist/ruleset.test.d.ts.map +1 -0
- package/dist/ruleset.test.js +40 -0
- package/dist/ruleset.test.js.map +1 -0
- package/dist/setup.d.ts +3 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +115 -0
- package/dist/setup.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EntityState, ZoneState, GameManifest, ActionIntent, WorldState, ResolvedEvent } from '@ai-rpg-engine/core';
|
|
2
|
+
import type { DialogueDefinition } from '@ai-rpg-engine/content-schema';
|
|
3
|
+
export declare const manifest: GameManifest;
|
|
4
|
+
export declare const player: EntityState;
|
|
5
|
+
export declare const pilgrim: EntityState;
|
|
6
|
+
export declare const ashGhoul: EntityState;
|
|
7
|
+
export declare const zones: ZoneState[];
|
|
8
|
+
export declare const pilgrimDialogue: DialogueDefinition;
|
|
9
|
+
import type { DistrictDefinition } from '@ai-rpg-engine/modules';
|
|
10
|
+
export declare const districts: DistrictDefinition[];
|
|
11
|
+
import type { ProgressionTreeDefinition } from '@ai-rpg-engine/content-schema';
|
|
12
|
+
export declare const combatMasteryTree: ProgressionTreeDefinition;
|
|
13
|
+
export declare const healingDraughtEffect: {
|
|
14
|
+
itemId: string;
|
|
15
|
+
use: (action: ActionIntent, world: WorldState) => ResolvedEvent[];
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../src/content.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExE,eAAO,MAAM,QAAQ,EAAE,YAQtB,CAAC;AAIF,eAAO,MAAM,MAAM,EAAE,WAWpB,CAAC;AAIF,eAAO,MAAM,OAAO,EAAE,WAUrB,CAAC;AAIF,eAAO,MAAM,QAAQ,EAAE,WAWtB,CAAC;AAIF,eAAO,MAAM,KAAK,EAAE,SAAS,EA8C5B,CAAC;AAIF,eAAO,MAAM,eAAe,EAAE,kBAqE7B,CAAC;AAIF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,eAAO,MAAM,SAAS,EAAE,kBAAkB,EAczC,CAAC;AAIF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE/E,eAAO,MAAM,iBAAiB,EAAE,yBA4B/B,CAAC;AAIF,eAAO,MAAM,oBAAoB;;kBAEjB,YAAY,SAAS,UAAU,KAAG,aAAa,EAAE;CAmBhE,CAAC"}
|
package/dist/content.js
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// The Chapel Threshold — fantasy starter content
|
|
2
|
+
// 2 rooms, 5 zones, 1 NPC, 1 enemy, 1 item, 1 dialogue, 1 status
|
|
3
|
+
import { nextId } from '@ai-rpg-engine/core';
|
|
4
|
+
export const manifest = {
|
|
5
|
+
id: 'chapel-threshold',
|
|
6
|
+
title: 'The Chapel Threshold',
|
|
7
|
+
version: '0.1.0',
|
|
8
|
+
engineVersion: '0.1.0',
|
|
9
|
+
ruleset: 'fantasy-minimal',
|
|
10
|
+
modules: ['traversal-core', 'status-core', 'combat-core', 'inventory-core', 'dialogue-core'],
|
|
11
|
+
contentPacks: ['chapel-threshold'],
|
|
12
|
+
};
|
|
13
|
+
// --- Player ---
|
|
14
|
+
export const player = {
|
|
15
|
+
id: 'player',
|
|
16
|
+
blueprintId: 'player',
|
|
17
|
+
type: 'player',
|
|
18
|
+
name: 'Wanderer',
|
|
19
|
+
tags: ['player'],
|
|
20
|
+
stats: { vigor: 5, instinct: 4, will: 3 },
|
|
21
|
+
resources: { hp: 20, stamina: 8 },
|
|
22
|
+
statuses: [],
|
|
23
|
+
inventory: [],
|
|
24
|
+
zoneId: 'chapel-entrance',
|
|
25
|
+
};
|
|
26
|
+
// --- NPCs ---
|
|
27
|
+
export const pilgrim = {
|
|
28
|
+
id: 'pilgrim',
|
|
29
|
+
blueprintId: 'pilgrim',
|
|
30
|
+
type: 'npc',
|
|
31
|
+
name: 'Suspicious Pilgrim',
|
|
32
|
+
tags: ['npc'],
|
|
33
|
+
stats: { vigor: 2, instinct: 3, will: 6 },
|
|
34
|
+
resources: { hp: 8 },
|
|
35
|
+
statuses: [],
|
|
36
|
+
zoneId: 'chapel-entrance',
|
|
37
|
+
};
|
|
38
|
+
// --- Enemies ---
|
|
39
|
+
export const ashGhoul = {
|
|
40
|
+
id: 'ash-ghoul',
|
|
41
|
+
blueprintId: 'ash-ghoul',
|
|
42
|
+
type: 'enemy',
|
|
43
|
+
name: 'Ash Ghoul',
|
|
44
|
+
tags: ['enemy', 'undead'],
|
|
45
|
+
stats: { vigor: 4, instinct: 3, will: 1 },
|
|
46
|
+
resources: { hp: 12, stamina: 4 },
|
|
47
|
+
statuses: [],
|
|
48
|
+
zoneId: 'crypt-chamber',
|
|
49
|
+
ai: { profileId: 'aggressive', goals: ['guard-crypt'], fears: ['fire', 'sacred'], alertLevel: 0, knowledge: {} },
|
|
50
|
+
};
|
|
51
|
+
// --- Zones ---
|
|
52
|
+
export const zones = [
|
|
53
|
+
{
|
|
54
|
+
id: 'chapel-entrance',
|
|
55
|
+
roomId: 'ruined-chapel',
|
|
56
|
+
name: 'Ruined Chapel Entrance',
|
|
57
|
+
tags: ['interior', 'sacred', 'dim'],
|
|
58
|
+
neighbors: ['chapel-nave', 'chapel-alcove'],
|
|
59
|
+
light: 3,
|
|
60
|
+
interactables: ['cracked altar', 'faded mural'],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'chapel-nave',
|
|
64
|
+
roomId: 'ruined-chapel',
|
|
65
|
+
name: 'Chapel Nave',
|
|
66
|
+
tags: ['interior', 'sacred'],
|
|
67
|
+
neighbors: ['chapel-entrance', 'vestry-door'],
|
|
68
|
+
light: 4,
|
|
69
|
+
interactables: ['broken pews', 'dust-covered lectern'],
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'chapel-alcove',
|
|
73
|
+
roomId: 'ruined-chapel',
|
|
74
|
+
name: 'Shadowed Alcove',
|
|
75
|
+
tags: ['interior', 'dark', 'hidden'],
|
|
76
|
+
neighbors: ['chapel-entrance'],
|
|
77
|
+
light: 1,
|
|
78
|
+
interactables: ['loose stone'],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'vestry-door',
|
|
82
|
+
roomId: 'ruined-chapel',
|
|
83
|
+
name: 'Vestry Passage',
|
|
84
|
+
tags: ['interior', 'transition'],
|
|
85
|
+
neighbors: ['chapel-nave', 'crypt-chamber'],
|
|
86
|
+
light: 2,
|
|
87
|
+
hazards: ['unstable floor'],
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'crypt-chamber',
|
|
91
|
+
roomId: 'crypt',
|
|
92
|
+
name: 'Crypt Antechamber',
|
|
93
|
+
tags: ['interior', 'cursed', 'dark'],
|
|
94
|
+
neighbors: ['vestry-door'],
|
|
95
|
+
light: 1,
|
|
96
|
+
interactables: ['bone altar', 'relic alcove'],
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
// --- Dialogue ---
|
|
100
|
+
export const pilgrimDialogue = {
|
|
101
|
+
id: 'pilgrim-talk',
|
|
102
|
+
speakers: ['pilgrim'],
|
|
103
|
+
entryNodeId: 'greeting',
|
|
104
|
+
nodes: {
|
|
105
|
+
greeting: {
|
|
106
|
+
id: 'greeting',
|
|
107
|
+
speaker: 'Suspicious Pilgrim',
|
|
108
|
+
text: 'You should not be here. The chapel is... changed. Something stirs below.',
|
|
109
|
+
choices: [
|
|
110
|
+
{
|
|
111
|
+
id: 'ask-what',
|
|
112
|
+
text: 'What stirs below?',
|
|
113
|
+
nextNodeId: 'warn-crypt',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: 'ask-relic',
|
|
117
|
+
text: 'I seek the relic.',
|
|
118
|
+
nextNodeId: 'relic-info',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: 'leave',
|
|
122
|
+
text: 'I can handle myself.',
|
|
123
|
+
nextNodeId: 'dismiss',
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
'warn-crypt': {
|
|
128
|
+
id: 'warn-crypt',
|
|
129
|
+
speaker: 'Suspicious Pilgrim',
|
|
130
|
+
text: 'An ash ghoul. Once a brother of this order. Now it guards the crypt with hollow fury. Take this, you may need it.',
|
|
131
|
+
choices: [
|
|
132
|
+
{
|
|
133
|
+
id: 'accept',
|
|
134
|
+
text: 'I accept your gift.',
|
|
135
|
+
nextNodeId: 'end-gift',
|
|
136
|
+
effects: [{ type: 'set-global', target: 'actor', params: { key: 'pilgrim-warned', value: true } }],
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
'relic-info': {
|
|
141
|
+
id: 'relic-info',
|
|
142
|
+
speaker: 'Suspicious Pilgrim',
|
|
143
|
+
text: 'The Ember Sigil rests in the crypt alcove, beyond the vestry. But the ghoul will not let you pass without a fight.',
|
|
144
|
+
choices: [
|
|
145
|
+
{
|
|
146
|
+
id: 'thanks',
|
|
147
|
+
text: 'Thank you for the warning.',
|
|
148
|
+
nextNodeId: 'end-info',
|
|
149
|
+
effects: [{ type: 'set-global', target: 'actor', params: { key: 'pilgrim-warned', value: true } }],
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
},
|
|
153
|
+
dismiss: {
|
|
154
|
+
id: 'dismiss',
|
|
155
|
+
speaker: 'Suspicious Pilgrim',
|
|
156
|
+
text: 'Confidence is not armor. Remember that.',
|
|
157
|
+
},
|
|
158
|
+
'end-gift': {
|
|
159
|
+
id: 'end-gift',
|
|
160
|
+
speaker: 'Suspicious Pilgrim',
|
|
161
|
+
text: 'A healing draught. May it serve you well. Go with caution.',
|
|
162
|
+
},
|
|
163
|
+
'end-info': {
|
|
164
|
+
id: 'end-info',
|
|
165
|
+
speaker: 'Suspicious Pilgrim',
|
|
166
|
+
text: 'Be careful, wanderer. The dead here do not rest easily.',
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
export const districts = [
|
|
171
|
+
{
|
|
172
|
+
id: 'chapel-grounds',
|
|
173
|
+
name: 'Chapel Grounds',
|
|
174
|
+
zoneIds: ['chapel-entrance', 'chapel-nave', 'chapel-alcove'],
|
|
175
|
+
tags: ['sacred', 'aboveground'],
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
id: 'crypt-depths',
|
|
179
|
+
name: 'Crypt Depths',
|
|
180
|
+
zoneIds: ['vestry-door', 'crypt-chamber'],
|
|
181
|
+
tags: ['cursed', 'underground'],
|
|
182
|
+
controllingFaction: 'chapel-undead',
|
|
183
|
+
},
|
|
184
|
+
];
|
|
185
|
+
export const combatMasteryTree = {
|
|
186
|
+
id: 'combat-mastery',
|
|
187
|
+
name: 'Combat Mastery',
|
|
188
|
+
currency: 'xp',
|
|
189
|
+
nodes: [
|
|
190
|
+
{
|
|
191
|
+
id: 'toughened',
|
|
192
|
+
name: 'Toughened',
|
|
193
|
+
cost: 10,
|
|
194
|
+
effects: [{ type: 'resource-boost', params: { resource: 'hp', amount: 5 } }],
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
id: 'keen-eye',
|
|
198
|
+
name: 'Keen Eye',
|
|
199
|
+
cost: 15,
|
|
200
|
+
effects: [{ type: 'stat-boost', params: { stat: 'instinct', amount: 1 } }],
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
id: 'battle-fury',
|
|
204
|
+
name: 'Battle Fury',
|
|
205
|
+
cost: 25,
|
|
206
|
+
requires: ['toughened'],
|
|
207
|
+
effects: [
|
|
208
|
+
{ type: 'stat-boost', params: { stat: 'vigor', amount: 2 } },
|
|
209
|
+
{ type: 'grant-tag', params: { tag: 'battle-fury' } },
|
|
210
|
+
],
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
};
|
|
214
|
+
// --- Items ---
|
|
215
|
+
export const healingDraughtEffect = {
|
|
216
|
+
itemId: 'healing-draught',
|
|
217
|
+
use: (action, world) => {
|
|
218
|
+
const actor = world.entities[action.actorId];
|
|
219
|
+
if (!actor)
|
|
220
|
+
return [];
|
|
221
|
+
const previous = actor.resources.hp ?? 0;
|
|
222
|
+
actor.resources.hp = Math.min(20, previous + 8);
|
|
223
|
+
return [{
|
|
224
|
+
id: nextId('evt'),
|
|
225
|
+
tick: action.issuedAtTick,
|
|
226
|
+
type: 'resource.changed',
|
|
227
|
+
actorId: action.actorId,
|
|
228
|
+
payload: {
|
|
229
|
+
entityId: actor.id,
|
|
230
|
+
resource: 'hp',
|
|
231
|
+
previous,
|
|
232
|
+
current: actor.resources.hp,
|
|
233
|
+
delta: actor.resources.hp - previous,
|
|
234
|
+
},
|
|
235
|
+
}];
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
//# sourceMappingURL=content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../src/content.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,iEAAiE;AAGjE,OAAO,EAAE,MAAM,EAAE,MA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AE,KAAiB,EAAmB,EAAE;QAChE,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,CAAC;QACtB,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,CAAC;QACzC,KAAK,CAAC,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC;QAChD,OAAO,CAAC;gBACN,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC;gBACjB,IAAI,EAAE,MAAM,CAAC,YAAY;gBACzB,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,OAAO,EAAE;oBACP,QAAQ,EAAE,KAAK,CAAC,EAAE;oBAClB,QAAQ,EAAE,IAAI;oBACd,QAAQ;oBACR,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE;oBAC3B,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,GAAG,QAAQ;iBACrC;aACF,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruleset.d.ts","sourceRoot":"","sources":["../src/ruleset.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,qBAAqB,EAAE,iBAyDnC,CAAC"}
|
package/dist/ruleset.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Fantasy Minimal Ruleset — declarative contract for chapel-threshold and similar content
|
|
2
|
+
export const fantasyMinimalRuleset = {
|
|
3
|
+
id: 'fantasy-minimal',
|
|
4
|
+
name: 'Fantasy Minimal',
|
|
5
|
+
version: '0.1.0',
|
|
6
|
+
stats: [
|
|
7
|
+
{ id: 'vigor', name: 'Vigor', min: 1, max: 20, default: 5 },
|
|
8
|
+
{ id: 'instinct', name: 'Instinct', min: 1, max: 20, default: 5 },
|
|
9
|
+
{ id: 'will', name: 'Will', min: 1, max: 20, default: 5 },
|
|
10
|
+
],
|
|
11
|
+
resources: [
|
|
12
|
+
{ id: 'hp', name: 'HP', min: 0, max: 100, default: 20 },
|
|
13
|
+
{ id: 'stamina', name: 'Stamina', min: 0, max: 50, default: 10, regenRate: 1 },
|
|
14
|
+
],
|
|
15
|
+
verbs: [
|
|
16
|
+
{ id: 'move', name: 'Move', description: 'Travel to an adjacent zone' },
|
|
17
|
+
{ id: 'inspect', name: 'Inspect', description: 'Examine your surroundings or a target' },
|
|
18
|
+
{ id: 'attack', name: 'Attack', tags: ['combat'], description: 'Strike a target in melee' },
|
|
19
|
+
{ id: 'use', name: 'Use', description: 'Use an item from your inventory' },
|
|
20
|
+
{ id: 'speak', name: 'Speak', tags: ['dialogue'], description: 'Initiate dialogue with an NPC' },
|
|
21
|
+
{ id: 'choose', name: 'Choose', tags: ['dialogue'], description: 'Select a dialogue option' },
|
|
22
|
+
],
|
|
23
|
+
formulas: [
|
|
24
|
+
{
|
|
25
|
+
id: 'hit-chance',
|
|
26
|
+
name: 'Hit Chance',
|
|
27
|
+
description: 'Base: 50 + attacker.instinct*5 - target.instinct*3, clamped 5-95',
|
|
28
|
+
inputs: ['attacker.instinct', 'target.instinct'],
|
|
29
|
+
output: 'number (0-100)',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'damage',
|
|
33
|
+
name: 'Damage',
|
|
34
|
+
description: 'Base: attacker.vigor, minimum 1',
|
|
35
|
+
inputs: ['attacker.vigor'],
|
|
36
|
+
output: 'number',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
defaultModules: [
|
|
40
|
+
'traversal-core',
|
|
41
|
+
'status-core',
|
|
42
|
+
'combat-core',
|
|
43
|
+
'inventory-core',
|
|
44
|
+
'dialogue-core',
|
|
45
|
+
],
|
|
46
|
+
progressionModels: [],
|
|
47
|
+
contentConventions: {
|
|
48
|
+
entityTypes: ['player', 'npc', 'enemy', 'item'],
|
|
49
|
+
statusTags: ['buff', 'debuff', 'curse', 'blessing'],
|
|
50
|
+
combatTags: ['melee', 'ranged', 'magic'],
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=ruleset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruleset.js","sourceRoot":"","sources":["../src/ruleset.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAI1F,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACtD,EAAE,EAAE,iBAAiB;IACrB,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,OAAO;IAEhB,KAAK,EAAE;QACL,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE;QAC3D,EAAE,EAAE,EAAE,UAAU,EAAE,IAA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AAE,EAAE,YAAY;YAChB,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,kEAAkE;YAC/E,MAAM,EAAE,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;YAChD,MAAM,EAAE,gBAAgB;SACzB;QACD;YACE,EAAE,EAAE,QAAQ;YACZ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,iCAAiC;YAC9C,MAAM,EAAE,CAAC,gBAAgB,CAAC;YAC1B,MAAM,EAAE,QAAQ;SACjB;KACF;IAED,cAAc,EAAE;QACd,gBAAgB;QAChB,aAAa;QACb,aAAa;QACb,gBAAgB;QAChB,eAAe;KAChB;IAED,iBAAiB,EAAE,EAAE;IAErB,kBAAkB,EAAE;QAClB,WAAW,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC;QAC/C,UAAU,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC;QACnD,UAAU,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC;KACzC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruleset.test.d.ts","sourceRoot":"","sources":["../src/ruleset.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { validateRulesetDefinition } from '@ai-rpg-engine/content-schema';
|
|
3
|
+
import { fantasyMinimalRuleset } from './ruleset.js';
|
|
4
|
+
describe('fantasyMinimalRuleset', () => {
|
|
5
|
+
it('validates against RulesetDefinition schema', () => {
|
|
6
|
+
const r = validateRulesetDefinition(fantasyMinimalRuleset);
|
|
7
|
+
expect(r.ok).toBe(true);
|
|
8
|
+
expect(r.errors).toHaveLength(0);
|
|
9
|
+
});
|
|
10
|
+
it('declares expected stats', () => {
|
|
11
|
+
const statIds = fantasyMinimalRuleset.stats.map((s) => s.id);
|
|
12
|
+
expect(statIds).toContain('vigor');
|
|
13
|
+
expect(statIds).toContain('instinct');
|
|
14
|
+
expect(statIds).toContain('will');
|
|
15
|
+
});
|
|
16
|
+
it('declares expected resources', () => {
|
|
17
|
+
const resIds = fantasyMinimalRuleset.resources.map((r) => r.id);
|
|
18
|
+
expect(resIds).toContain('hp');
|
|
19
|
+
expect(resIds).toContain('stamina');
|
|
20
|
+
});
|
|
21
|
+
it('declares all verbs used by starter modules', () => {
|
|
22
|
+
const verbIds = fantasyMinimalRuleset.verbs.map((v) => v.id);
|
|
23
|
+
expect(verbIds).toContain('move');
|
|
24
|
+
expect(verbIds).toContain('attack');
|
|
25
|
+
expect(verbIds).toContain('inspect');
|
|
26
|
+
expect(verbIds).toContain('speak');
|
|
27
|
+
expect(verbIds).toContain('choose');
|
|
28
|
+
expect(verbIds).toContain('use');
|
|
29
|
+
});
|
|
30
|
+
it('lists all default modules', () => {
|
|
31
|
+
expect(fantasyMinimalRuleset.defaultModules).toContain('traversal-core');
|
|
32
|
+
expect(fantasyMinimalRuleset.defaultModules).toContain('combat-core');
|
|
33
|
+
});
|
|
34
|
+
it('declares combat formulas', () => {
|
|
35
|
+
const formulaIds = fantasyMinimalRuleset.formulas.map((f) => f.id);
|
|
36
|
+
expect(formulaIds).toContain('hit-chance');
|
|
37
|
+
expect(formulaIds).toContain('damage');
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=ruleset.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruleset.test.js","sourceRoot":"","sources":["../src/ruleset.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,EAAE,CAAC,4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game setup — wire content into engine
|
|
2
|
+
import { Engine } from '@ai-rpg-engine/core';
|
|
3
|
+
import { traversalCore, statusCore, combatCore, createInventoryCore, createDialogueCore, createCognitionCore, createPerceptionFilter, createProgressionCore, createEnvironmentCore, createFactionCognition, createRumorPropagation, createSimulationInspector, createDistrictCore, createBeliefProvenance, createObserverPresentation, giveItem, } from '@ai-rpg-engine/modules';
|
|
4
|
+
import { manifest, player, pilgrim, ashGhoul, zones, districts, pilgrimDialogue, healingDraughtEffect, combatMasteryTree, } from './content.js';
|
|
5
|
+
import { fantasyMinimalRuleset } from './ruleset.js';
|
|
6
|
+
// Fantasy-specific presentation rule: undead perceive all living as threats
|
|
7
|
+
const undeadHostilePerception = {
|
|
8
|
+
id: 'undead-threat-framing',
|
|
9
|
+
eventPatterns: ['world.zone.entered'],
|
|
10
|
+
priority: 5,
|
|
11
|
+
condition: (_event, ctx) => ctx.observer.tags.includes('undead'),
|
|
12
|
+
transform: (event, _ctx) => ({
|
|
13
|
+
...event,
|
|
14
|
+
payload: {
|
|
15
|
+
...event.payload,
|
|
16
|
+
_subjectiveDescription: 'warm blood encroaches upon the sacred dead',
|
|
17
|
+
_actorDescription: 'a living trespasser',
|
|
18
|
+
_undeadPerception: true,
|
|
19
|
+
},
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
export function createGame(seed) {
|
|
23
|
+
const engine = new Engine({
|
|
24
|
+
manifest,
|
|
25
|
+
seed: seed ?? 42,
|
|
26
|
+
ruleset: fantasyMinimalRuleset,
|
|
27
|
+
modules: [
|
|
28
|
+
traversalCore,
|
|
29
|
+
statusCore,
|
|
30
|
+
combatCore,
|
|
31
|
+
createInventoryCore([healingDraughtEffect]),
|
|
32
|
+
createDialogueCore([pilgrimDialogue]),
|
|
33
|
+
createCognitionCore({ decay: { baseRate: 0.02, pruneThreshold: 0.05, instabilityFactor: 0.5 } }),
|
|
34
|
+
createPerceptionFilter(),
|
|
35
|
+
createProgressionCore({
|
|
36
|
+
trees: [combatMasteryTree],
|
|
37
|
+
rewards: [{
|
|
38
|
+
eventPattern: 'combat.entity.defeated',
|
|
39
|
+
currencyId: 'xp',
|
|
40
|
+
amount: 15,
|
|
41
|
+
recipient: 'actor',
|
|
42
|
+
}],
|
|
43
|
+
}),
|
|
44
|
+
createEnvironmentCore({
|
|
45
|
+
hazards: [{
|
|
46
|
+
id: 'unstable-floor',
|
|
47
|
+
triggerOn: 'world.zone.entered',
|
|
48
|
+
condition: (zone) => zone.hazards?.includes('unstable floor') ?? false,
|
|
49
|
+
effect: (zone, entity, _world, tick) => {
|
|
50
|
+
entity.resources.stamina = Math.max(0, (entity.resources.stamina ?? 0) - 1);
|
|
51
|
+
return [];
|
|
52
|
+
},
|
|
53
|
+
}],
|
|
54
|
+
}),
|
|
55
|
+
createFactionCognition({
|
|
56
|
+
factions: [{
|
|
57
|
+
factionId: 'chapel-undead',
|
|
58
|
+
entityIds: ['ash-ghoul'],
|
|
59
|
+
cohesion: 0.7,
|
|
60
|
+
}],
|
|
61
|
+
}),
|
|
62
|
+
createRumorPropagation({ propagationDelay: 2 }),
|
|
63
|
+
createDistrictCore({ districts }),
|
|
64
|
+
createBeliefProvenance(),
|
|
65
|
+
createObserverPresentation({
|
|
66
|
+
rules: [undeadHostilePerception],
|
|
67
|
+
}),
|
|
68
|
+
createSimulationInspector(),
|
|
69
|
+
],
|
|
70
|
+
});
|
|
71
|
+
// Add zones
|
|
72
|
+
for (const zone of zones) {
|
|
73
|
+
engine.store.addZone(zone);
|
|
74
|
+
}
|
|
75
|
+
// Add entities
|
|
76
|
+
engine.store.addEntity({ ...player });
|
|
77
|
+
engine.store.addEntity({ ...pilgrim });
|
|
78
|
+
engine.store.addEntity({ ...ashGhoul });
|
|
79
|
+
// Set player
|
|
80
|
+
engine.store.state.playerId = 'player';
|
|
81
|
+
engine.store.state.locationId = 'chapel-entrance';
|
|
82
|
+
// Listen for pilgrim gift — give healing draught after dialogue
|
|
83
|
+
engine.store.events.on('dialogue.ended', (event) => {
|
|
84
|
+
if (event.payload.dialogueId === 'pilgrim-talk') {
|
|
85
|
+
const world = engine.store.state;
|
|
86
|
+
if (world.globals['pilgrim-warned']) {
|
|
87
|
+
const playerEntity = world.entities['player'];
|
|
88
|
+
if (playerEntity && !(playerEntity.inventory ?? []).includes('healing-draught')) {
|
|
89
|
+
const giveEvent = giveItem(playerEntity, 'healing-draught', engine.tick);
|
|
90
|
+
engine.store.recordEvent(giveEvent);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
// Audio cue on entering crypt
|
|
96
|
+
engine.store.events.on('world.zone.entered', (event) => {
|
|
97
|
+
if (event.payload.zoneId === 'crypt-chamber') {
|
|
98
|
+
engine.store.emitEvent('audio.cue.requested', {
|
|
99
|
+
cueId: 'scene.crypt-reveal',
|
|
100
|
+
channel: 'stinger',
|
|
101
|
+
priority: 'high',
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
// Audio cue on combat defeat
|
|
106
|
+
engine.store.events.on('combat.entity.defeated', () => {
|
|
107
|
+
engine.store.emitEvent('audio.cue.requested', {
|
|
108
|
+
cueId: 'combat.victory',
|
|
109
|
+
channel: 'stinger',
|
|
110
|
+
priority: 'high',
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
return engine;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,aAAa,EACb,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,kBAAkB,EAClB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AC,MAAM,KAAK,eAAe,EAAE,CAAC;YAC7C,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,qBAAqB,EAAE;gBAC5C,KAAK,EAAE,oBAAoB;gBAC3B,OAAO,EAAE,SAAS;gBAClB,QAAQ,EAAE,MAAM;aACjB,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,6BAA6B;IAC7B,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACpD,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,qBAAqB,EAAE;YAC5C,KAAK,EAAE,gBAAgB;YACvB,OAAO,EAAE,SAAS;YAClB,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ai-rpg-engine/starter-fantasy",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "AI RPG Engine fantasy starter: The Chapel Threshold",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": ["dist", "content"],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"test": "vitest run"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@ai-rpg-engine/core": "*",
|
|
21
|
+
"@ai-rpg-engine/content-schema": "*",
|
|
22
|
+
"@ai-rpg-engine/modules": "*"
|
|
23
|
+
},
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"author": "mcp-tool-shop",
|
|
26
|
+
"homepage": "https://mcp-tool-shop-org.github.io/ai-rpg-engine/",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/mcp-tool-shop-org/ai-rpg-engine.git",
|
|
30
|
+
"directory": "packages/starter-fantasy"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=20"
|
|
34
|
+
}
|
|
35
|
+
}
|