1234567891011121314151617181920 |
- /// <reference path="Dice.ts" />
- class DiceDangerous extends Dice {
- protected range : Array<number> = [-2, -1, 0, 0, 0, 0, 1, 1, 1, 1];
- public minResult = -2;
- public static testAgainstRoll (player : TestingOptions, enemy : TestingOptions) : number {
- let playerDice = new DiceDangerous(player.name);
- let playerResult = playerDice.roll(player.value);
- let enemyDice = new DiceDangerous(enemy.name);
- let enemyResult = enemyDice.roll(enemy.value);
- return playerResult.reduce(Dice.sum) - enemyResult.reduce(Dice.sum);
- }
- public static testAgainstDifficulty (player : TestingOptions, difficulty : number) : number {
- let playerDice = new DiceDangerous(player.name);
- let playerResult = playerDice.roll(player.value);
- return playerResult.reduce(Dice.sum) - difficulty;
- }
- }
|