import { describe, expect, it } from "vitest"; import { ROM_COA_WARRIOR_ROGUE_EXHAUSTION_ENERGY_RETURN, ROM_COA_WARRIOR_ROGUE_EXHAUSTION_ID, ROM_COA_WARRIOR_ROGUE_EXHAUSTION_PROC_CHANCE, ROM_COA_WARRIOR_ROGUE_EXHAUSTION_RAGE_RETURN, ROM_COA_WARRIOR_ROGUE_PROBING_ATTACK_ID, romCoaWarriorRogueExhaustionProc, romCoaWarriorRogueProbingAttackDpsCoefficient, type RomCoaWarriorRogueExhaustionProcInput, } from "./romWarriorRogueExhaustion"; const validInput: RomCoaWarriorRogueExhaustionProcInput = { classId: "rom-warrior", secondaryClassId: "rom-rogue", learnedPassiveSpellIds: [ROM_COA_WARRIOR_ROGUE_EXHAUSTION_ID], triggerSpellId: ROM_COA_WARRIOR_ROGUE_PROBING_ATTACK_ID, attackLanded: true, roll: 0.29, }; describe("current CoA Warrior/Rogue Exhaustion proc", () => { it("uses the empowered Probing Attack coefficient for the caster's Bleed or an equipped 2-H Hammer", () => { expect(romCoaWarriorRogueProbingAttackDpsCoefficient({ hasCasterOwnedBleed: false, equippedTwoHandHammer: false, })).toBe(6.643); expect(romCoaWarriorRogueProbingAttackDpsCoefficient({ hasCasterOwnedBleed: true, equippedTwoHandHammer: false, })).toBe(11.169); expect(romCoaWarriorRogueProbingAttackDpsCoefficient({ hasCasterOwnedBleed: false, equippedTwoHandHammer: true, })).toBe(11.169); }); it("returns the sourced resources on a qualifying landed hit below the 30% threshold", () => { expect(romCoaWarriorRogueExhaustionProc(validInput)).toEqual({ procced: true, energy: ROM_COA_WARRIOR_ROGUE_EXHAUSTION_ENERGY_RETURN, rage: ROM_COA_WARRIOR_ROGUE_EXHAUSTION_RAGE_RETURN, }); }); it("uses a deterministic 30% threshold with an exclusive upper boundary", () => { expect(ROM_COA_WARRIOR_ROGUE_EXHAUSTION_PROC_CHANCE).toBe(0.3); expect(romCoaWarriorRogueExhaustionProc({ ...validInput, roll: 0 })).toMatchObject({ procced: true }); expect(romCoaWarriorRogueExhaustionProc({ ...validInput, roll: 0.299999 })).toMatchObject({ procced: true }); expect(romCoaWarriorRogueExhaustionProc({ ...validInput, roll: 0.3 })).toMatchObject({ procced: false }); }); it.each([ ["passive not learned", { learnedPassiveSpellIds: [] }], ["non-CoA Probing Attack ID", { triggerSpellId: 491133 }], ["missed attack", { attackLanded: false }], ["wrong primary class", { classId: "rom-rogue" }], ["wrong secondary class", { secondaryClassId: "rom-knight" }], ["roll below range", { roll: -0.01 }], ["roll at or above one", { roll: 1 }], ["non-finite roll", { roll: Number.NaN }], ] as const)("does not proc when %s", (_case, overrides) => { expect(romCoaWarriorRogueExhaustionProc({ ...validInput, ...overrides })).toEqual({ procced: false, energy: 0, rage: 0, }); }); });