Skip to content

feat: renaming, conditions, summon, and encounter controls#7

Open
arrowedisgaming wants to merge 1 commit into
ly0va:mainfrom
arrowedisgaming:feature/rename-conditions-summon
Open

feat: renaming, conditions, summon, and encounter controls#7
arrowedisgaming wants to merge 1 commit into
ly0va:mainfrom
arrowedisgaming:feature/rename-conditions-summon

Conversation

@arrowedisgaming
Copy link
Copy Markdown

Summary

This PR adds several features from BeastVault's planned roadmap plus encounter management improvements:

  • Adversary Renaming — auto-suffix duplicate names on insert, inline rename on rendered cards, per-instance naming for multi-count adversaries
  • Condition Tracking — toggle badges for 8 standard Daggerheart conditions per instance, with support for custom conditions via YAML conditions field or ad-hoc "+" button
  • Summon Buttons — features with a summon field render a button that inserts the referenced adversary
  • Clickable "Mark a Stress" — text in feature descriptions becomes interactive; shows instance picker for multi-count adversaries
  • HP/Stress Controls — inline +, -, and clear buttons on HP and Stress rows

All changes are backward-compatible — no state migration needed, existing data is preserved.

Details

Files changed

  • src/main.ts — state type extended with conditions and instanceName, ctx passthrough to AdversaryCard, Data type widened for arrays
  • src/ui.ts — all UI additions (renaming, conditions, summon, mark-a-stress, stat controls)
  • src/utils.tsescapeRegex(), autoSuffixName(), DH_CONDITIONS constant
  • styles.css — ~70 lines of new CSS for all features

New YAML fields

  • conditions on adversaries — list of custom condition names
  • summon on features — adversary name or list of names to summon

Design decisions

  • Conditions are stored per-instance in plugin state (array), written directly rather than through updateCard since it's designed for scalar key-paths
  • Instance names are a runtime concept stored in state, not in YAML
  • Auto-suffix logic is shared between library insert and summon via autoSuffixName() in utils
  • "Mark a Stress" uses event delegation on the card element, consistent with existing dice roll handling

Test plan

  • Insert same adversary twice — second gets suffix "2"
  • Double-click name on card — inline input, Enter saves, Escape cancels
  • Multi-count adversary shows instance names, click to customize
  • Condition badges toggle, persist across restart, independent per instance
  • Custom conditions via YAML and "+" button
  • Environments show no conditions
  • Feature with summon field renders button, inserts adversary
  • "Mark a Stress" auto-marks for single instance, shows picker for multi
  • +/- and clear buttons on HP and Stress rows work correctly
  • Horde size updates when using +/- buttons on HP
  • "Clear all card state" clears conditions and instance names
  • No regressions in existing HP/stress/dice/color/canvas functionality

Adversary Renaming:
- Auto-suffix duplicate names on insert (Bladed Guard 2, 3, etc.)
- Inline rename on rendered cards (double-click name to edit)
- Per-instance naming for multi-count adversaries

Condition Tracking:
- Toggle badges for 8 standard Daggerheart conditions per instance
- Custom conditions via YAML `conditions` field
- Ad-hoc custom conditions via "+" button on condition bar

Summon Buttons:
- Features with `summon` field render insert buttons
- Summoned adversaries get unique IDs and auto-suffixed names

Encounter Controls:
- Clickable "Mark a Stress" text with instance picker for multi-count
- Per-stat +/- and clear buttons for HP and Stress rows

All changes are backward-compatible with existing state data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant