src/roller.js
function rollWod( roll ) {
  const data = roll instanceof WodRoll ? roll : convertToWodRoll( roll );
  const { dice, count, again, success, fail } = data;

  const rolls = [];

  let i = count;
  while ( i > 0 ) {
    const value = randomRoll( dice );
    rolls.push( value );
    // Check for "10 Again" flag
    // `repeatLimit` will prevent infinite loop, for cases like `d1!>1`
    const repeatLimit = 100;
    if ( value !== dice || !again || rolls.length > repeatLimit ) {
      i -= 1;
    }
  }

  const result = rolls.reduce(( suc, val ) => {
    if ( val >= success ) {
      return suc + 1;
    } else if ( val <= fail ) {
      return suc - 1;
    }
    return suc;
  }, 0 );

  return new Result( data.toString(), Math.max( result, 0 ), rolls );
}
function rollWod( roll ) {
  const data = roll instanceof WodRoll ? roll : convertToWodRoll( roll );
  const { dice, count, again, success, fail } = data;

  const rolls = [];

  let i = count;
  while ( i > 0 ) {
    const value = randomRoll( dice );
    rolls.push( value );
    // Check for "10 Again" flag
    // `repeatLimit` will prevent infinite loop, for cases like `d1!>1`
    const repeatLimit = 100;
    if ( value !== dice || !again || rolls.length > repeatLimit ) {
      i -= 1;
    }
  }

  const result = rolls.reduce(( suc, val ) => {
    if ( val >= success ) {
      return suc + 1;
    } else if ( val <= fail ) {
      return suc - 1;
    }
    return suc;
  }, 0 );

  return new Result( data.toString(), Math.max( result, 0 ), rolls );
}
function rollWod ( roll ) { const data = roll instanceof WodRoll ? roll : convertToWodRoll ( roll ) ; const { dice , count , again , success , fail } = data ; const rolls = [ ] ; let i = count ; while ( i > 0 ) { const value = randomRoll ( dice ) ; rolls . push ( value ) ; // Check for "10 Again" flag // `repeatLimit` will prevent infinite loop, for cases like `d1!>1` const repeatLimit = 100 ; if ( value !== dice || ! again || rolls . length > repeatLimit ) { i -= 1 ; } } const result = rolls . reduce ( ( suc , val ) => { if ( val >= success ) { return suc + 1 ; } else if ( val <= fail ) { return suc - 1 ; } return suc ; } , 0 ) ; return new Result ( data . toString ( ) , Math . max ( result , 0 ) , rolls ) ; }
Rolls the dice from `WodRoll` object.

@func
@since v2.0.0
@param {WodRoll} roll - `WodRoll` object or similar
@return {Result}
@see roll
@see rollClassic
@example
rollWod(new WodRoll(10, 4, true, 8)); //=> { notation: '4d10!>8', value: 2, rolls: [3,10,7,9,5] }
rollWod({ dice: 8, count: 3 }); //=> { notation: '3d8>6', value: 2, rolls: [ 7, 3, 9 ] }
Rolls the dice from WodRoll object .