Bound to fail: Add slaying dice options and tests, no impl.
This commit is contained in:
parent
8ca93fc9c9
commit
75301b2c56
2 changed files with 52 additions and 6 deletions
|
@ -71,11 +71,55 @@ describe("DS4 Rolls with one die and no modifications.", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("DS4 Rolls with one die and slaying dice, first throw.", () => {
|
||||||
|
it("Should do a crit success on `1`", () => {
|
||||||
|
const rollProvider = mockSingleThrow(1);
|
||||||
|
|
||||||
|
expect(rollCheckSingleDie(4, { useSlayingDice: true } as RollOptions, rollProvider)).toEqual(
|
||||||
|
new RollResult(4, RollResultStatus.CRITICAL_SUCCESS, [1]),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should do a crit fail on `20`", () => {
|
||||||
|
const rollProvider = mockSingleThrow(20);
|
||||||
|
|
||||||
|
expect(rollCheckSingleDie(4, { useSlayingDice: true } as RollOptions, rollProvider)).toEqual(
|
||||||
|
new RollResult(0, RollResultStatus.CRITICAL_FAILURE, [20]),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("DS4 Rolls with one die and slaying dice, followup throw.", () => {
|
||||||
|
it("Should do a crit success on `1`", () => {
|
||||||
|
const rollProvider = mockSingleThrow(1);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
rollCheckSingleDie(4, { useSlayingDice: true, slayingDiceRepetition: true } as RollOptions, rollProvider),
|
||||||
|
).toEqual(new RollResult(4, RollResultStatus.CRITICAL_SUCCESS, [1]));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should do a regular fail on `20`", () => {
|
||||||
|
const rollProvider = mockSingleThrow(20);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
rollCheckSingleDie(4, { useSlayingDice: true, slayingDiceRepetition: true } as RollOptions, rollProvider),
|
||||||
|
).toEqual(new RollResult(0, RollResultStatus.FAILURE, [20]));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should do a regular success on `20` with a test value of 20", () => {
|
||||||
|
const rollProvider = mockSingleThrow(20);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
rollCheckSingleDie(20, { useSlayingDice: true, slayingDiceRepetition: true } as RollOptions, rollProvider),
|
||||||
|
).toEqual(new RollResult(20, RollResultStatus.SUCCESS, [20]));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("DS4 Rolls with one die and crit roll modifications.", () => {
|
describe("DS4 Rolls with one die and crit roll modifications.", () => {
|
||||||
it("Should do a crit success on `1`.", () => {
|
it("Should do a crit success on `1`.", () => {
|
||||||
const rollProvider = mockSingleThrow(1);
|
const rollProvider = mockSingleThrow(1);
|
||||||
|
|
||||||
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 }, rollProvider)).toEqual(
|
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 } as RollOptions, rollProvider)).toEqual(
|
||||||
new RollResult(4, RollResultStatus.CRITICAL_SUCCESS, [1]),
|
new RollResult(4, RollResultStatus.CRITICAL_SUCCESS, [1]),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -83,7 +127,7 @@ describe("DS4 Rolls with one die and crit roll modifications.", () => {
|
||||||
it("Should do a crit success on `maxCritSucc`.", () => {
|
it("Should do a crit success on `maxCritSucc`.", () => {
|
||||||
const rollProvider = mockSingleThrow(2);
|
const rollProvider = mockSingleThrow(2);
|
||||||
|
|
||||||
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 }, rollProvider)).toEqual(
|
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 } as RollOptions, rollProvider)).toEqual(
|
||||||
new RollResult(4, RollResultStatus.CRITICAL_SUCCESS, [2]),
|
new RollResult(4, RollResultStatus.CRITICAL_SUCCESS, [2]),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -91,7 +135,7 @@ describe("DS4 Rolls with one die and crit roll modifications.", () => {
|
||||||
it("Should do a success on lower edge case `3`.", () => {
|
it("Should do a success on lower edge case `3`.", () => {
|
||||||
const rollProvider = mockSingleThrow(3);
|
const rollProvider = mockSingleThrow(3);
|
||||||
|
|
||||||
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 }, rollProvider)).toEqual(
|
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 } as RollOptions, rollProvider)).toEqual(
|
||||||
new RollResult(3, RollResultStatus.SUCCESS, [3]),
|
new RollResult(3, RollResultStatus.SUCCESS, [3]),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -99,7 +143,7 @@ describe("DS4 Rolls with one die and crit roll modifications.", () => {
|
||||||
it("Should do a success on upper edge case `18`.", () => {
|
it("Should do a success on upper edge case `18`.", () => {
|
||||||
const rollProvider = mockSingleThrow(18);
|
const rollProvider = mockSingleThrow(18);
|
||||||
|
|
||||||
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 }, rollProvider)).toEqual(
|
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 } as RollOptions, rollProvider)).toEqual(
|
||||||
new RollResult(0, RollResultStatus.FAILURE, [18]),
|
new RollResult(0, RollResultStatus.FAILURE, [18]),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -107,7 +151,7 @@ describe("DS4 Rolls with one die and crit roll modifications.", () => {
|
||||||
it("Should do a crit fail on `minCritFail`.", () => {
|
it("Should do a crit fail on `minCritFail`.", () => {
|
||||||
const rollProvider = mockSingleThrow(19);
|
const rollProvider = mockSingleThrow(19);
|
||||||
|
|
||||||
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 }, rollProvider)).toEqual(
|
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 } as RollOptions, rollProvider)).toEqual(
|
||||||
new RollResult(0, RollResultStatus.CRITICAL_FAILURE, [19]),
|
new RollResult(0, RollResultStatus.CRITICAL_FAILURE, [19]),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -115,7 +159,7 @@ describe("DS4 Rolls with one die and crit roll modifications.", () => {
|
||||||
it("Should do a crit fail on `20`", () => {
|
it("Should do a crit fail on `20`", () => {
|
||||||
const rollProvider = mockSingleThrow(20);
|
const rollProvider = mockSingleThrow(20);
|
||||||
|
|
||||||
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 }, rollProvider)).toEqual(
|
expect(rollCheckSingleDie(4, { maxCritSucc: 2, minCritFail: 19 } as RollOptions, rollProvider)).toEqual(
|
||||||
new RollResult(0, RollResultStatus.CRITICAL_FAILURE, [20]),
|
new RollResult(0, RollResultStatus.CRITICAL_FAILURE, [20]),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -85,6 +85,8 @@ export function rollCheckMultipleDice(
|
||||||
export class RollOptions {
|
export class RollOptions {
|
||||||
public maxCritSucc = 1;
|
public maxCritSucc = 1;
|
||||||
public minCritFail = 20;
|
public minCritFail = 20;
|
||||||
|
public useSlayingDice = false;
|
||||||
|
public slayingDiceRepetition = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RollResult {
|
export class RollResult {
|
||||||
|
|
Loading…
Reference in a new issue