@champions-digital-game/mod-sdk 0.50.0 → 0.52.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 (44) hide show
  1. package/README.md +3 -3
  2. package/dist/build.js +1 -1
  3. package/dist/chunks/chunk-3ZP7JFBM.js +7 -0
  4. package/dist/chunks/chunk-DH3FUEOQ.js +22 -0
  5. package/dist/chunks/{chunk-JYDEFRIZ.js → chunk-GIPUMXZ5.js} +11 -11
  6. package/dist/chunks/{chunk-A3WBGQ2N.js → chunk-KWTX5B5J.js} +1 -1
  7. package/dist/chunks/{chunk-URLIN52M.js → chunk-RRZU6F4D.js} +1 -1
  8. package/dist/chunks/chunk-STQU5RJP.js +1 -0
  9. package/dist/chunks/{chunk-DKCXOHRM.js → chunk-XDNO5DKC.js} +1 -1
  10. package/dist/import.js +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/mc-pack.js +2 -2
  13. package/dist/testing.js +1 -1
  14. package/package.json +1 -1
  15. package/types/cards/src/dsl/abilities.d.ts +91 -1
  16. package/types/cards/src/dsl/effects.d.ts +33 -0
  17. package/types/cards/src/dsl/engine-only-features.d.ts +0 -10
  18. package/types/cards/src/dsl/values.d.ts +15 -2
  19. package/types/cards/src/playable/custom.d.ts +3 -2
  20. package/types/cards/src/wave2/ant/obligation-nemesis.d.ts +0 -1
  21. package/types/cards/src/wave5/sm/campaign/shield-tech.d.ts +2 -0
  22. package/types/content/src/index.d.ts +1 -1
  23. package/types/content/src/schema/cards/player-cards.d.ts +7 -0
  24. package/types/content/src/schema/packs.d.ts +5 -0
  25. package/types/engine/src/abilities.d.ts +40 -1
  26. package/types/engine/src/actions.d.ts +3 -1
  27. package/types/engine/src/campaign.d.ts +46 -0
  28. package/types/engine/src/choices.d.ts +2 -0
  29. package/types/engine/src/cost-damage.d.ts +2 -2
  30. package/types/engine/src/effects.d.ts +39 -2
  31. package/types/engine/src/events.d.ts +1 -1
  32. package/types/engine/src/index.d.ts +3 -3
  33. package/types/engine/src/keywords.d.ts +3 -3
  34. package/types/engine/src/legal.d.ts +22 -1
  35. package/types/engine/src/query.d.ts +7 -0
  36. package/types/engine/src/resolve/hand-discard.d.ts +20 -0
  37. package/types/engine/src/select.d.ts +4 -0
  38. package/types/engine/src/spec.d.ts +62 -1
  39. package/types/engine/src/stack.d.ts +5 -0
  40. package/types/engine/src/state.d.ts +30 -0
  41. package/types/engine/src/trigger-events.d.ts +53 -2
  42. package/dist/chunks/chunk-2XS47E3T.js +0 -7
  43. package/dist/chunks/chunk-HVUCR22H.js +0 -1
  44. package/dist/chunks/chunk-PB6KXNXP.js +0 -22
package/dist/mc-pack.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{src_exports}from"./chunks/chunk-HVUCR22H.js";import{formatImportReport,importMarvelCdbPack}from"./chunks/chunk-PB6KXNXP.js";import{PackBuildError,assemblePack,buildPack,loadPackSource}from"./chunks/chunk-URLIN52M.js";import{publishIssues,readPackInput,splitIssues,validatePack}from"./chunks/chunk-2XS47E3T.js";import{SMOKE_BASE_DECK,SMOKE_SCENARIOS,smokeTestPack}from"./chunks/chunk-DKCXOHRM.js";import"./chunks/chunk-A3WBGQ2N.js";import"./chunks/chunk-JYDEFRIZ.js";import{existsSync}from"node:fs";import{join,resolve}from"node:path";import{createJiti}from"jiti";function sdkModuleNames(){let published="@champions-digital-game/mod-sdk";return published&&published!=="@mc/mod-sdk"?["@mc/mod-sdk",published]:["@mc/mod-sdk"]}function packModuleImporter(){let virtualModules=Object.fromEntries(sdkModuleNames().map(name=>[name,src_exports]));return path=>createJiti(path,{virtualModules,fsCache:!1,moduleCache:!1,interopDefault:!1}).import(path)}var EXIT_OK=0,EXIT_PACK_PROBLEM=1,EXIT_USAGE=2,consoleIo={out:line=>process.stdout.write(`${line}
2
+ import{src_exports}from"./chunks/chunk-STQU5RJP.js";import{formatImportReport,importMarvelCdbPack}from"./chunks/chunk-DH3FUEOQ.js";import{PackBuildError,assemblePack,buildPack,loadPackSource}from"./chunks/chunk-RRZU6F4D.js";import{publishIssues,readPackInput,splitIssues,validatePack}from"./chunks/chunk-3ZP7JFBM.js";import{SMOKE_BASE_DECK,SMOKE_SCENARIOS,smokeTestPack}from"./chunks/chunk-XDNO5DKC.js";import"./chunks/chunk-KWTX5B5J.js";import"./chunks/chunk-GIPUMXZ5.js";import{existsSync}from"node:fs";import{join,resolve}from"node:path";import{createJiti}from"jiti";function sdkModuleNames(){let published="@champions-digital-game/mod-sdk";return published&&published!=="@mc/mod-sdk"?["@mc/mod-sdk",published]:["@mc/mod-sdk"]}function packModuleImporter(){let virtualModules=Object.fromEntries(sdkModuleNames().map(name=>[name,src_exports]));return path=>createJiti(path,{virtualModules,fsCache:!1,moduleCache:!1,interopDefault:!1}).import(path)}var EXIT_OK=0,EXIT_PACK_PROBLEM=1,EXIT_USAGE=2,consoleIo={out:line=>process.stdout.write(`${line}
3
3
  `),err:line=>process.stderr.write(`${line}
4
4
  `)},USAGE=`mc-pack: build, check and test Marvel Champions Digital content packs
5
5
 
@@ -23,4 +23,4 @@ validate, build and test run the pack's own code: they import its abilities/inde
23
23
  user's access to files, the network and the environment. Run them only on a pack you trust, or in a sandbox (a CI
24
24
  job with no secrets).
25
25
 
26
- Exit codes: 0 success, 1 the pack has a problem, 2 usage error.`,UsageError=class extends Error{},VALUE_FLAGS=new Set(["out","games","scenario","max-commands","id","app"]),BOOLEAN_FLAGS=new Set(["allow-unscripted","publish","help","version"]);function parseArgs(argv){let positional=[],flags=new Map;for(let i=0;i<argv.length;i++){let arg=argv[i];if(arg==="-h")flags.set("help",!0);else if(arg==="-v")flags.set("version",!0);else if(arg.startsWith("--")){let eq=arg.indexOf("="),name=eq<0?arg.slice(2):arg.slice(2,eq);if(BOOLEAN_FLAGS.has(name)){if(eq>=0)throw new UsageError(`--${name} takes no value`);flags.set(name,!0)}else if(VALUE_FLAGS.has(name)){let value2=eq>=0?arg.slice(eq+1):argv[++i];if(value2===void 0||value2==="")throw new UsageError(`--${name} needs a value`);flags.set(name,value2)}else throw new UsageError(`unknown option --${name}`)}else positional.push(arg)}return{positional,flags}}var value=(parsed,name)=>{let v=parsed.flags.get(name);return typeof v=="string"?v:void 0};function positiveInt(parsed,name){let raw=value(parsed,name);if(raw===void 0)return;let n=Number(raw);if(!Number.isInteger(n)||n<1)throw new UsageError(`--${name} must be a whole number of at least 1`);return n}function packDir(parsed,command){let[dir,...extra]=parsed.positional;if(dir===void 0)throw new UsageError(`${command} needs a folder`);if(extra.length>0)throw new UsageError(`${command} takes one folder, got ${parsed.positional.length}`);let full=resolve(dir);if(!existsSync(full))throw new UsageError(`${dir}: no such folder`);return full}function allowOnly(parsed,command,allowed){for(let name of parsed.flags.keys())if(!allowed.includes(name))throw new UsageError(`${command} does not take --${name}`)}var errorText=error=>error instanceof Error?error.message:String(error);async function loadBuilt(dir){let pack=assemblePack(await loadPackSource(dir,{importModule:packModuleImporter()}));return readPackInput(pack.manifest,pack.files)}function formatIssues(issues){let{defects,unscripted}=splitIssues(issues),lines=[];if(defects.length>0){lines.push(`${defects.length} problem${defects.length===1?"":"s"}:`);for(let issue of defects)lines.push(` ${issue.path}: ${issue.message}`)}if(unscripted.length>0){lines.push(`${unscripted.length} unscripted abilit${unscripted.length===1?"y":"ies"} (write them in abilities/):`);for(let issue of unscripted)lines.push(` ${issue.path}: ${issue.message}`)}return lines}async function validateCommand(parsed,io){allowOnly(parsed,"validate",["allow-unscripted","publish"]);let dir=packDir(parsed,"validate"),pack=await loadBuilt(dir),publish=parsed.flags.has("publish"),draft=existsSync(join(dir,"DRAFT"));publish&&draft&&io.out(`${pack.manifest.id}: a DRAFT, never published; the publish check is skipped`);let issues=[...validatePack(pack),...publish&&!draft?publishIssues(pack.manifest):[]],{defects,unscripted}=splitIssues(issues),name=`${pack.manifest.id}@${pack.manifest.version}`;if(issues.length===0)return io.out(`${name}: valid (${pack.cards.length} cards, ${Object.keys(pack.abilities).length} abilities)`),EXIT_OK;let lines=formatIssues(issues);if(defects.length===0&&parsed.flags.has("allow-unscripted")){io.out(`${name}: valid, ${unscripted.length} abilit${unscripted.length===1?"y":"ies"} to script`);for(let line of lines)io.out(line);return EXIT_OK}io.err(`${name}: invalid`);for(let line of lines)io.err(line);return EXIT_PACK_PROBLEM}async function buildCommand(parsed,io){allowOnly(parsed,"build",["out"]);let dir=packDir(parsed,"build"),out=value(parsed,"out");if(out===void 0)throw new UsageError("build needs --out <dir>");try{let result=await buildPack(dir,resolve(out),{importModule:packModuleImporter()}),{manifest}=result;return io.out(`${manifest.id}@${manifest.version}: built ${result.zipPath}`),io.out(` ${result.zipBytes} bytes, sha256 ${result.zipSha256}`),io.out(` ${manifest.files.length} files, ${manifest.totalBytes} bytes unzipped`),io.out(` requires app ${manifest.requires.app}; DSL features: ${manifest.requires.dslFeatures.join(", ")||"none"}`),EXIT_OK}catch(error){if(!(error instanceof PackBuildError))throw error;io.err("build failed: the pack is invalid");for(let line of formatIssues(error.issues))io.err(line);return EXIT_PACK_PROBLEM}}var describeGame=game=>{let where=game.deck===SMOKE_BASE_DECK?` at ${game.campaign?`${game.campaign}/${game.node} (${game.scenario})`:game.scenario}${game.modularSet?` with ${game.modularSet}`:""}${game.difficulty?`, ${game.difficulty}`:""}`:"",head=` ${game.deck}${where} seed ${game.seed}: `;if(!game.ok)return`${head}FAILED: ${game.error??"unknown error"}`;let played=game.packCardsPlayed.length>0?`; pack cards played or revealed: ${game.packCardsPlayed.join(", ")}`:"";return`${head}${game.outcome??"ended"} in round ${game.rounds} (${game.commands} commands)${played}`};async function testCommand(parsed,io){allowOnly(parsed,"test",["games","scenario","max-commands"]);let dir=packDir(parsed,"test"),scenario=value(parsed,"scenario")??"rhino";if(!SMOKE_SCENARIOS.includes(scenario))throw new UsageError(`--scenario must be one of ${SMOKE_SCENARIOS.join(", ")}`);let games=positiveInt(parsed,"games")??3,maxCommands=positiveInt(parsed,"max-commands"),pack=await loadBuilt(dir),issues=validatePack(pack);if(issues.length>0){io.err(`${pack.manifest.id}: not tested, the pack is invalid (run mc-pack validate)`);for(let line of formatIssues(issues))io.err(line);return EXIT_PACK_PROBLEM}io.out(`${pack.manifest.id}@${pack.manifest.version}: ${games} game(s) per deck, scenario and modular set (Core scenario: ${scenario})`);let result=smokeTestPack(pack,{games,scenario,...maxCommands!==void 0?{maxCommands}:{},onGame:game=>(game.ok?io.out:io.err)(describeGame(game))});for(let note of result.notes)io.out(`note: ${note}`);let failed=result.games.filter(g=>!g.ok).length;return failed>0?(io.err(`${failed} of ${result.games.length} game(s) failed`),EXIT_PACK_PROBLEM):(io.out(`all ${result.games.length} game(s) passed`),EXIT_OK)}async function importCommand(parsed,io){allowOnly(parsed,"import-marvelcdb",["out","id","app"]);let src=packDir(parsed,"import-marvelcdb"),out=value(parsed,"out"),packId=value(parsed,"id"),app=value(parsed,"app"),report=await importMarvelCdbPack(src,{...out!==void 0?{outDir:resolve(out)}:{},...packId!==void 0?{packId}:{},...app!==void 0?{app}:{}}),text=formatImportReport(report);if(!report.normalized||report.validationIssues.length>0)return io.err(text),EXIT_PACK_PROBLEM;if(io.out(text),report.unscriptedIssues.length>0){io.out(`${report.unscriptedIssues.length} abilities to script, listed in abilities/index.ts:`);for(let issue of report.unscriptedIssues)io.out(` ${issue.path}: ${issue.message}`)}return io.out(report.outDir?`written to ${report.outDir}`:"dry run: nothing written (pass --out <dir>)"),EXIT_OK}var COMMANDS={validate:validateCommand,build:buildCommand,test:testCommand,"import-marvelcdb":importCommand};async function runCli(argv,io=consoleIo){let[command,...rest]=argv;try{if(command===void 0||command==="--help"||command==="-h"||command==="help")return io.out(USAGE),command===void 0?EXIT_USAGE:EXIT_OK;if(command==="--version"||command==="-v")return io.out("0.50.0"),EXIT_OK;let run=COMMANDS[command];if(!run)throw new UsageError(`unknown command "${command}"`);let parsed=parseArgs(rest);return parsed.flags.has("help")?(io.out(USAGE),EXIT_OK):await run(parsed,io)}catch(error){return error instanceof UsageError?(io.err(`mc-pack: ${error.message}`),io.err("run mc-pack --help for usage"),EXIT_USAGE):(io.err(`mc-pack ${command}: ${errorText(error)}`),EXIT_PACK_PROBLEM)}}process.exitCode=await runCli(process.argv.slice(2));
26
+ Exit codes: 0 success, 1 the pack has a problem, 2 usage error.`,UsageError=class extends Error{},VALUE_FLAGS=new Set(["out","games","scenario","max-commands","id","app"]),BOOLEAN_FLAGS=new Set(["allow-unscripted","publish","help","version"]);function parseArgs(argv){let positional=[],flags=new Map;for(let i=0;i<argv.length;i++){let arg=argv[i];if(arg==="-h")flags.set("help",!0);else if(arg==="-v")flags.set("version",!0);else if(arg.startsWith("--")){let eq=arg.indexOf("="),name=eq<0?arg.slice(2):arg.slice(2,eq);if(BOOLEAN_FLAGS.has(name)){if(eq>=0)throw new UsageError(`--${name} takes no value`);flags.set(name,!0)}else if(VALUE_FLAGS.has(name)){let value2=eq>=0?arg.slice(eq+1):argv[++i];if(value2===void 0||value2==="")throw new UsageError(`--${name} needs a value`);flags.set(name,value2)}else throw new UsageError(`unknown option --${name}`)}else positional.push(arg)}return{positional,flags}}var value=(parsed,name)=>{let v=parsed.flags.get(name);return typeof v=="string"?v:void 0};function positiveInt(parsed,name){let raw=value(parsed,name);if(raw===void 0)return;let n=Number(raw);if(!Number.isInteger(n)||n<1)throw new UsageError(`--${name} must be a whole number of at least 1`);return n}function packDir(parsed,command){let[dir,...extra]=parsed.positional;if(dir===void 0)throw new UsageError(`${command} needs a folder`);if(extra.length>0)throw new UsageError(`${command} takes one folder, got ${parsed.positional.length}`);let full=resolve(dir);if(!existsSync(full))throw new UsageError(`${dir}: no such folder`);return full}function allowOnly(parsed,command,allowed){for(let name of parsed.flags.keys())if(!allowed.includes(name))throw new UsageError(`${command} does not take --${name}`)}var errorText=error=>error instanceof Error?error.message:String(error);async function loadBuilt(dir){let pack=assemblePack(await loadPackSource(dir,{importModule:packModuleImporter()}));return readPackInput(pack.manifest,pack.files)}function formatIssues(issues){let{defects,unscripted}=splitIssues(issues),lines=[];if(defects.length>0){lines.push(`${defects.length} problem${defects.length===1?"":"s"}:`);for(let issue of defects)lines.push(` ${issue.path}: ${issue.message}`)}if(unscripted.length>0){lines.push(`${unscripted.length} unscripted abilit${unscripted.length===1?"y":"ies"} (write them in abilities/):`);for(let issue of unscripted)lines.push(` ${issue.path}: ${issue.message}`)}return lines}async function validateCommand(parsed,io){allowOnly(parsed,"validate",["allow-unscripted","publish"]);let dir=packDir(parsed,"validate"),pack=await loadBuilt(dir),publish=parsed.flags.has("publish"),draft=existsSync(join(dir,"DRAFT"));publish&&draft&&io.out(`${pack.manifest.id}: a DRAFT, never published; the publish check is skipped`);let issues=[...validatePack(pack),...publish&&!draft?publishIssues(pack.manifest):[]],{defects,unscripted}=splitIssues(issues),name=`${pack.manifest.id}@${pack.manifest.version}`;if(issues.length===0)return io.out(`${name}: valid (${pack.cards.length} cards, ${Object.keys(pack.abilities).length} abilities)`),EXIT_OK;let lines=formatIssues(issues);if(defects.length===0&&parsed.flags.has("allow-unscripted")){io.out(`${name}: valid, ${unscripted.length} abilit${unscripted.length===1?"y":"ies"} to script`);for(let line of lines)io.out(line);return EXIT_OK}io.err(`${name}: invalid`);for(let line of lines)io.err(line);return EXIT_PACK_PROBLEM}async function buildCommand(parsed,io){allowOnly(parsed,"build",["out"]);let dir=packDir(parsed,"build"),out=value(parsed,"out");if(out===void 0)throw new UsageError("build needs --out <dir>");try{let result=await buildPack(dir,resolve(out),{importModule:packModuleImporter()}),{manifest}=result;return io.out(`${manifest.id}@${manifest.version}: built ${result.zipPath}`),io.out(` ${result.zipBytes} bytes, sha256 ${result.zipSha256}`),io.out(` ${manifest.files.length} files, ${manifest.totalBytes} bytes unzipped`),io.out(` requires app ${manifest.requires.app}; DSL features: ${manifest.requires.dslFeatures.join(", ")||"none"}`),EXIT_OK}catch(error){if(!(error instanceof PackBuildError))throw error;io.err("build failed: the pack is invalid");for(let line of formatIssues(error.issues))io.err(line);return EXIT_PACK_PROBLEM}}var describeGame=game=>{let where=game.deck===SMOKE_BASE_DECK?` at ${game.campaign?`${game.campaign}/${game.node} (${game.scenario})`:game.scenario}${game.modularSet?` with ${game.modularSet}`:""}${game.difficulty?`, ${game.difficulty}`:""}`:"",head=` ${game.deck}${where} seed ${game.seed}: `;if(!game.ok)return`${head}FAILED: ${game.error??"unknown error"}`;let played=game.packCardsPlayed.length>0?`; pack cards played or revealed: ${game.packCardsPlayed.join(", ")}`:"";return`${head}${game.outcome??"ended"} in round ${game.rounds} (${game.commands} commands)${played}`};async function testCommand(parsed,io){allowOnly(parsed,"test",["games","scenario","max-commands"]);let dir=packDir(parsed,"test"),scenario=value(parsed,"scenario")??"rhino";if(!SMOKE_SCENARIOS.includes(scenario))throw new UsageError(`--scenario must be one of ${SMOKE_SCENARIOS.join(", ")}`);let games=positiveInt(parsed,"games")??3,maxCommands=positiveInt(parsed,"max-commands"),pack=await loadBuilt(dir),issues=validatePack(pack);if(issues.length>0){io.err(`${pack.manifest.id}: not tested, the pack is invalid (run mc-pack validate)`);for(let line of formatIssues(issues))io.err(line);return EXIT_PACK_PROBLEM}io.out(`${pack.manifest.id}@${pack.manifest.version}: ${games} game(s) per deck, scenario and modular set (Core scenario: ${scenario})`);let result=smokeTestPack(pack,{games,scenario,...maxCommands!==void 0?{maxCommands}:{},onGame:game=>(game.ok?io.out:io.err)(describeGame(game))});for(let note of result.notes)io.out(`note: ${note}`);let failed=result.games.filter(g=>!g.ok).length;return failed>0?(io.err(`${failed} of ${result.games.length} game(s) failed`),EXIT_PACK_PROBLEM):(io.out(`all ${result.games.length} game(s) passed`),EXIT_OK)}async function importCommand(parsed,io){allowOnly(parsed,"import-marvelcdb",["out","id","app"]);let src=packDir(parsed,"import-marvelcdb"),out=value(parsed,"out"),packId=value(parsed,"id"),app=value(parsed,"app"),report=await importMarvelCdbPack(src,{...out!==void 0?{outDir:resolve(out)}:{},...packId!==void 0?{packId}:{},...app!==void 0?{app}:{}}),text=formatImportReport(report);if(!report.normalized||report.validationIssues.length>0)return io.err(text),EXIT_PACK_PROBLEM;if(io.out(text),report.unscriptedIssues.length>0){io.out(`${report.unscriptedIssues.length} abilities to script, listed in abilities/index.ts:`);for(let issue of report.unscriptedIssues)io.out(` ${issue.path}: ${issue.message}`)}return io.out(report.outDir?`written to ${report.outDir}`:"dry run: nothing written (pass --out <dir>)"),EXIT_OK}var COMMANDS={validate:validateCommand,build:buildCommand,test:testCommand,"import-marvelcdb":importCommand};async function runCli(argv,io=consoleIo){let[command,...rest]=argv;try{if(command===void 0||command==="--help"||command==="-h"||command==="help")return io.out(USAGE),command===void 0?EXIT_USAGE:EXIT_OK;if(command==="--version"||command==="-v")return io.out("0.52.0"),EXIT_OK;let run=COMMANDS[command];if(!run)throw new UsageError(`unknown command "${command}"`);let parsed=parseArgs(rest);return parsed.flags.has("help")?(io.out(USAGE),EXIT_OK):await run(parsed,io)}catch(error){return error instanceof UsageError?(io.err(`mc-pack: ${error.message}`),io.err("run mc-pack --help for usage"),EXIT_USAGE):(io.err(`mc-pack ${command}: ${errorText(error)}`),EXIT_PACK_PROBLEM)}}process.exitCode=await runCli(process.argv.slice(2));
package/dist/testing.js CHANGED
@@ -1 +1 @@
1
- import{SMOKE_BASE_DECK,SMOKE_SCENARIOS,playToOutcome,smokeTestPack}from"./chunks/chunk-DKCXOHRM.js";import"./chunks/chunk-A3WBGQ2N.js";import"./chunks/chunk-JYDEFRIZ.js";export{SMOKE_BASE_DECK,SMOKE_SCENARIOS,playToOutcome,smokeTestPack};
1
+ import{SMOKE_BASE_DECK,SMOKE_SCENARIOS,playToOutcome,smokeTestPack}from"./chunks/chunk-XDNO5DKC.js";import"./chunks/chunk-KWTX5B5J.js";import"./chunks/chunk-GIPUMXZ5.js";export{SMOKE_BASE_DECK,SMOKE_SCENARIOS,playToOutcome,smokeTestPack};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@champions-digital-game/mod-sdk",
3
- "version": "0.50.0",
3
+ "version": "0.52.0",
4
4
  "description": "The mod SDK for Marvel Champions Digital content packs: the pack schema, the ability DSL, and the mc-pack validate, build, test and import-marvelcdb tools.",
5
5
  "keywords": [
6
6
  "card-game",
@@ -147,6 +147,17 @@ export declare const resource: (generates: ResourceGeneration, options?: Ability
147
147
  readonly spentAsIfResource?: boolean;
148
148
  /** "… to overpay for a card": never toward the cost, always overpaid (hero-packs H3.14). */
149
149
  readonly overpayOnly?: boolean;
150
+ /**
151
+ * "… for an upgrade ability" (With Great Firepower, `spider-punisher-tw`; #890 item 3): only for an ability's cost
152
+ * on a card matching `generatesFor`, never to play a card: `{ generatesFor: query("upgrade"), forAbility: true }`.
153
+ */
154
+ readonly forAbility?: boolean;
155
+ /**
156
+ * "… while paying for this card" on a card in hand (Enhanced Combat Sense, `spider-punisher-tw`; #890 item 2): the
157
+ * ability works from its owner's hand and pays for its own card alone (`activeIn: "hand"`). What it generated is
158
+ * `paid.ability.<its id>` for the card's text ("for each upgrade you exhausted to pay for this card").
159
+ */
160
+ readonly inHand?: boolean;
150
161
  }, ...effects: readonly EffectArg[]) => AbilityDefinition;
151
162
  /**
152
163
  * "Interrupt: When you spend this card, [cost] → generate …" on a card spent from hand (Organizational Support, `aos`
@@ -177,6 +188,7 @@ export declare const countersAsResource: (counterType: string, generates?: Resou
177
188
  export declare const heroResource: (generates: ResourceGeneration, options?: AbilityOptions & {
178
189
  readonly generatesFor?: TargetQuery;
179
190
  readonly overpayOnly?: boolean;
191
+ readonly forAbility?: boolean;
180
192
  }, ...effects: readonly EffectArg[]) => AbilityDefinition;
181
193
  /** "Interrupt:" — optional; "When …". */
182
194
  export declare const interrupt: (on: EventPattern, ...args: Args) => AbilityDefinition;
@@ -1562,6 +1574,11 @@ export declare const attacksDealAdditionalDamage: (amount: number, opts: {
1562
1574
  readonly target: TargetQuery;
1563
1575
  readonly attacker?: TargetQuery;
1564
1576
  readonly while?: Predicate;
1577
+ /**
1578
+ * `amount` for each counter of this type on the attacked character (Sentinel's Exposed, `sentinel-tw`; #890 item
1579
+ * 10): `attacksDealAdditionalDamage(1, { target: query("enemy"), perCounterOnTarget: "exposed" })`.
1580
+ */
1581
+ readonly perCounterOnTarget?: string;
1565
1582
  }) => ConstantPart;
1566
1583
  /** "Double the number of resources this card generates while paying for an [aspect] card." */
1567
1584
  export declare const doublesResourcesWhilePayingFor: (whilePayingFor: TargetQuery) => ConstantPart;
@@ -1846,7 +1863,9 @@ export declare const costIf: (condition: Predicate, then: AbilityCost | readonly
1846
1863
  * "take damage equal to its printed cost" (Wolverine's Claws 35002) is `takeDamageCost(printedCostOf(chosen("event")))`
1847
1864
  * beside `chooseCardCost("event", …)` (docs/phase7-wave6.md §3.42).
1848
1865
  */
1849
- export declare const takeDamageCost: (n: number | ValueSpec) => AbilityCost;
1866
+ export declare const takeDamageCost: (n: number | ValueSpec, opts?: {
1867
+ readonly unpreventable?: boolean;
1868
+ }) => AbilityCost;
1850
1869
  /**
1851
1870
  * "Take any amount of damage up to your remaining hit points →" (Maximum Effort 44004, "Yoo-Hoo!" 44006;
1852
1871
  * docs/phase7-wave7.md §3.79): the payer picks the amount, from `min` (default 0: §4.1 Q46 = B, 0 damage may be
@@ -2010,6 +2029,14 @@ export interface InPlayCostOptions {
2010
2029
  * exhaustCardsCost(query("support"), { each: true })]`.
2011
2030
  */
2012
2031
  export declare const exhaustCardsCost: (q: TargetQuery, opts?: InPlayCostOptions) => AbilityCost;
2032
+ /**
2033
+ * "Flip [a card you control] →": the picked double-sided cards in play turn to their other face as the cost
2034
+ * (`AbilityCost.flipCards`; #890 item 11). Sentinel's "destroy Arms (Intact)" is a flip plus 2 unpreventable damage,
2035
+ * so with `takeDamageCost(2, { unpreventable: true })` beside it, and "exhaust or destroy it" is
2036
+ * `eitherCost(exhaustCardsCost(arms), [flipCardsCost(arms), takeDamageCost(2, { unpreventable: true })])`. The picks
2037
+ * are bound to `slot` (default "flipped").
2038
+ */
2039
+ export declare const flipCardsCost: (q: TargetQuery, opts?: InPlayCostOptions) => AbilityCost;
2013
2040
  /**
2014
2041
  * "Exhaust an [Avenger] character and a [Guardian] character →" (As One!, Stand Together, Problem Solvers; Combine
2015
2042
  * Forces' X-Force and X-Men; docs/phase7-wave4.md §3.17): one card per slot, each slot its own query, and one card
@@ -2850,6 +2877,21 @@ export declare const on: {
2850
2877
  readonly how?: TuckedDiscardCause | readonly TuckedDiscardCause[];
2851
2878
  readonly yours?: boolean;
2852
2879
  }) => EventPattern;
2880
+ /**
2881
+ * "After a card is discarded [from a hand] by an ability" (issue #922; the Hulk house rule pack's "Don't Make Me
2882
+ * Angry!"), on a card in play: each card a card's ability discards from a hand, by its effect or its cost, "that card"
2883
+ * being `eventTarget` in its discard pile and the hand's player `eventPlayer`. Not the cards spent to pay, the discard
2884
+ * down to hand size or a mulligan. `card` narrows the discarded card; `by` the side of the discarding card, `how`
2885
+ * its effect or its cost; `yours`: only from this card's controller's hand. A response only: the cards one effect or
2886
+ * cost discarded share one window, which resolves before that ability goes on. Merge it with the deck and play
2887
+ * patterns in one `on: [...]` list to give one ability one limit for every place a card is discarded from.
2888
+ */
2889
+ readonly cardDiscardedFromHand: (opts?: {
2890
+ readonly card?: TargetQuery;
2891
+ readonly by?: LeaveCauseSide;
2892
+ readonly how?: "effect" | "cost";
2893
+ readonly yours?: boolean;
2894
+ }) => EventPattern;
2853
2895
  /**
2854
2896
  * "After this card enters your hand" (Infiltration, Shapeshifter Surprise, `mut_gen` 32082-32083;
2855
2897
  * docs/phase7-wave6.md §3.10): however it enters a hand (drawn, searched for, returned, moved there). Pair with
@@ -3062,6 +3104,12 @@ export declare const on: {
3062
3104
  readonly youChangeAdditionalForm: (formType: string) => EventPattern;
3063
3105
  /** "After your turn begins" (Quinjet, `cap` pack). */
3064
3106
  readonly yourTurnBegins: () => EventPattern;
3107
+ /**
3108
+ * "After you ready your cards at the end of the player phase" (Web-Sling, `spider-punisher-tw`; #890 item 1): the
3109
+ * cards the step readied are slot `readied.cards`, so "for each 2 upgrades you readied this way" counts
3110
+ * `countOf(query("upgrade", { inSlot: "readied.cards" }))`.
3111
+ */
3112
+ readonly yourCardsReadiedAtPhaseEnd: () => EventPattern;
3065
3113
  /**
3066
3114
  * "After you use a basic power" (Quicksilver's Super Speed, Captain Marvel ally 04032, Rapid Growth; docs/phase7-
3067
3115
  * wave2.md §3.11). The engine's `EventPattern` has no field to narrow by *which* power (attack/thwart/defense/
@@ -3789,6 +3837,21 @@ export declare const when: {
3789
3837
  readonly how?: TuckedDiscardCause | readonly TuckedDiscardCause[];
3790
3838
  readonly yours?: boolean;
3791
3839
  }) => EventPattern;
3840
+ /**
3841
+ * "After a card is discarded [from a hand] by an ability" (issue #922; the Hulk house rule pack's "Don't Make Me
3842
+ * Angry!"), on a card in play: each card a card's ability discards from a hand, by its effect or its cost, "that card"
3843
+ * being `eventTarget` in its discard pile and the hand's player `eventPlayer`. Not the cards spent to pay, the discard
3844
+ * down to hand size or a mulligan. `card` narrows the discarded card; `by` the side of the discarding card, `how`
3845
+ * its effect or its cost; `yours`: only from this card's controller's hand. A response only: the cards one effect or
3846
+ * cost discarded share one window, which resolves before that ability goes on. Merge it with the deck and play
3847
+ * patterns in one `on: [...]` list to give one ability one limit for every place a card is discarded from.
3848
+ */
3849
+ readonly cardDiscardedFromHand: (opts?: {
3850
+ readonly card?: TargetQuery;
3851
+ readonly by?: LeaveCauseSide;
3852
+ readonly how?: "effect" | "cost";
3853
+ readonly yours?: boolean;
3854
+ }) => EventPattern;
3792
3855
  /**
3793
3856
  * "After this card enters your hand" (Infiltration, Shapeshifter Surprise, `mut_gen` 32082-32083;
3794
3857
  * docs/phase7-wave6.md §3.10): however it enters a hand (drawn, searched for, returned, moved there). Pair with
@@ -4001,6 +4064,12 @@ export declare const when: {
4001
4064
  readonly youChangeAdditionalForm: (formType: string) => EventPattern;
4002
4065
  /** "After your turn begins" (Quinjet, `cap` pack). */
4003
4066
  readonly yourTurnBegins: () => EventPattern;
4067
+ /**
4068
+ * "After you ready your cards at the end of the player phase" (Web-Sling, `spider-punisher-tw`; #890 item 1): the
4069
+ * cards the step readied are slot `readied.cards`, so "for each 2 upgrades you readied this way" counts
4070
+ * `countOf(query("upgrade", { inSlot: "readied.cards" }))`.
4071
+ */
4072
+ readonly yourCardsReadiedAtPhaseEnd: () => EventPattern;
4004
4073
  /**
4005
4074
  * "After you use a basic power" (Quicksilver's Super Speed, Captain Marvel ally 04032, Rapid Growth; docs/phase7-
4006
4075
  * wave2.md §3.11). The engine's `EventPattern` has no field to narrow by *which* power (attack/thwart/defense/
@@ -4728,6 +4797,21 @@ export declare const after: {
4728
4797
  readonly how?: TuckedDiscardCause | readonly TuckedDiscardCause[];
4729
4798
  readonly yours?: boolean;
4730
4799
  }) => EventPattern;
4800
+ /**
4801
+ * "After a card is discarded [from a hand] by an ability" (issue #922; the Hulk house rule pack's "Don't Make Me
4802
+ * Angry!"), on a card in play: each card a card's ability discards from a hand, by its effect or its cost, "that card"
4803
+ * being `eventTarget` in its discard pile and the hand's player `eventPlayer`. Not the cards spent to pay, the discard
4804
+ * down to hand size or a mulligan. `card` narrows the discarded card; `by` the side of the discarding card, `how`
4805
+ * its effect or its cost; `yours`: only from this card's controller's hand. A response only: the cards one effect or
4806
+ * cost discarded share one window, which resolves before that ability goes on. Merge it with the deck and play
4807
+ * patterns in one `on: [...]` list to give one ability one limit for every place a card is discarded from.
4808
+ */
4809
+ readonly cardDiscardedFromHand: (opts?: {
4810
+ readonly card?: TargetQuery;
4811
+ readonly by?: LeaveCauseSide;
4812
+ readonly how?: "effect" | "cost";
4813
+ readonly yours?: boolean;
4814
+ }) => EventPattern;
4731
4815
  /**
4732
4816
  * "After this card enters your hand" (Infiltration, Shapeshifter Surprise, `mut_gen` 32082-32083;
4733
4817
  * docs/phase7-wave6.md §3.10): however it enters a hand (drawn, searched for, returned, moved there). Pair with
@@ -4940,6 +5024,12 @@ export declare const after: {
4940
5024
  readonly youChangeAdditionalForm: (formType: string) => EventPattern;
4941
5025
  /** "After your turn begins" (Quinjet, `cap` pack). */
4942
5026
  readonly yourTurnBegins: () => EventPattern;
5027
+ /**
5028
+ * "After you ready your cards at the end of the player phase" (Web-Sling, `spider-punisher-tw`; #890 item 1): the
5029
+ * cards the step readied are slot `readied.cards`, so "for each 2 upgrades you readied this way" counts
5030
+ * `countOf(query("upgrade", { inSlot: "readied.cards" }))`.
5031
+ */
5032
+ readonly yourCardsReadiedAtPhaseEnd: () => EventPattern;
4943
5033
  /**
4944
5034
  * "After you use a basic power" (Quicksilver's Super Speed, Captain Marvel ally 04032, Rapid Growth; docs/phase7-
4945
5035
  * wave2.md §3.11). The engine's `EventPattern` has no field to narrow by *which* power (attack/thwart/defense/
@@ -354,7 +354,21 @@ export declare const chooseTarget: (slot: string, q: TargetQuery, opts?: {
354
354
  readonly upTo?: boolean;
355
355
  readonly optional?: boolean;
356
356
  readonly count?: Amount;
357
+ /**
358
+ * The question the client asks, for a pick whose role the plain "Choose a target" doesn't say ("FROM" / "TO"): a
359
+ * client message key (`choicePrompt.*`, translated), or plain text.
360
+ */
361
+ readonly prompt?: string;
357
362
  }) => EffectSpec;
363
+ /**
364
+ * "Choose a player" whose effects act on the minions (or, with `kind: "enemy"`, the enemies) engaged with that player:
365
+ * Explosive Arrow, Multi-Gun, Spray Fire and the like (issue #911, Quin 2026-11-20). Only players with one engaged are
366
+ * offered, and one such player is chosen without asking (`choosePlayer`'s `among`). With none engaged anywhere no
367
+ * player is chosen, so the effects on that player's minions find nothing while the rest of the ability (the villain's
368
+ * damage) resolves. Engine reading (authority step 5), the owner's decision: naming a player with no engaged minion
369
+ * changes nothing the card does.
370
+ */
371
+ export declare const choosePlayerWithEngaged: (slot?: string, kind?: "minion" | "enemy") => EffectSpec;
358
372
  export declare const bindTargets: (slot: string, target: TargetRef) => EffectSpec;
359
373
  /**
360
374
  * "Rhino attacks you" / "Green Goblin attacks with +X ATK" (Death from Above).
@@ -1934,6 +1948,15 @@ export declare const thwartAScheme: (n: Amount, slot?: string) => EffectSpec[];
1934
1948
  export declare const damageAnEnemy: (n: Amount, slot?: string) => EffectSpec[];
1935
1949
  /** "Remove N threat from a scheme." (not a thwart) */
1936
1950
  export declare const removeThreatFromAScheme: (n: Amount, slot?: string) => EffectSpec[];
1951
+ /**
1952
+ * "… or resolve an 'Action' ability on a card you control" (War Machine Armor, `punisher-msp`; #890 item 6): the player
1953
+ * uses one Action ability of a card in play they control, paying its cost, at this moment (no Action timing asked).
1954
+ * `filter` narrows the cards; `optional` lets the player use none. `EffectSpec useActionAbility`.
1955
+ */
1956
+ export declare const useActionAbility: (player?: PlayerRef, opts?: {
1957
+ readonly filter?: TargetQuery;
1958
+ readonly optional?: boolean;
1959
+ }) => EffectSpec;
1937
1960
  /**
1938
1961
  * "Deal a total of N damage divided among X you choose" (Wasp Sting) / "Remove a total of N threat from among
1939
1962
  * schemes in play" (Inconspicuous): docs/phase7-wave2.md §3.7. A status name divides status cards: "place a total of 2
@@ -2117,6 +2140,16 @@ export declare const playFromHandReducingCost: (n: Amount, player?: PlayerRef, o
2117
2140
  * it has several). `playSetAside(query("upgrade", { name: "Death-Glow" }))`.
2118
2141
  */
2119
2142
  export declare const playSetAside: (filter?: TargetQuery, player?: PlayerRef) => EffectSpec;
2143
+ /**
2144
+ * "Play an Attack event from your discard pile, paying its costs" (Warzone, `punisher-msp`; #890 item 5): a card from
2145
+ * the player's own discard pile, played and paid for (`EffectSpec playFromHand.from: "discard"`). Not "as if it were in
2146
+ * your hand": a "from your hand" response does not answer it. `optional`: "you may play …"; `ignoreActionTiming`: an
2147
+ * event with an Action ability played outside the player's turn, as from a Response.
2148
+ */
2149
+ export declare const playFromDiscard: (filter?: TargetQuery, player?: PlayerRef, opts?: {
2150
+ readonly optional?: boolean;
2151
+ readonly ignoreActionTiming?: boolean;
2152
+ }) => EffectSpec;
2120
2153
  /**
2121
2154
  * "Search their deck for a card and play that card, ignoring its resource cost. (Shuffle.)" (Fetch Quest, 39045,
2122
2155
  * erratum RRG 1.8 p. 69; docs/phase7-wave6.md §3.70): the whole deck is searched, only a card the player could legally
@@ -1,14 +1,4 @@
1
1
  import type { AbilityRegistry } from "../../../engine/src/index.js";
2
- /**
3
- * DSL shapes the engine supports that no base card uses yet, so the mod SDK's feature walk over the base registry
4
- * (`dslFeatures(PLAYABLE_DEPS.abilities)`, `SUPPORTED_DSL_FEATURES`) would not find them, and a custom-content pack that
5
- * uses them would be refused by a client that can run it (docs/custom-content-packs.md §6, §11.2). One small example
6
- * definition per primitive, built with the same builders a pack script uses; the SDK walks these with the base
7
- * registry. Never registered with the engine: no card id here is a real card, and nothing plays them.
8
- *
9
- * Add an entry with each engine primitive that lands for custom content before any base card uses it; it can go once a
10
- * base card does.
11
- */
12
2
  export declare const ENGINE_ONLY_DSL_EXAMPLES: AbilityRegistry;
13
3
  /** Every example is a valid definition (checked by the DSL's own validator, as `defineAbilities` would). */
14
4
  export declare const engineOnlyDslProblems: () => readonly string[];
@@ -1267,6 +1267,18 @@ export declare const eventDamageTakenBy: (of: TargetRef) => ValueSpec;
1267
1267
  * lethal or defeated by a non-damage effect.
1268
1268
  */
1269
1269
  export declare const defeatExcessDamage: ValueSpec;
1270
+ /**
1271
+ * In an "after X is defeated" ability on a scheme's defeat: the excess threat it recorded, the threat the defeating
1272
+ * removal attempted beyond what the scheme had (#890 item 8). 0 when it took exactly the last threat.
1273
+ */
1274
+ export declare const defeatExcessThreat: ValueSpec;
1275
+ /**
1276
+ * "After a side scheme is overdefeated (more threat was removed from it than it had)" (The Rose's Hero Resistance and
1277
+ * Rose's Greenhouse, `the-rose-bf`): a response's `while` on a `schemeDefeated` pattern, true when the defeating removal
1278
+ * attempted more threat than the scheme had, whatever made it. The opposite of `exactlyDefeated`, which also asks for a
1279
+ * thwart.
1280
+ */
1281
+ export declare const overdefeated: Predicate;
1270
1282
  /** "If this minion was defeated with excess damage" (Shifting Apparition, `sm` 27091). */
1271
1283
  export declare const defeatedWithExcessDamage: Predicate;
1272
1284
  /**
@@ -1390,8 +1402,9 @@ export declare const duringVillainPhaseStepOne: Predicate;
1390
1402
  export declare const duringTurnOf: (player?: PlayerRef) => Predicate;
1391
1403
  /**
1392
1404
  * "The first [card type] played each round" (Steve Rogers, Living Legend: "Reduce the cost of the first ally
1393
- * played each round by 1"). FAQ "Steve Rogers (#1B)" (RRG 1.8 p. 59): applies to the very first ally that player
1394
- * plays each round, whatever form they're in when it's played — so this reads the round count, not the phase's.
1405
+ * played each round by 1"). FAQ "Steve Rogers (#1B)" (RRG 1.8 p. 59): applies to the very first ally played each
1406
+ * round, whatever form they're in when it's played — so this reads the round count, not the phase's. `player`: whose
1407
+ * plays count; `{ kind: "each" }` counts every player's ("played" names no player, so Living Legend uses it, #888).
1395
1408
  */
1396
1409
  export declare const firstThisRound: (cardType: string, player?: PlayerRef) => Predicate;
1397
1410
  /** "The total cost of all allies beneath it" (Hydra Prison, `trors`). */
@@ -5,7 +5,8 @@
5
5
  *
6
6
  * - **A pack scenario** is built generically from its `Scenario` record, the way `coreScenario` builds a Core one: the
7
7
  * villain's stages, the main scheme, the scenario's own sets, the picked modular sets, the Standard (and Expert) set,
8
- * each hero's obligation and nemesis set. A pack scenario may use only the plain fields and `setAsideCardIds` (`CUSTOM_SCENARIO_FIELDS`);
8
+ * each hero's obligation and nemesis set. A pack scenario may use only the plain fields, `setAsideCardIds` and
9
+ * `setAsideModularSetCount` (`CUSTOM_SCENARIO_FIELDS`);
9
10
  * anything a printed scenario needs a hand-written builder for (several villains, a set-aside deck, a villain choice)
10
11
  * is refused by `customScenarioProblems` rather than built wrong.
11
12
  * - **A pack modular set at a base scenario** is added to the base builder's own game: the base picks go through
@@ -16,7 +17,7 @@
16
17
  * Base behaviour is untouched: with no custom content `playableScenarioWithCustom` is `playableScenario`.
17
18
  */
18
19
  import { type AnyCard, type EncounterSet, type Scenario } from "../../../content/src/index.js";
19
- import type { GameSetupConfig } from "../../../engine/src/index.js";
20
+ import { type GameSetupConfig } from "../../../engine/src/index.js";
20
21
  import { type PlayableScenarioOptions } from "./index.js";
21
22
  /** What a game takes from custom packs: their cards, encounter sets and scenario records, whole. */
22
23
  export interface CustomContent {
@@ -32,7 +32,6 @@ export declare const ANT_MAN_OBLIGATION_NEMESIS: {
32
32
  readonly "12026.tech-theft-constant": import("../../../../engine/src/index.js").AbilityDefinition;
33
33
  readonly "12027.yellowjacket-constant": import("../../../../engine/src/index.js").AbilityDefinition;
34
34
  readonly "12027.yellowjacket-constant-2": import("../../../../engine/src/index.js").AbilityDefinition;
35
- readonly "12028.size-increase-constant": import("../../../../engine/src/index.js").AbilityDefinition;
36
35
  readonly "12028.size-increase-forced-response": import("../../../../engine/src/index.js").AbilityDefinition;
37
36
  readonly "12029.when-revealed": import("../../../../engine/src/index.js").AbilityDefinition;
38
37
  };
@@ -61,6 +61,7 @@ export declare const SHIELD_TECH_CAMPAIGN_CARDS: {
61
61
  readonly costEffects?: number;
62
62
  readonly generates?: import("../../../../../engine/src/index.js").ResourceGeneration;
63
63
  readonly generatesFor?: import("../../../../../engine/src/index.js").TargetQuery;
64
+ readonly generatesForAbility?: true;
64
65
  readonly overpayOnly?: true;
65
66
  readonly minX?: number;
66
67
  readonly playCostReduction?: {
@@ -91,6 +92,7 @@ export declare const SHIELD_TECH_CAMPAIGN_CARDS: {
91
92
  readonly costEffects?: number;
92
93
  readonly generates?: import("../../../../../engine/src/index.js").ResourceGeneration;
93
94
  readonly generatesFor?: import("../../../../../engine/src/index.js").TargetQuery;
95
+ readonly generatesForAbility?: true;
94
96
  readonly overpayOnly?: true;
95
97
  readonly minX?: number;
96
98
  readonly playCostReduction?: {
@@ -3,7 +3,7 @@ export declare const CONTENT_VERSION = "0.0.0";
3
3
  * Schema version for the card data shape itself (independent of how many
4
4
  * cards/cycles have been ingested). Bump when a breaking shape change lands.
5
5
  */
6
- export declare const SCHEMA_VERSION = "0.50.0";
6
+ export declare const SCHEMA_VERSION = "0.52.0";
7
7
  export * from "./schema/index.js";
8
8
  export * from "./data/index.js";
9
9
  export * from "./import/index.js";
@@ -127,6 +127,13 @@ interface PlayerCardCommon extends BaseCard {
127
127
  * `Deck` or `StarterDeck`, and not counted toward deck size. `validateDeck` refuses it in a card list.
128
128
  */
129
129
  readonly separateDeck?: string;
130
+ /**
131
+ * An identity-specific card (`aspect: "hero:<identity id>"`) outside that identity's set (#890 item 13): a deck for
132
+ * that identity may include it, up to its `deckLimit`, and no deck must. A house-rule pack's card for an official
133
+ * hero ("Don't Make Me Angry!" for Hulk, `hulk-angry-bf`: "Permanent. Setup."), so the official precons and every
134
+ * other deck for that hero stay legal without it. Only on a card whose `aspect` names an identity.
135
+ */
136
+ readonly optionalForIdentity?: true;
130
137
  /**
131
138
  * The aspect printed on an identity-specific card that also belongs to an aspect (wave 2). Spider-Woman's set holds
132
139
  * Venom Blast (Aggression), Pheromones (Leadership), Contaminant Immunity (Protection) and Inconspicuous (Justice):
@@ -380,6 +380,11 @@ export interface PackPreview {
380
380
  readonly schema: typeof PACK_PREVIEW_SCHEMA_VERSION;
381
381
  readonly packId: string;
382
382
  readonly version: string;
383
+ /**
384
+ * The pack's full description (`PackManifest.description`), so the store page shows it before the pack is installed,
385
+ * where the catalog has only its one-line `summary` (#890 item 18). Absent in a preview built before the field.
386
+ */
387
+ readonly description?: string;
383
388
  /**
384
389
  * The card the store leads with: the hero identity of a hero pack (both faces), the villain (stage I) or main scheme
385
390
  * of a scenario pack, the first scenario's villain of a campaign pack. `images` are its faces' pictures, pack paths.
@@ -1710,6 +1710,13 @@ export type RuleSpec =
1710
1710
  | {
1711
1711
  readonly kind: "attacksDealExtraDamage";
1712
1712
  readonly amount: number;
1713
+ /**
1714
+ * `amount` for each counter of this type on the attacked character: "When a character with one or more Exposed
1715
+ * status cards is attacked, … that attack deals 1 additional damage for each" (Sentinel's Expose insert, the
1716
+ * `sentinel-tw` community pack; #890 item 10) is `{ amount: 1, perCounterOnTarget: "exposed" }`, the counters
1717
+ * then removed by the pack's own response to the attack. 0 counters: no additional damage.
1718
+ */
1719
+ readonly perCounterOnTarget?: string;
1713
1720
  readonly target: TargetQuery;
1714
1721
  readonly attacker?: TargetQuery;
1715
1722
  readonly while?: Predicate;
@@ -3473,6 +3480,15 @@ export interface AbilityCost {
3473
3480
  * hit points" is the card's `max`, not an engine cap.
3474
3481
  */
3475
3482
  readonly damageSelf?: number | ValueSpec | DamageSelfChoice;
3483
+ /**
3484
+ * "...and take 2 unpreventable damage" as part of a cost (Sentinel's "destroy" a Component, the `sentinel-tw`
3485
+ * community pack; #890 item 11): the `damageSelf` damage is dealt `unpreventable` (the MC62 insert's "cannot be
3486
+ * reduced or prevented", `EffectSpec dealDamage.unpreventable`), so neither a tough status card, a "prevent all
3487
+ * damage" constant nor a reduction stops the cost from being paid; the tough card stays. A "cannot take damage" rule
3488
+ * or a cap on the damage taken still does (RRG 1.8 "Cannot", p. 13): the cost is paid only if all of it is taken
3489
+ * (RRG 1.8 "Cost", p. 14). Only with a fixed or computed `damageSelf`, not a chosen one.
3490
+ */
3491
+ readonly damageSelfUnpreventable?: true;
3476
3492
  /**
3477
3493
  * "Discard the top card of the encounter deck →", "choose a number from 1 to 5, discard that many cards from the top
3478
3494
  * of the encounter deck →" (`EncounterDeckDiscardCost`, docs/phase7-wave9.md §3.43 (a)).
@@ -3761,6 +3777,16 @@ export interface AbilityCost {
3761
3777
  * - Unlike `damageSelf` and `indirectDamage` ("take N damage"), which are not paid unless all of it is taken.
3762
3778
  */
3763
3779
  readonly damageCards?: DamageCostPick;
3780
+ /**
3781
+ * "Flip [a card you control] →" (Sentinel's Components, the `sentinel-tw` community pack: "exhaust or destroy Arms
3782
+ * (Intact) →", where destroying flips the Component to its Destroyed side; #890 item 11): the picked cards in play,
3783
+ * each a double-sided card (`flipSide`) the payer controls, turn to their other face as the cost, keeping their state as
3784
+ * any same-type flip does (RRG 1.8 "Flip", p. 20), and each flip is announced (`cardFlipped`). The `flipSelf` of
3785
+ * another card: a candidate must have another face that no `cannotFlip` rule names (RRG 1.8 "Cost", p. 13: paid in
3786
+ * full or not at all). An exhausted card can still be flipped. A list is several picks paid together, as for
3787
+ * `exhaustCards`.
3788
+ */
3789
+ readonly flipCards?: InPlayCostPick | readonly InPlayCostPick[];
3764
3790
  /**
3765
3791
  * "Find Touched and attach it to a character other than Rogue … →" (Energy Transfer, `rogue` 38007, erratum RRG 1.8
3766
3792
  * p. 69; docs/phase7-wave6.md §3.49): as the cost, a card is attached to a host the payer picks. See `AttachCost`.
@@ -3979,7 +4005,7 @@ export interface TuckedCostPick extends InPlayCostPick {
3979
4005
  /** The pick as a `TuckedCostPick` when it is one (`AbilityCost.discardTucked`), else null. */
3980
4006
  export declare const tuckedPickOf: (pick: InPlayCostPick) => TuckedCostPick | null;
3981
4007
  /** How an `InPlayCostPick` spends its cards. */
3982
- export type InPlayCostMode = "exhaust" | "ready" | "return" | "discard" | "damage";
4008
+ export type InPlayCostMode = "exhaust" | "ready" | "return" | "discard" | "damage" | "flip";
3983
4009
  /**
3984
4010
  * Every `InPlayCostPick` a cost makes, in the order they are checked: the exhaust picks, the ready pick, the return
3985
4011
  * pick, the discard pick, the tucked-card discard pick (mode `discard` too; told apart by `tuckedPickOf`), the damage
@@ -4228,6 +4254,11 @@ export interface AbilityDefinition {
4228
4254
  * that leaves another way strands it under the RRG. Card text over the Rules Reference (RRG 1.8 "The Golden Rules",
4229
4255
  * p. 4). Not inferred from the trigger: another card that only answers its host leaving ("draw 1 card") is still
4230
4256
  * removed from the game (owner, 2026-10-18).
4257
+ *
4258
+ * Also on a player card that is not permanent and attaches itself by its own effect (Juston Seyfert, a support the
4259
+ * `sentinel-tw` community pack moves onto a side scheme: "After attached side scheme is defeated, put Juston Seyfert
4260
+ * in play under your control"; #890 item 12): it comes back unattached to its controller's play area instead of being
4261
+ * discarded with its host (`discardWithLeavingHost`).
4231
4262
  */
4232
4263
  readonly staysWhenHostLeaves?: "leaves" | "defeated";
4233
4264
  /**
@@ -4260,6 +4291,14 @@ export interface AbilityDefinition {
4260
4291
  readonly generates?: ResourceGeneration;
4261
4292
  /** Resource abilities only: "generate a [wild] resource for an event" — usable only while paying for a matching card. */
4262
4293
  readonly generatesFor?: TargetQuery;
4294
+ /**
4295
+ * Resource abilities only: "generate a [wild] resource **for an upgrade ability**" (With Great Firepower, the
4296
+ * `spider-punisher-tw` community pack; #890 item 3): usable only while paying an ability's cost, the ability's card
4297
+ * matching `generatesFor` (an ability's payment is for its own card, docs/phase7-wave6.md §3.30), never to play a
4298
+ * card. A play payment (`isPlayPayment`: a card being played, and the card paid for) is refused, and so is a payment
4299
+ * for no card.
4300
+ */
4301
+ readonly generatesForAbility?: true;
4263
4302
  /**
4264
4303
  * Resource abilities only: "Resource: Generate a [energy] resource **to overpay for a card**. (Limit once per card.)"
4265
4304
  * (Mr. Hollywood, `wonder_man` 58009; docs/phase7-wave10-hero-packs.md H3.14). What the ability generates may join a
@@ -447,6 +447,8 @@ export interface ResourceDamageCost {
447
447
  readonly instanceId: InstanceId;
448
448
  readonly spender: PlayerId;
449
449
  readonly amount: number;
450
+ /** The damage is unpreventable (`AbilityCost.damageSelfUnpreventable`). */
451
+ readonly unpreventable?: true;
450
452
  }
451
453
  /**
452
454
  * A step of a resource ability's cost that `payCost` would push as an effects frame (Clarity of Purpose's "deal 1
@@ -914,7 +916,7 @@ export type ActionTiming = "turn" | "any";
914
916
  * Where an effect plays a card from "as if it were in your hand" (`EffectSpec playFromHand.from`). `tuckedUnder` holds
915
917
  * the resolved hosts: any card tucked under one of them (Med Lab 38028; docs/phase7-wave6.md §3.57), whoever owns it.
916
918
  */
917
- export type PlayFromZone = "hand" | "setAside" | "deck" | DeckAsIfInHandPlayFrom | {
919
+ export type PlayFromZone = "hand" | "setAside" | "deck" | "discard" | DeckAsIfInHandPlayFrom | {
918
920
  readonly tuckedUnder: readonly InstanceId[];
919
921
  } | SeparateDeckPlayFrom;
920
922
  /**
@@ -43,6 +43,26 @@ export interface CampaignDefinition {
43
43
  * this, a node's instruction list is not a function of the definition alone and MC27 would force an engine change.
44
44
  */
45
45
  readonly conditionalInstructions?: Readonly<Record<string, CampaignInstruction>>;
46
+ /**
47
+ * Brings a log saved by an older build up to the shape the current definition writes, when what a log *means*
48
+ * changed without any id changing (so `version` stays put and the log still loads). `resolveBetweenGames` runs these
49
+ * on the log first, before anything else reads it, every time it composes a game; its returned log carries the
50
+ * result, so the upgrade is persisted with the composed game (and a `nodeStart` retry restores to it).
51
+ *
52
+ * Engine bookkeeping, not printed rules: they are not traced as steps of the attempt. They may only rewrite log data
53
+ * (fields, grants, decks, removals). The runner throws on an upgrade that:
54
+ * - is not a `betweenGames` step;
55
+ * - asks for a choice (`choose`, or a `random` the players may decline);
56
+ * - draws from the campaign RNG (`random`);
57
+ * - sets cards aside or composes a villain or encounter sets (those feed a game, and the upgrade's run is thrown
58
+ * away);
59
+ * - moves the campaign's position or status (`markNode`, `progressNode`, `endCampaign`, or anything else that
60
+ * changes the next node, a node's mark or progress, or the status).
61
+ * The mod SDK holds them to the same pack limits as every other instruction. Each must also be idempotent, so a log
62
+ * already in the current shape, or one upgraded before, is left as it is. Absent: no upgrade.
63
+ * Issue #873: a Sinister Motives log saved before MC27 p. 22 node 13's flip moved to Setup.
64
+ */
65
+ readonly logUpgrades?: readonly CampaignInstruction[];
46
66
  /**
47
67
  * What happens to a player eliminated from a game the rest of the table goes on to win (§4.6b). Absent means
48
68
  * nothing does: the eliminated seat takes part in the Victory steps like any other seat, which is what a standard
@@ -876,6 +896,14 @@ export type CampaignOp = {
876
896
  readonly kind: "setGrantFace";
877
897
  readonly card: CampaignValue;
878
898
  readonly face: string;
899
+ /**
900
+ * The face is reached by a campaign Setup flip each game, not by a permanent swap: the copy enters play on its
901
+ * front and the node's own `inGame` Setup instruction turns it (MC27 p. 22, "**Setup:** Each player flips their
902
+ * … upgrade to its Enhanced side", resolved at RRG v1.8 p. 51 setup step 13, after step 11's Setup keyword put
903
+ * the front into play). Recorded on the grant as `CampaignGrant.faceAtSetup`, so the log still says which face
904
+ * the card is on. Absent: the face is permanent and the copy enters play already on it (MC10 p. 12).
905
+ */
906
+ readonly atSetup?: true;
879
907
  }
880
908
  /** MC10 p. 5's Tech upgrade choice; MC27 p. 22's "chooses an aspect card in their collection"; MC60 p. 9 step 4. */
881
909
  | {
@@ -1363,6 +1391,12 @@ export interface CampaignGrant {
1363
1391
  readonly leftOut?: true;
1364
1392
  /** Which face the grant is on: MC10 p. 12's "Improved" side, MC27 p. 22's Enhanced side. */
1365
1393
  readonly face?: string;
1394
+ /**
1395
+ * `face` is reached by a campaign Setup flip each game (`setGrantFace`'s `atSetup`; MC27 p. 22, RRG v1.8 p. 51 step
1396
+ * 13), so the copy enters play on its front and is not in `CampaignSeatInput.grantFaces`. Absent: the copy enters
1397
+ * play already on `face` (MC10 p. 12). Only ever set alongside `face`.
1398
+ */
1399
+ readonly faceAtSetup?: true;
1366
1400
  /** The node that granted it, for the sheet and for `LossPolicy.retryBaseline`. */
1367
1401
  readonly grantedAtNodeId: string;
1368
1402
  }
@@ -1597,6 +1631,18 @@ export interface CampaignSeatInput {
1597
1631
  * when every grant is exempt, so an input composed before the field existed is unchanged.
1598
1632
  */
1599
1633
  readonly grantDeckSizes?: readonly GrantDeckSizeRule[];
1634
+ /**
1635
+ * The granted copies that are on another face (`CampaignGrant.face`): one entry per such copy in `deck`. MC10 p. 12
1636
+ * replaces a "Basic" Condition upgrade "with its 'Improved' side", so that copy enters play on that face at setup
1637
+ * (`putSetupCardsIntoPlay`); MC27 p. 22's Enhanced side the same way. Absent when no grant names a face, so every
1638
+ * earlier game input is unchanged.
1639
+ */
1640
+ readonly grantFaces?: readonly CampaignGrantFace[];
1641
+ }
1642
+ /** One granted copy and the face the campaign log has it on (`CampaignSeatInput.grantFaces`). */
1643
+ export interface CampaignGrantFace {
1644
+ readonly cardId: CardId;
1645
+ readonly face: string;
1600
1646
  }
1601
1647
  /** An instruction the runner has already gated and ordered, ready for the engine to resolve at its window. */
1602
1648
  export interface ResolvedInstruction {
@@ -186,6 +186,8 @@ export type ChoicePrompt = {
186
186
  readonly kind: "chooseTarget";
187
187
  readonly slot: string;
188
188
  readonly abilityId: AbilityId | null;
189
+ /** The card's own question for this pick (`EffectSpec chooseTarget.prompt`, issue #911); absent: "Choose a target". */
190
+ readonly title?: string;
189
191
  } | {
190
192
  readonly kind: "chooseAttachmentTarget";
191
193
  readonly instanceId: InstanceId;