/// <reference path="Dice.ts" />
class DiceCommon extends Dice {
    protected range : Array<number> = [-1, 0, 0, 0, 1, 1, 1];
    public minResult = -1;

    public static testAgainstRoll (player : TestingOptions, enemy : TestingOptions) : number {
        let playerDice = new DiceCommon(player.name);
        let playerResult = playerDice.roll(player.value);
        let enemyDice = new DiceCommon(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 DiceCommon(player.name);
        let playerResult = playerDice.roll(player.value);
        return playerResult.reduce(Dice.sum) - difficulty;
    }
}