forked from phenom/healer-man
36 lines
1.8 KiB
TypeScript
36 lines
1.8 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { abilitiesForClass } from "./abilityCatalog";
|
|
import { channelAmountEffects, channelPulseCount } from "./combatChannelAmounts";
|
|
|
|
describe("channel amount expansion", () => {
|
|
it("spreads a normal channel's full amount across its pulses", () => {
|
|
const ability = abilitiesForClass("mage")[0];
|
|
const effects = channelAmountEffects({ ...ability, effects: [
|
|
{ kind: "damage", coefficient: 1, basePoints: 100 },
|
|
{ kind: "dot", coefficient: 1, ticks: 5, intervalMs: 1_000, tag: "channel" },
|
|
] }, 5);
|
|
expect(effects.map(({ multiplier }) => multiplier)).toEqual([0.2, 1]);
|
|
});
|
|
|
|
it("uses the authored periodic payload for Radiant Flame", () => {
|
|
const ability = abilitiesForClass("sun-cleric").find((candidate) => candidate.name === "Radiant Flame")!;
|
|
const amounts = channelAmountEffects(ability, 5);
|
|
expect(amounts).toHaveLength(1);
|
|
expect(amounts[0]).toMatchObject({ effect: { kind: "damage", basePoints: 1 }, multiplier: 1 });
|
|
const conditional = { ...ability, effects: ability.effects.map((effect) => effect.kind === "apply-aura"
|
|
? { ...effect, aura: { ...effect.aura, procs: effect.aura.procs?.map((proc) => ({ ...proc, chance: 0.5 })) } }
|
|
: effect) };
|
|
expect(channelAmountEffects(conditional, 5)).toEqual([]);
|
|
});
|
|
|
|
it("deals Chain of Light's source hit on every pulse", () => {
|
|
const ability = abilitiesForClass("rom-priest").find((candidate) => candidate.name === "Chain of Light")!;
|
|
expect(ability.castMode).toBe("channel");
|
|
expect(ability.castTimeMs).toBe(4_000);
|
|
expect(channelPulseCount(ability)).toBe(4);
|
|
expect(channelAmountEffects(ability, 4)).toEqual([
|
|
{ effect: ability.effects.find((effect) => effect.kind === "damage"), multiplier: 1 },
|
|
]);
|
|
});
|
|
});
|