import { RollOptions } from "./roll-data";

export function isDiceSwapNecessary(
    critSuccesses: Array<number>,
    otherRolls: Array<number>,
    lastTestValue: number,
): boolean {
    if (critSuccesses.length == 0 || otherRolls.length == 0) {
        return false;
    }
    const amountOfOtherRolls = otherRolls.length;
    const lastDice = otherRolls[amountOfOtherRolls - 1];
    if (lastDice <= lastTestValue) {
        return false;
    }

    return lastDice + lastTestValue > 20;
}

export function isSlayingDiceRepetition(opts: RollOptions): boolean {
    return opts.useSlayingDice && opts.slayingDiceRepetition;
}