Skip to content

Commit

Permalink
Update solo-roleplaying-toolkit.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Tayruh committed Nov 1, 2022
1 parent 1d4e461 commit 48853fb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions solo-roleplaying-toolkit.html
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@
return list.sort(function(a, b) { return a - b; });
};

var clamp = function(value, min, max) {
console.log(Math.min(Math.max(value, min), max))
return Math.min(Math.max(value, min), max);
};

var isArray = function(val) {
return (val instanceof Array || Array.isArray(val));
};
Expand Down Expand Up @@ -3373,7 +3378,7 @@
var exceptional = false;
var event = false;

if (chaosDie <= Math.min(Math.max(chaos, 4), 6)) {
if (chaosDie <= clamp(chaos, 3, 6)) {
if (die1 === die2) {
exceptional = true;
event = true;
Expand Down Expand Up @@ -4193,7 +4198,7 @@
var exceptional = false;
var event = false;

if (chaosDie <= Math.min(Math.max(chaos, 4), 6)) {
if (chaosDie <= clamp(chaos, 3, 6)) {
if (die1 === die2) {
exceptional = true;
event = true;
Expand Down

0 comments on commit 48853fb

Please sign in to comment.