@ai-rpg-engine/starter-template 2.4.0 → 2.5.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MCP Tool Shop
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@ai-rpg-engine/starter-template",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Starter template for ai-rpg-engine — copy, rename, and build your own game",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "src",
8
8
  "README.md",
9
+ "LICENSE",
9
10
  "tsconfig.json"
10
11
  ],
11
12
  "scripts": {
package/src/content.ts CHANGED
@@ -15,7 +15,13 @@ export const manifest: GameManifest = {
15
15
  };
16
16
 
17
17
  // ═══════════════════════════════════════════════════════════════════
18
- // PACK METADATA (used by the CLI pack selector)
18
+ // PACK METADATA
19
+ // This is a minimal subset to keep the template dependency-light. To list
20
+ // your pack in the CLI pack selector, export the full PackMetadata shape
21
+ // from @ai-rpg-engine/pack-registry (adds: tagline, genres, difficulty,
22
+ // tones, tags, engineVersion, narratorTone) plus a BuildCatalog from
23
+ // @ai-rpg-engine/character-creation — see any packages/starter-* content.ts
24
+ // for a complete example.
19
25
  // ═══════════════════════════════════════════════════════════════════
20
26
 
21
27
  export const packMeta = {
package/src/setup.ts CHANGED
@@ -24,13 +24,17 @@ import { myRuleset } from './ruleset.js';
24
24
  // your starter feel different from other starters.
25
25
  // ═══════════════════════════════════════════════════════════════════
26
26
 
27
- // Example: a custom module that ticks your "tension" resource each combat round
27
+ // Example: a custom module that raises your "tension" resource whenever
28
+ // damage lands in combat. It listens on 'combat.damage.applied' — a real
29
+ // event emitted by combat-core every time an attack connects (other engine
30
+ // events you can hook: 'combat.contact.hit', 'combat.contact.miss',
31
+ // 'combat.entity.defeated', 'status.applied', 'world.zone.entered').
28
32
  function createTensionPressure(): EngineModule {
29
33
  return {
30
34
  id: 'tension-pressure',
31
35
  version: '1.0.0',
32
36
  register(ctx) {
33
- ctx.events.on('combat.round.end', (event: ResolvedEvent, world: WorldState) => {
37
+ ctx.events.on('combat.damage.applied', (event: ResolvedEvent, world: WorldState) => {
34
38
  const p = world.entities['player'];
35
39
  if (p && p.resources.tension !== undefined) {
36
40
  p.resources.tension = Math.min(100, (p.resources.tension ?? 0) + 5);
@@ -49,16 +53,29 @@ export function createGame(seed?: number): Engine {
49
53
  const combat = buildCombatStack({
50
54
  statMapping: { attack: 'power', precision: 'speed', resolve: 'grit' },
51
55
  playerId: 'player',
52
- // resourceProfile — uncomment and customize for your game's resource pressure:
56
+ // resourceProfile — uncomment and customize for your game's resource
57
+ // pressure. A CombatResourceProfile needs packId + the four arrays
58
+ // (gains / spends / drains / aiModifiers — empty arrays are fine):
53
59
  // resourceProfile: {
60
+ // packId: 'my-game',
61
+ // gains: [
62
+ // // +2 tension every time an attack you make lands
63
+ // { trigger: 'attack-hit', resourceId: 'tension', amount: 2 },
64
+ // ],
54
65
  // spends: [
55
- // { verbId: 'attack', costStat: 'stamina', amount: 2 },
66
+ // // spend 2 stamina on each attack for +1 damage
67
+ // { action: 'attack', resourceId: 'stamina', amount: 2, effects: { damageBonus: 1 } },
56
68
  // ],
69
+ // drains: [],
70
+ // aiModifiers: [],
57
71
  // },
58
- // biasTags — entity tags that cognition uses for faction bias:
59
- // biasTags: ['enemy'],
60
- // engagement customize if your game uses ranged/melee distance:
61
- // engagement: { defaultRange: 'melee' },
72
+ // biasTags — built-in pack bias tags that shape combat AI intent.
73
+ // Must come from PACK_BIAS_TAGS (exported by @ai-rpg-engine/modules,
74
+ // e.g. 'undead', 'beast', 'feral'); unknown tags warn and are dropped:
75
+ // biasTags: ['undead', 'beast'],
76
+ // engagement — backline/protector behavior for ranged parties
77
+ // (fields: backlineTags, protectorTags, chokepointTag, ambushTag):
78
+ // engagement: { backlineTags: ['ranged', 'caster'], protectorTags: ['bodyguard'] },
62
79
  // recovery — safe zone recovery:
63
80
  recovery: { safeZoneTags: ['safe'] },
64
81
  });
@@ -27,9 +27,21 @@ describe('starter template', () => {
27
27
  expect(engine).toBeDefined();
28
28
  });
29
29
 
30
- it('tension pressure module is wired', () => {
30
+ it('tension rises when combat damage lands (tension-pressure fires)', () => {
31
31
  const engine = createGame(1);
32
- const p = engine.world.entities['player'];
33
- expect(p?.resources.tension).toBe(0);
32
+ expect(engine.world.entities['player']?.resources.tension).toBe(0);
33
+
34
+ // Walk into the danger zone and fight. combat-core emits
35
+ // 'combat.damage.applied' whenever a hit lands — that is the event
36
+ // the tension-pressure module listens on.
37
+ engine.submitAction('move', { targetIds: ['danger-zone'] });
38
+ for (let i = 0; i < 8; i++) {
39
+ engine.submitAction('attack', { targetIds: ['grunt'] });
40
+ if ((engine.world.entities['player']?.resources.tension ?? 0) > 0) break;
41
+ }
42
+
43
+ // Meta-test property: deleting the tension-pressure listener in
44
+ // setup.ts turns this RED — nothing else writes the tension resource.
45
+ expect(engine.world.entities['player']?.resources.tension).toBeGreaterThan(0);
34
46
  });
35
47
  });