What problem does it solve?
Foundry VTT module development often requires duplicating complex dice logic, roll calculations, and chat formatting. This Skill consolidates best practices for rolling, getRollData preparation, custom dice types, and roll modifiers, saving time and reducing bugs.
Core Features & Use Cases
- Dice Roll Formulas: Build and evaluate dynamic dice expressions using the Roll class.
- Chat Integration: Send formatted rolls to chat with toMessage, including flavor and speaker context.
- Roll Modifiers & Patterns: Support advantage/disadvantage, exploding dice, rerolls, and keep/drop mechanics.
- getRollData & Data Context: Provide a ready-to-use data context for formulas from actor/item data.
- Custom Dice/Rolls: Guidance for creating and registering custom Die and Roll classes.
- Common Project Scenarios: Implementing attack/damage rolls, skill checks, and ability checks in modules.
Quick Start
- Create and evaluate a basic roll: const roll = new Roll("2d6 + @modifier", data); await roll.evaluate(); console.log(roll.total);