@alpaca-software/40kdc-data 0.2.0 → 0.3.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.
Files changed (41) hide show
  1. package/dist/author-input.d.ts +20 -1
  2. package/dist/author-input.d.ts.map +1 -1
  3. package/dist/author-input.js +64 -8
  4. package/dist/author-input.js.map +1 -1
  5. package/dist/author-seed.d.ts +62 -0
  6. package/dist/author-seed.d.ts.map +1 -0
  7. package/dist/author-seed.js +194 -0
  8. package/dist/author-seed.js.map +1 -0
  9. package/dist/commands/translate.d.ts.map +1 -1
  10. package/dist/commands/translate.js +6 -68
  11. package/dist/commands/translate.js.map +1 -1
  12. package/dist/data/bundle.generated.js +1 -1
  13. package/dist/data/bundle.generated.js.map +1 -1
  14. package/dist/gen-conformance.js +22 -1
  15. package/dist/gen-conformance.js.map +1 -1
  16. package/dist/generated.d.ts +181 -146
  17. package/dist/generated.d.ts.map +1 -1
  18. package/dist/generated.js.map +1 -1
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +3 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/runner.d.ts.map +1 -1
  24. package/dist/runner.js +16 -0
  25. package/dist/runner.js.map +1 -1
  26. package/dist/translate/condition.d.ts +26 -0
  27. package/dist/translate/condition.d.ts.map +1 -0
  28. package/dist/translate/condition.js +171 -0
  29. package/dist/translate/condition.js.map +1 -0
  30. package/dist/translate/index.d.ts +9 -0
  31. package/dist/translate/index.d.ts.map +1 -0
  32. package/dist/translate/index.js +9 -0
  33. package/dist/translate/index.js.map +1 -0
  34. package/dist/translate/scoring.d.ts +38 -0
  35. package/dist/translate/scoring.d.ts.map +1 -0
  36. package/dist/translate/scoring.js +80 -0
  37. package/dist/translate/scoring.js.map +1 -0
  38. package/package.json +2 -1
  39. package/schemas/core/secondary-card.schema.json +50 -28
  40. package/schemas/enrichment/ability-dsl/condition.schema.json +5 -2
  41. package/schemas/enrichment/ability-dsl/effect.schema.json +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alpaca-software/40kdc-data",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "The 40kdc Warhammer 40K dataset behind a linked, typed API — find units, follow them to their weapons, abilities, phases, and factions. Also validates data against the canonical JSON Schemas.",
6
6
  "keywords": [
@@ -60,6 +60,7 @@
60
60
  "audit:coverage": "tsx src/cli.ts audit-coverage --write",
61
61
  "scrub:defensive-flag": "tsx src/scrub-defensive-flag.ts",
62
62
  "author:input": "tsx src/author-input.ts",
63
+ "author:seed": "tsx src/author-seed.ts",
63
64
  "author:propose": "tsx src/author-batch.ts propose",
64
65
  "author:repair": "tsx src/author-batch.ts repair",
65
66
  "author:apply": "tsx src/author-batch.ts apply",
@@ -111,39 +111,55 @@
111
111
  "required": ["operation"],
112
112
  "additionalProperties": false
113
113
  },
114
- "action": {
115
- "type": "object",
116
- "description": "Optional player action the card enables.",
117
- "properties": {
118
- "starts": {
119
- "$ref": "../defs/common.schema.json#/$defs/phase",
120
- "description": "Phase in which the action can be started."
121
- },
122
- "player_turn": { "$ref": "../defs/common.schema.json#/$defs/player-turn" },
123
- "units": {
124
- "$ref": "../enrichment/ability-dsl/condition.schema.json",
125
- "description": "Eligibility predicate for which units may perform the action."
126
- },
127
- "use_limit": {
128
- "type": "integer",
129
- "minimum": 1,
130
- "description": "Maximum number of times the action may be performed."
131
- },
132
- "completes": {
133
- "$ref": "../enrichment/ability-dsl/condition.schema.json",
134
- "description": "Predicate for when the action is considered complete."
114
+ "actions": {
115
+ "type": "array",
116
+ "minItems": 1,
117
+ "description": "Optional player actions the card enables. Most cards have a single action; a few (e.g. Observe Enemy, with separate Baited-removal and Spotted actions) have two distinct actions on the same card.",
118
+ "items": {
119
+ "type": "object",
120
+ "properties": {
121
+ "action_id": {
122
+ "type": "string",
123
+ "minLength": 1,
124
+ "maxLength": 64,
125
+ "description": "Optional kebab-case identifier used to reference this action from `action-completed` conditions in `awards[].when`."
126
+ },
127
+ "starts": {
128
+ "$ref": "../defs/common.schema.json#/$defs/phase",
129
+ "description": "Phase in which the action can be started."
130
+ },
131
+ "player_turn": { "$ref": "../defs/common.schema.json#/$defs/player-turn" },
132
+ "units": {
133
+ "$ref": "../enrichment/ability-dsl/condition.schema.json",
134
+ "description": "Eligibility predicate for which units may perform the action."
135
+ },
136
+ "use_limit": {
137
+ "type": "integer",
138
+ "minimum": 1,
139
+ "description": "Maximum number of times the action may be performed (per turn unless `use_limit_scope` says otherwise)."
140
+ },
141
+ "use_limit_scope": {
142
+ "type": "string",
143
+ "enum": ["per-turn", "per-game"],
144
+ "default": "per-turn",
145
+ "description": "Whether `use_limit` is enforced per turn or once per game (e.g. Recover the Relics / Find and Deny 'Overwhelming Force' is once per game)."
146
+ },
147
+ "completes": {
148
+ "$ref": "../enrichment/ability-dsl/condition.schema.json",
149
+ "description": "Predicate for when the action is considered complete."
150
+ },
151
+ "effect": {
152
+ "$ref": "../enrichment/ability-dsl/effect.schema.json",
153
+ "description": "Effect applied when the action completes (e.g. terrain-area-tag, objective-tag, or unit-tag to mark transient state)."
154
+ }
135
155
  },
136
- "effect": {
137
- "$ref": "../enrichment/ability-dsl/effect.schema.json",
138
- "description": "Effect applied when the action completes (e.g. terrain-area-tag to mark transient state on a terrain piece)."
139
- }
140
- },
141
- "additionalProperties": false
156
+ "additionalProperties": false
157
+ }
142
158
  },
143
159
  "awards": {
144
160
  "type": "array",
145
161
  "minItems": 1,
146
- "description": "VP-award blocks: each scores when `trigger` fires and the optional `when` condition holds. An award scores either a flat `vp` or a count-scaled `vp_per` (VP per instance of the thing named by `per`). Awards accrue independently and sum; a card's '+ ... CUMULATIVE' rows are modelled as separate awards flagged `cumulative` for faithful round-trip.",
162
+ "description": "VP-award blocks: each scores when `trigger` fires and the optional `when` condition holds. An award scores either a flat `vp` or a count-scaled `vp_per` (VP per instance of the thing named by `per`). Awards accrue independently and sum; a card's '+ ... CUMULATIVE' rows are modelled as separate awards flagged `cumulative` for faithful round-trip. Awards sharing the same `exclusive_group` value within a card resolve as the highest-scoring single award fires (the card's literal 'OR' rows between tier breakpoints, e.g. Record-Breaking Mission's 3-Fronts vs 4-Fronts).",
147
163
  "items": {
148
164
  "type": "object",
149
165
  "properties": {
@@ -174,6 +190,12 @@
174
190
  "type": "boolean",
175
191
  "default": false,
176
192
  "description": "Marks an award the card shows as an additive '+' bonus to the preceding award in the same trigger block (the card's CUMULATIVE rows). Purely descriptive — all awards accrue independently and are summed."
193
+ },
194
+ "exclusive_group": {
195
+ "type": "string",
196
+ "minLength": 1,
197
+ "maxLength": 64,
198
+ "description": "Awards sharing this kebab-case group key resolve as 'score only the highest, not the sum' (the card's literal OR between tier rows). Awards with different `exclusive_group` values, or no value, accrue independently."
177
199
  }
178
200
  },
179
201
  "oneOf": [
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "simple-condition": {
13
13
  "type": "object",
14
- "$comment": "Board/meta-state and scoring predicates. `parameters` is intentionally open (additionalProperties: true); each type documents its own param convention. Scoring predicates added for mission cards: `units-destroyed` { side: 'enemy'|'friendly', window: 'this-turn'|'previous-turn', count_min: int } — at least count_min units of `side` were destroyed in `window`. `units-destroyed-comparison` { subject: {side, window}, comparator: 'greater-than'|'greater-or-equal', reference: {side, window} } — compares two destruction tallies (e.g. more enemy units destroyed this turn than friendly last turn). `objective-majority` { relative_to: 'opponent' } — you control more objectives than the named party. `controls-objective` params: { count_min: int, objective_role?: 'central', exclude?: 'home', objective?: 'opponent-home' }.",
14
+ "$comment": "Board/meta-state and scoring predicates. `parameters` is intentionally open (additionalProperties: true); each type documents its own param convention. Scoring predicates added for mission cards: `units-destroyed` { side: 'enemy'|'friendly', window: 'this-turn'|'previous-turn', count_min: int } — at least count_min units of `side` were destroyed in `window`. `units-destroyed-comparison` { subject: {side, window}, comparator: 'greater-than'|'greater-or-equal', reference: {side, window} } — compares two destruction tallies (e.g. more enemy units destroyed this turn than friendly last turn). `objective-majority` { relative_to: 'opponent' } — you control more objectives than the named party. `controls-objective` params: { count_min: int, objective_role?: 'central'|'expansion'|'non-home'|'home', exclude?: 'home', objective?: 'opponent-home'|'your-home', scope?: 'enemy-territory'|'your-territory' }. Mission-card extensions (11e primary deck): `action-completed` { action_id?: string, target_kind?: 'objective'|'terrain'|'enemy-unit'|'self', target_filter?: { in_enemy_territory?: bool, objective_role?: 'central'|'non-home', exclude?: 'home' }, count_min: int, window?: 'this-turn'|'previous-turn'|'cumulative' } — at least count_min instances of a named action were completed in the window. `objective-has-tag` { tag: 'baited'|'triangulated'|'consecrated'|'sabotaged'|'marked'|'vanguard'|'spotted', count_min: int, count_max?: int, objective?: 'opponent-home'|'your-home', scope?: 'enemy-territory'|'your-territory' } — at least count_min objectives carry the named transient tag. `unit-has-tag` { tag: 'doomed'|'spotted', side: 'enemy'|'friendly', count_min: int, window?: 'destroyed-this-turn'|'still-on-board' } — at least count_min units of `side` carry the tag (optionally with a destruction filter — Punishment scores when a Doomed unit was destroyed or left the battlefield). `terrain-has-tag` { tag: 'mined'|'marked'|'vanguard', friendly_units_min?: int, enemy_units_max?: int, last_marked?: bool, in_enemy_dz?: bool } — terrain piece state predicate; `last_marked` selects the most-recently-marked piece (Find and Deny / Recover the Relics' Overwhelming Force trigger). `new-objective-controlled` { count_min: int } — at least count_min objectives are controlled this turn that were not controlled in the previous command phase. `engagement-fronts` { count_min: int } — friendly units engage enemies in at least count_min distinct fronts; a 'front' is one of the territory zones from the deployment-pattern's `territories[]`, so this composes with the existing `territory-control` predicate. `destroyed-while-on-objective` { destroyer_on_objective?: bool, victim_on_objective?: bool, count_min: int } — count_min enemy units were destroyed this turn under the named spatial condition (the destroying friendly unit, the destroyed enemy unit, or both were standing on an objective at the moment of the kill).",
15
15
  "properties": {
16
16
  "type": {
17
17
  "type": "string",
@@ -27,7 +27,10 @@
27
27
  "destroyed-by-attack-type", "controls-objective", "is-attached",
28
28
  "terrain-area-control", "engagement-state", "territory-control",
29
29
  "fights-first", "disposition-matches",
30
- "units-destroyed", "units-destroyed-comparison", "objective-majority"
30
+ "units-destroyed", "units-destroyed-comparison", "objective-majority",
31
+ "action-completed", "objective-has-tag", "unit-has-tag",
32
+ "terrain-has-tag", "new-objective-controlled",
33
+ "engagement-fronts", "destroyed-while-on-objective"
31
34
  ]
32
35
  },
33
36
  "parameters": { "type": "object", "additionalProperties": true },
@@ -30,6 +30,7 @@
30
30
  "model-destruction", "resurrection",
31
31
  "resource-gain", "resource-spend",
32
32
  "charge-roll-modifier", "terrain-area-tag",
33
+ "objective-tag", "unit-tag",
33
34
  "bs-modifier", "engagement-passthrough"
34
35
  ]
35
36
  },
@@ -45,7 +46,7 @@
45
46
  "modifier": { "type": "object", "additionalProperties": true }
46
47
  },
47
48
  "required": ["type", "target"],
48
- "$comment": "When `type` is `re-roll`, `modifier` must carry `roll` (string) and `subset` (`ones` | `all-failures`). Rerolls always target failures; the subset decides whether only 1s are rerolled or every failed die. The constraint is enforced by AJV at validation time and stripped from the codegen bundle (typify can't model if/then/else) — the generated TS/Rust types therefore see `modifier` as an open object, matching its other-`type` callers. When `type` is `feel-no-pain`, `modifier` carries `threshold` (the FNP save target) and optionally `scope` ∈ {`all`, `mortal`}; an absent scope defaults to `all` (fires on every unsaved wound). The two scopes compose independently against the mortal-wound stream.",
49
+ "$comment": "When `type` is `re-roll`, `modifier` must carry `roll` (string) and `subset` (`ones` | `all-failures`). Rerolls always target failures; the subset decides whether only 1s are rerolled or every failed die. The constraint is enforced by AJV at validation time and stripped from the codegen bundle (typify can't model if/then/else) — the generated TS/Rust types therefore see `modifier` as an open object, matching its other-`type` callers. When `type` is `feel-no-pain`, `modifier` carries `threshold` (the FNP save target) and optionally `scope` ∈ {`all`, `mortal`}; an absent scope defaults to `all` (fires on every unsaved wound). The two scopes compose independently against the mortal-wound stream. Tag effects (`terrain-area-tag`, `objective-tag`, `unit-tag`) set a transient marker on the named subject; `modifier` carries `tag` (string) and optionally `source` ('this-action'|'destroying-unit') and `clears_on` ('turn-rollover'|'never'). `target` for tag effects names the kind of entity the tag is applied to ('unit', 'self') — a placeholder, since the marker target is the objective/terrain/unit specified by the action context, not a combat target.",
49
50
  "allOf": [
50
51
  {
51
52
  "if": {