foundryvtt-dcc / dcc

Foundry Tabletop System for Dungeon Crawl Classics RPG
MIT License
32 stars 20 forks source link

Add an input box on the spell entity for a RollTable #45

Closed algnc closed 4 years ago

algnc commented 4 years ago

For Spells, a box could be added to allow a GM to add a RollTable that the spell check will roll on when the d20 button is pressed next to a spell. They would have to add the table themselves.

cyface commented 4 years ago

I think this is a good idea; I think we should also make a system setting to point at crit and fumble tables to do the same.

On Mon, Aug 17, 2020 at 9:33 AM algnc notifications@github.com wrote:

For Spells, a box could be added to allow a GM to add a RollTable that the spell check will roll on when the d20 button is pressed next to a spell. They would have to add the table themselves.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cyface/foundryvtt-dcc/issues/45, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAMEH3E2O6JMEFRVSD27LTSBFEVNANCNFSM4QBYUN3A .

algnc commented 4 years ago

here is the macro I am using now which I have cobbled together. I am not sure how to make it double Level Bonus on a crit, check for Fumble and Disapproval

// Set table let tableName = "Blessing";

// getting all actors of selected tokens let actors = canvas.tokens.controlled.map(({ actor }) => actor);

// if there are no selected tokens, roll for the player's character. if (actors.length < 1) { actors = game.users.entities.map(entity => { if (entity.active && entity.character !== null) { return entity.character; } }); } let confirmed = false;

// Add modifier for a d20 roll new Dialog({ title: "Spellburn or miscellaneous bonus", content: `

 `,
buttons: {
    one: {
        icon: '<i class="fas fa-check"></i>',
        label: "Roll!",
        callback: () => confirmed = true
    },
    two: {
        icon: '<i class="fas fa-times"></i>',
        label: "Cancel",
        callback: () => confirmed = false
    }
},
default: "Cancel",
close: html => {
    if (confirmed) {
    let rollModifier = parseInt(html.find('[name=modifier-value]')[0].value);
    const table = game.tables.entities.find(t => t.name === tableName);
    const roll = new Roll("1d20 + @abilities.per.mod + @details.level.value + " + rollModifier, actor.getRollData());
    const customResults = table.roll({roll});
    table.draw(customResults);
}

} }).render(true);