feat: Add comprehensive module README and enhance DiceSoNice integration to support Duality Rolls.

This commit is contained in:
CPTN Cosmo 2026-02-10 03:11:24 +01:00
parent a1a3e74ea7
commit 64463504d5
No known key found for this signature in database
2 changed files with 67 additions and 4 deletions

43
README.md Normal file
View file

@ -0,0 +1,43 @@
# Immersive Crits for Daggerheart
Enhance your Daggerheart games on FoundryVTT with immersive, fantasy-themed animations for critical hits!
This module adds visually stunning effects to chat cardswhen a player or GM rolls a crit.
## Features
- **Fantasy Themes**: Choose from a variety of animations to match your campaign's tone:
- **Embers**: Warm, drifting particles that float upwards like a campfire in the wind. Randomized speed, size, and drift.
- **Pulse**: A customizable glowing pulse effect. Choose any color to match your specific magic or mood.
- **Holy**: A slow, majestic golden burst of divine energy.
- **Necrotic**: Eerie green fumes that rise seamlessly from the darkness.
- **Arcane**: Mystical purple energy surges.
- **Nature**: Gentle leaves falling in the breeze.
- **Individual Customization**:
- **Pulse Color**: When the "Pulse" theme is active, use the color picker to set the perfect hue.
- **DiceSoNice Integration**: Automatically triggers special 3D dice effects on critical hits (fully configurable).
## Installation
1. Open FoundryVTT and go to the **Add-on Modules** tab.
2. Click **Install Module**.
3. In the "Manifest URL" field, paste the following link:
`https://github.com/cptn-cosmo/dh-immersive-crits/releases/latest/download/module.json`
4. Click **Install**.
## Configuration
Go to **Game Settings** -> **Configure Settings** -> **Module Settings** -> **Immersive Crits for Daggerheart**.
- **Critical Hit Animation**: Select your preferred visual theme (None, Embers, Pulse, Arcane, Holy, Necrotic, Nature).
- **Pulse Color**: (Visible only when "Pulse" is selected) Choose the color for the pulse animation.
- **DiceSoNice Critical Effect**: Select a special effect for 3D dice rolls (Fire, Ice, Lightning, etc.).
## Compatibility
- **FoundryVTT**: v13+
- **System**: Daggerheart
## Credits
Created by **CPTN Cosmo**.
Project URL: [GitHub](https://github.com/cptn-cosmo/dh-immersive-crits)

View file

@ -178,17 +178,37 @@ Hooks.on('renderChatMessage', (message, html, data) => {
}
});
// Hook into DiceSoNice to trigger effects
// Hook into DiceSoNice to trigger effects
Hooks.on('diceSoNiceRollStart', (messageId, context) => {
// console.log('DSN Hook Fired', messageId, context);
const roll = context.roll;
if (!roll) return;
if (isCriticalHit(roll)) {
// console.log('DSN: Critical Hit Detected');
const effect = game.settings.get('dh-immersive-crits', 'dsnCritEffect');
// console.log('DSN Effect:', effect);
if (effect && effect !== 'none') {
roll.dice.forEach(die => {
if (!die.options) die.options = {};
die.options.specialEffect = effect === 'default' ? 'Stars' : capitalize(effect);
});
// Check if roll.dice exists and has elements
if (roll.dice && roll.dice.length > 0) {
roll.dice.forEach(die => {
if (!die.options) die.options = {};
die.options.specialEffect = effect === 'default' ? 'Stars' : capitalize(effect);
// console.log('Applied effect to die:', die);
});
} else {
// Determine if we need to iterate terms for Duality Rolls
// console.log('No roll.dice found. Checking terms:', roll.terms);
if (roll.terms) {
roll.terms.forEach(term => {
if (term.faces) { // It's a die
if (!term.options) term.options = {};
term.options.specialEffect = effect === 'default' ? 'Stars' : capitalize(effect);
}
});
}
}
}
}
});