Register

Roll Groups

An Add-on Module for Foundry Virtual Tabletop

Author: Zhell Project Source: Project URL Version 10 Last Updated 4 days, 9 hours ago

Roll Groups

This module lets you configure multiple damage buttons for each item on an actor. For the formulas ('damage parts') in the item, you can group them in as many different combinations as you would like.

How to use

On any item with at least two damage parts containing a formula, there is a configuration button next to the 'Damage Formula' header.

Clicking this button opens the configuration menu. Create as many groups as you like, and give each a name. Tick any damage parts that should be included in the roll.

When using the item, the normal damage button is replaced with one button for each group. Configuring damage groups on an item will not affect any other attributes of the item. Specifically, the 'Versatile Damage' and 'Other Formula' fields will still be available and function identically to core system behavior.

Macros

The function Item#rollDamageGroups is added and works exactly as Item#rollDamage, and in addition accepts the key rollgroup, which is an integer denoting which group to roll (starting at zero).

Spell Scaling

No special consideration needs to be kept in mind for spells. It works exactly as in core. A cantrip that scales with a scaling formula provided will add that formula at the appropriate levels, no matter the number of parts. A scaling cantrip with multiple formulas, and no specific scaling formula provided, will scale each formula that is rolled. Same as core system behavior. Leveled spells, as in core, will not scale unless a formula is provided. For more complex setups, consider using @details.level or @item.level in your formulas (for the character and spell level, respectively).

Migrating from MRE to Roll Groups in v10

If you were using Minimal Rolling Enhancements in v9 and wish to migrate all actors in the world to using Roll Groups, this provided script will copy the roll group data of all the actors' items to the new format.

for ( const a of game.actors ) {
    console.log(`ROLLGROUPS: Migrating ${a.name}'s items.`);
    const items = a.items.filter(i => {
        return i.flags["mre-dnd5e"]?.formulaGroups?.length > 1;
    });
    const updates = items.map(i => {
        let string = JSON.stringify(i.flags["mre-dnd5e"].formulaGroups);
        string = string.replaceAll("formulaSet", "parts");
        const object = JSON.parse(string);
        return {_id: i.id, "flags.rollgroups.config.groups": object};
    });
    await a.updateEmbeddedDocuments("Item", updates);
    console.log(`ROLLGROUPS: Successfully migrated ${a.name}'s items.`);
}

Similarly this script migrates all items in the item directory. If you replace the 'pack' attribute with the key of a compendium, it will migrate all items in that compendium instead.


console.log(`ROLLGROUPS: Migrating all items.`);
const updates = game.items.filter(i => {
    return i.flags["mre-dnd5e"]?.formulaGroups?.length > 1;
}).map(i => {
    let string = JSON.stringify(i.flags["mre-dnd5e"].formulaGroups);
    string = string.replaceAll("formulaSet", "parts");
    const object = JSON.parse(string);
    return {_id: i.id, "flags.rollgroups.config.groups": object};
});
const updated = await Item.updateDocuments(updates, {pack: undefined});
console.log(`ROLLGROUPS: Successfully mgirated ${updated.length} items.`);

Complementary Modules

These modules have all been confirmed to work without issues and complement Roll Groups.

This module should not be used with WIRE or MIDI.

Supported Game Systems

  1. DnD5e

    Latest Version: Version 2.1.5 Last Updated 4 days, 9 hours ago

Categories

Available Versions

  1. Version 10.0.6

    Compatible Foundry Versions: 10 - 10.291 Installation Link: Manifest URL Update Notes: Read Notes
  2. Version 10.0.5

    Compatible Foundry Versions: 10 - 10.290 Installation Link: Manifest URL Update Notes: Read Notes
  3. Version 10.0.4

    Compatible Foundry Versions: 10 - 10.288 Installation Link: Manifest URL Update Notes: Read Notes
  4. Version 10.0.3

    Compatible Foundry Versions: 10 - 10.286 Installation Link: Manifest URL Update Notes: Read Notes
  5. Version 10.0.2

    Compatible Foundry Versions: 10 - 10.285 Installation Link: Manifest URL Update Notes: Read Notes
  6. Version 10.0.1

    Compatible Foundry Versions: 10 - 10.284 Installation Link: Manifest URL Update Notes: Read Notes
  7. Version 10.0.0

    Compatible Foundry Versions: 10 - 10.284 Installation Link: Manifest URL Update Notes: Read Notes