mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
[Feature] Damage-Reroll (#753)
* Added rerolls for damage dice in chat * Fixed multiple dice * Added reroll icon * Fixed new style of dialog
This commit is contained in:
parent
2aaab73699
commit
300719c116
28 changed files with 1094 additions and 167 deletions
|
|
@ -172,25 +172,25 @@ Roll.replaceFormulaData = function (formula, data = {}, { missing, warn = false
|
|||
return nativeReplaceFormulaData(formula, data, { missing, warn });
|
||||
};
|
||||
|
||||
foundry.dice.terms.Die.MODIFIERS.sc = "selfCorrecting";
|
||||
foundry.dice.terms.Die.MODIFIERS.sc = 'selfCorrecting';
|
||||
|
||||
/**
|
||||
* Return the configured value as result if 1 is rolled
|
||||
* Example: 6d6sc6 Roll 6d6, each result of 1 will be changed into 6
|
||||
* @param {string} modifier The matched modifier query
|
||||
*/
|
||||
foundry.dice.terms.Die.prototype.selfCorrecting = function(modifier) {
|
||||
foundry.dice.terms.Die.prototype.selfCorrecting = function (modifier) {
|
||||
const rgx = /(?:sc)([0-9]+)/i;
|
||||
const match = modifier.match(rgx);
|
||||
if ( !match ) return false;
|
||||
if (!match) return false;
|
||||
let [target] = match.slice(1);
|
||||
target = parseInt(target);
|
||||
for ( const r of this.results ) {
|
||||
if ( r.result === 1 ) {
|
||||
for (const r of this.results) {
|
||||
if (r.result === 1) {
|
||||
r.result = target;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const getDamageKey = damage => {
|
||||
return ['none', 'minor', 'major', 'severe'][damage];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue