Damage & Attacks
The expression parser supports several specialized expression types for combat.
Expression Types
Section titled “Expression Types”Basic Expression
Section titled “Basic Expression”Returns a numeric value:
str + prof # Attack modifier8 + prof + int # Spell save DC base2 + 3 # Simple mathDice Expression
Section titled “Dice Expression”Includes dice rolls:
2d6 # Just dice2d4 + str # Dice plus modifier4d8 + 12 # Dice plus flat bonusDamage Expression
Section titled “Damage Expression”Includes damage type(s):
2d6 slashing # Single damage type2d4 + str fire # Damage with modifier2d6 fire + 1d8 cold # Multiple damage types3d8 + con necrotic # Necrotic damageSave Expression
Section titled “Save Expression”Defines a saving throw DC.
Format: DC <expression> <SAVE_TYPE>
DC 8 + prof + str STR # Strength saveDC 8 + prof + dex DEX # Dexterity saveDC 8 + prof + con CON # Constitution saveDC 8 + prof + int INT # Intelligence saveDC 8 + prof + wis WIS # Wisdom saveDC 8 + prof + cha CHA # Charisma saveHit Expression
Section titled “Hit Expression”Defines an attack roll bonus.
Format: Hit <expression>
Hit str + prof # Melee attack (Strength)Hit dex + prof # Ranged attack (Dexterity)Hit str + prof + 2 # Magic weapon (+2)Supported Damage Types
Section titled “Supported Damage Types”| Type | Description |
|---|---|
acid | Acid damage |
bludgeoning | Bludgeoning damage |
cold | Cold damage |
fire | Fire damage |
force | Force damage |
lightning | Lightning damage |
necrotic | Necrotic damage |
piercing | Piercing damage |
poison | Poison damage |
psychic | Psychic damage |
radiant | Radiant damage |
slashing | Slashing damage |
thunder | Thunder damage |
hp | Healing |
thp | Temporary hit points |
Multi-Damage Expressions
Section titled “Multi-Damage Expressions”You can combine multiple damage types in a single expression:
2d6 + str slashing + 2d6 fireThis creates a damage roll with:
2d6 + STR modifierslashing damage2d6fire damage
The parser tracks each damage type separately, allowing for proper resistance/immunity calculations.
Output Structure
Section titled “Output Structure”Damage Output
Section titled “Damage Output”{ kind: "damage", damage: { fire: { avgResult: 7, dice: { d6: {...} } }, cold: { avgResult: 9, dice: { d8: {...} } } }}Save Output
Section titled “Save Output”{ kind: "save", avgResult: 15, // The DC value saveType: "DEX", // Which save expression: "DC 8 + prof + int DEX"}Hit Output
Section titled “Hit Output”{ kind: "hit", avgResult: 7, // Attack bonus dice: { d20: {...} }, // Always includes d20 expression: "Hit str + prof"}