Skip to content

Commit

Permalink
Fix generating FVTT/R20 formulas with reroll and min
Browse files Browse the repository at this point in the history
This can happen with Reliable Talent and Luck features together

Fixes kakaroto#532
  • Loading branch information
kakaroto committed Oct 4, 2020
1 parent 6924b68 commit a0b8dcb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/fvtt_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2729,7 +2729,7 @@ class FVTTDisplayer {
class FVTTRoll extends Beyond20BaseRoll {
constructor(formula, data = {}) {
formula = formula.replace(/ro(=|<|<=|>|>=)([0-9]+)/g, "r$1$2");
formula = formula.replace(/(^|\s)+([^\s]+)min([0-9]+)/g, "$1{$2, $3}kh1");
formula = formula.replace(/(^|\s)+([^\s]+)min([0-9]+)([^\s]*)/g, "$1{$2$4, $3}kh1");
super(formula, data);
this._roll = new Roll(formula, data)
}
Expand Down
2 changes: 1 addition & 1 deletion dist/roll20.js
Original file line number Diff line number Diff line change
Expand Up @@ -2696,7 +2696,7 @@ function escapeRoll20Macro(text) {

function genRoll(dice, modifiers = {}) {
dice = dice.replace(/ro<=([0-9]+)/, "ro<$1");
dice = dice.replace(/(^|\s)+([^\s]+)min([0-9]+)/g, "$1{$2, 0d0 + $3}kh1");
dice = dice.replace(/(^|\s)+([^\s]+)min([0-9]+)([^\s]*)/g, "$1{$2$4, 0d0 + $3}kh1");
let roll = "[[" + dice;
for (let m in modifiers) {
let mod = modifiers[m];
Expand Down
2 changes: 1 addition & 1 deletion src/fvtt/page-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class FVTTDisplayer {
class FVTTRoll extends Beyond20BaseRoll {
constructor(formula, data = {}) {
formula = formula.replace(/ro(=|<|<=|>|>=)([0-9]+)/g, "r$1$2");
formula = formula.replace(/(^|\s)+([^\s]+)min([0-9]+)/g, "$1{$2, $3}kh1");
formula = formula.replace(/(^|\s)+([^\s]+)min([0-9]+)([^\s]*)/g, "$1{$2$4, $3}kh1");
super(formula, data);
this._roll = new Roll(formula, data)
}
Expand Down
2 changes: 1 addition & 1 deletion src/roll20/content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function escapeRoll20Macro(text) {

function genRoll(dice, modifiers = {}) {
dice = dice.replace(/ro<=([0-9]+)/, "ro<$1");
dice = dice.replace(/(^|\s)+([^\s]+)min([0-9]+)/g, "$1{$2, 0d0 + $3}kh1");
dice = dice.replace(/(^|\s)+([^\s]+)min([0-9]+)([^\s]*)/g, "$1{$2$4, 0d0 + $3}kh1");
let roll = "[[" + dice;
for (let m in modifiers) {
let mod = modifiers[m];
Expand Down

0 comments on commit a0b8dcb

Please sign in to comment.