diff --git a/src/jsds.js b/src/jsds.js index 5d15749..58b3196 100644 --- a/src/jsds.js +++ b/src/jsds.js @@ -82,26 +82,40 @@ // Probe-Function: checks, whether a given "effort" is succesfull, according to the rules of DS // Not yet implemented: Tests for values larger than 20 var dice = function(probe) { - console.log(probe); - var diceval = Math.floor(Math.random() * (21 - 1)) + 1; - if ( diceval <= probe ) { - if (diceval == 1) { - alert ("Immersieg!"); - return probe; - } - else { - return diceval; - }; - } - else { - if (diceval === 20) { - alert ("Patzer!"); // We need alert here, because most "Patzer" - // affect gameplay (dropping equipement and so on) - }; + var diceval=new Array(); + var rolls=Math.floor(probe/20)+1; // Player may be allowed to roll the dice several times. + var tvalues=new Array(); + var result=0; + var tmpval; + for(var i=0; i