Giter Site home page Giter Site logo

elffriend-dnd / foundryvtt-auto-roll-npc-save-5e Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 4.0 19 KB

A Foundry VTT module which informs the GM of a saving throw result for an NPC in 5e when targeted.

License: MIT License

JavaScript 77.63% CSS 22.37%
foundry-vtt foundryvtt

foundryvtt-auto-roll-npc-save-5e's People

Contributors

akrigline avatar darkdindon avatar

Stargazers

 avatar

foundryvtt-auto-roll-npc-save-5e's Issues

[Feature Request] Auto Target Tokens that failed their saving throw.

Hey Buddy, I feel that it would be enormously helpful to have the module auto-select / auto target tokens that didn't succeed their saving throw.

In addition if I were able to shift select tokens from the chat card I'd be able to make even more use out of this wonderful module.

The macro below does this in a very smart way. Feel free to dismiss this request if it wouldn't be feasible.

const options = Object.entries(CONFIG.DND5E.abilities).reduce((acc, e) => {
return acc + ${e[1]};
}, "");
new Dialog({
title: "Roll Saves",
content:

${options}
, buttons: { roll: { icon: , label: "Roll Saves", callback: (html) => { const abi = html[0].querySelector("#save-throw-abi").value; const tar = html[0].querySelector("#save-throw-tar").value; return rollSaves(abi, tar); } } } }).render(true);

async function rollSaves(abilityId, targetValue){
if(!targetValue) return ui.notifications.warn("No target value given.");
const tokens = new Set([...canvas.tokens.controlled, ...game.user.targets]);
const failed = [];
for(const token of tokens){
const roll = await token.actor.rollAbilitySave(abilityId, {targetValue, fastForward: true});
if(!roll) continue;
if(roll.total < targetValue) failed.push(token);
}
return game.user.updateTokenTargets(failed.map(t => t.id));
}
}
}).render(true);

async function rollSaves(abilityId, targetValue){
if(!targetValue) return ui.notifications.warn("No target value given.");
const tokens = new Set([...canvas.tokens.controlled, ...game.user.targets]);
const failed = [];
for(const token of tokens){
const roll = await token.actor.rollAbilitySave(abilityId, {targetValue, fastForward: true});
if(!roll) continue;
if(roll.total < targetValue) failed.push(token);
}
return game.user.updateTokenTargets(failed.map(t => t.id));
}

[LANG] FR

Hello,

Please find attached the fr.json file for the French language.
fr.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.