@wildshard/shard-format 0.49.0 → 0.49.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildshard/shard-format",
3
- "version": "0.49.0",
3
+ "version": "0.49.1",
4
4
  "description": "The raw shardfile format: the spec, the validator and a validate CLI. The public, versioned contract every other repo builds on.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -35,12 +35,20 @@ export function clientOwnershipRules(source: Shardfile, sections: ReadonlyMap<st
35
35
  if (rawPlan !== undefined) {
36
36
  const plan = parseNativeRuntimePlan(rawPlan), owner = plan.recipe.population.owner;
37
37
  const bosses = features.filter(row => row.kind === 'boss.held' || row.kind === 'boss.spawned');
38
- // OF19c0b: a plan with no owner row has no keeper boss for a page boss feature to draw (its boss is declared)
39
- const expected = owner === undefined ? [] : [owner];
38
+ const keeper = nativeRuntimeActorIds(plan);
39
+ // OF19c0b: a plan with no owner row has no keeper boss for a page boss feature to draw (its boss is declared). OF20c: nor
40
+ // does an owner row naming a declared spawn with a declared boss encounter; that encounter takes the row's flag, fact,
41
+ // purse and save, and the page draws it from the encounter's declared `ui` panel.
42
+ let fought = false;
43
+ let spawned = false;
44
+ for (const spawn of source.creatures.spawns) { spawned ||= spawn.id === owner?.actor; }
45
+ for (const row of source.encounters) { fought ||= row.kind === 'boss' && row.entity === owner?.actor; }
46
+ const declaredOwner = owner !== undefined && !keeper.includes(owner.actor) && spawned && fought;
47
+ const expected = owner === undefined || declaredOwner ? [] : [owner];
40
48
  if (bosses.length !== expected.length || bosses.some(row => row.actor !== owner?.actor || (row.kind === 'boss.held') !== (owner.profile.pattern === 'held')))
41
49
  errors.push('Data page requires its actual native encounter pattern');
42
50
  // A declared spawn is a body the quest may name too
43
- const actors = new Set(nativeRuntimeActorIds(plan));
51
+ const actors = new Set(keeper);
44
52
  for (const spawn of source.creatures.spawns) { actors.add(spawn.id); }
45
53
  if (source.questHost?.actors.ids.some(id => !actors.has(id))) errors.push('Data page quest requires actual native actors');
46
54
  }