modules/dice/pool.js
/**
   * Upgrade the dice pool, converting any remaining ability dice into proficiency
   * dice or adding an ability die if none remain.
   * @param times the number of times to perform this operation, defaults to 1
   */
Upgrade the dice pool, converting any remaining ability dice into proficiency
dice or adding an ability die if none remain.
@param times the number of times to perform this operation, defaults to 1
Upgrade the dice pool converting any remaining ability dice into proficiency dice or adding an ability die if none remain . @param times the number of times to perform this operation defaults to 1
upgrade(times) {
    if (times === undefined) {
      times = 1;
    }
    let downgrade = false;
    if (times < 0) {
      downgrade = true;
      times = Math.abs(times);
    }
    for (let i = 0; i < times; i++) {
      if (downgrade) {
        if (this.proficiency > 0) {
          this.proficiency--;
          this.ability++;
        }
      } else {
        if (this.ability > 0) {
          this.ability--;
          this.proficiency++;
        } else {
          this.ability++;
        }
      }
    }
  }
upgrade ( times ) { if ( times === undefined ) { times = 1 ; } let downgrade = false ; if ( times < 0 ) { downgrade = true ; times = Math . abs ( times ) ; } for ( let i = 0 ; i < times ; i ++ ) { if ( downgrade ) { if ( this . proficiency > 0 ) { this . proficiency -- ; this . ability ++ ; } } else { if ( this . ability > 0 ) { this . ability -- ; this . proficiency ++ ; } else { this . ability ++ ; } } } }
Upgrade the dice pool, converting any remaining ability dice into proficiency
 dice or adding an ability die if none remain.
Upgrade the dice pool converting any remaining ability dice into proficiency dice or adding an ability die if none remain .