Add encounter building tools #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/encounter-builder"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add Encounter Building Tools
Summary
Implements comprehensive encounter planning tools for D&D 5e based on DMG 2014 Chapter 13. This addresses Brad's request to reduce the number of queries needed during session prep by providing three powerful encounter building tools.
New Tools
1.
calculate_party_thresholdsPurpose: Calculate XP thresholds and daily budget for a party
Input:
party: number[]- Array of character levels (e.g., [3, 3, 3, 2])Output:
Example:
2.
evaluate_encounterPurpose: Evaluate an encounter's difficulty with full DMG calculations
Input:
party: number[]- Character levelsmonsters: Array<{cr: number|string, count?: number}>- Monsters with CR and countOutput:
Example:
3.
suggest_encounterPurpose: Generate 5-10 balanced encounter suggestions
Input:
party: number[]- Character levelsdifficulty: "easy"|"medium"|"hard"|"deadly"- Desired difficultymonster_count?: number- Preferred number of monsters (default: 1 per 4 PCs)cr_min?: number- Minimum CR XP valuecr_max?: number- Maximum CR XP valueOutput:
Example:
Key Features
✅ Full DMG 2014 Compliance: All tables and formulas from Chapter 13
✅ Fractional CR Support: Handles "1/8", "1/4", "1/2" strings and 0.125, 0.25, 0.5 decimals
✅ Party Size Adjustments: Increases multipliers for small parties (<3), decreases for large (6+)
✅ Encounter Multipliers: Accounts for action economy (1 monster = ×1, 15+ = ×4)
✅ Diverse Suggestions: Prefers mixed CR encounters over single-CR spam
✅ Comprehensive Tests: 37 tests covering DMG examples, edge cases, and all difficulty tiers
Implementation
Files Changed:
src/encounter.ts(NEW) - Core encounter logic, extracted for testabilitysrc/server.ts- Three new tool registrations with Zod schemastests/encounter-builder.test.ts(NEW) - Full test coverage (37 tests)Test Coverage:
Testing
All tests pass (112 total, 37 new):
Usage Example
Before (manual queries):
After (one query):
Reference
Based on Dungeon Master's Guide (2014) Chapter 13:
Full documentation available in:
~/.openclaw/workspace/skills/5etools/references/encounter-design.mdNext Steps
Potential future enhancements:
search_monstersto include actual monster names in suggestionsPR Link: https://git.brads.house/dungeonchurch/5e-tools-mcp/compare/main...feature/encounter-builder
Let's do that @agent
✓ Done! The
suggest_encountertool now integratessearch_monstersto populate actual monster names in suggestions.Changes:
searchIndexandrulesetoptional parameters tosuggestEncounters()2× CR 1/4 (Goblin / Wolf / Kobold))rulesetparameter to the MCP tool for filtering 2014/2024 monstersExample output:
Tests pass, compiles cleanly. Ready for review!