Skip to content

[E-GCNV-2d] Migrate @randsum/daggerheart to schema #987

@alxjrvs

Description

@alxjrvs

Parent Epic

#979

Schema Prerequisites

Spec

{
  "$schema": "https://randsum.dev/schemas/v1/randsum.json",
  "name": "Daggerheart",
  "shortcode": "daggerheart",
  "version": "1.0.0",
  "game_url": "https://darringtonpress.com/daggerheart/",

  "pools": {
    "hope": { "sides": 12 },
    "fear": { "sides": 12 }
  },

  "roll": {
    "inputs": {
      "modifier": { "type": "integer", "minimum": -30, "maximum": 30, "default": 0 },
      "amplifyHope": { "type": "boolean", "default": false },
      "amplifyFear": { "type": "boolean", "default": false },
      "rollingWith": { "type": "string", "enum": ["Advantage", "Disadvantage"] }
    },
    "dicePools": {
      "hope": { "pool": { "sides": { "$input": "amplifyHope", "ifTrue": 20, "ifFalse": 12 } } },
      "fear": { "pool": { "sides": { "$input": "amplifyFear", "ifTrue": 20, "ifFalse": 12 } } }
    },
    "conditionalPools": [
      {
        "condition": { "input": "rollingWith", "operator": "=", "value": "Advantage" },
        "pool": { "sides": 6 },
        "arithmetic": "add"
      },
      {
        "condition": { "input": "rollingWith", "operator": "=", "value": "Disadvantage" },
        "pool": { "sides": 6 },
        "arithmetic": "subtract"
      }
    ],
    "resolve": {
      "comparePoolHighest": {
        "pools": ["hope", "fear"],
        "ties": "critical hope",
        "outcomes": { "hope": "hope", "fear": "fear" }
      }
    },
    "postResolveModifiers": [{ "add": { "$input": "modifier" } }]
  }
}

Migration Steps

  1. Create games/daggerheart/daggerheart.randsum.json with the spec above
  2. Run bun run codegen — verify daggerheart.ts generates correctly
  3. Add daggerheart.ts to .gitignore
  4. Delete games/daggerheart/src/ and tsconfig.json
  5. Update package.json (same pattern as previous migrations)
  6. Update __tests__/roll.test.ts:
    • Change import to import { roll } from '@randsum/daggerheart'
    • Input field names are unchanged; all expectations unchanged
  7. Run bun run --filter @randsum/daggerheart test — must pass

Acceptance Criteria

  • daggerheart.randsum.json exists and is valid
  • daggerheart.ts is gitignored and generates cleanly
  • All existing test expectations pass
  • amplifyHope/amplifyFear correctly change pool sides to d20
  • rollingWith: 'Advantage'/'Disadvantage' correctly adds/subtracts a d6
  • critical hope result on tied pools
  • No src/ directory remains

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions