Files
healer-man/src/game/wowDruidNatureSwiftnessRuntime.test.ts
T
2026-09-28 22:46:45 -04:00

54 lines
2.5 KiB
TypeScript

import { beforeEach, describe, expect, it } from "vitest";
import { PLAYER_AGGRO_ID } from "./aggro";
import { useCombatStore } from "./combatStore";
import { clearPartyRuntimeRegistry, registerPartyRuntimePosition } from "./partyRuntimeRegistry";
import { usePartyStore } from "./partyStore";
describe("WoW Druid Nature's Swiftness", () => {
beforeEach(() => {
clearPartyRuntimeRegistry();
useCombatStore.getState().initializeCharacter({ classId: "druid", level: 80, xp: 0 });
useCombatStore.getState().setPlayerPosition([0, 0, 0]);
usePartyStore.getState().initializeParty("wow-druid-nature-swiftness-test", 80, useCombatStore.getState().health);
const member = usePartyStore.getState().members[0]!;
usePartyStore.setState((state) => ({
members: state.members.map((candidate) => candidate.id === member.id
? { ...candidate, health: 1 }
: candidate),
}));
registerPartyRuntimePosition(member.id, [5, 0, 0]);
usePartyStore.getState().selectMember(member.id);
useCombatStore.setState((state) => ({
resource: state.maxResource,
resourcePools: { ...state.resourcePools, mana: state.maxResourcePools.mana },
talentRanks: { ...state.talentRanks, "talent-831": 1 },
}));
});
it("makes the next eligible Druid Nature heal instant until it is successfully cast", () => {
const state = useCombatStore.getState();
const swift = state.abilities.find((ability) => ability.name === "Nature's Swiftness")!;
const heal = state.abilities.find((ability) => ability.name === "Healing Touch")!;
expect(swift).toBeDefined();
expect(heal).toBeDefined();
const activation = state.castAbility(swift.id, undefined, 1_000);
expect(activation.ok, JSON.stringify(activation)).toBe(true);
const aura = useCombatStore.getState().auras.find((candidate) => (
candidate.targetId === PLAYER_AGGRO_ID
&& candidate.definition.utilityTags?.includes("wow335-next-nature-instant")
));
expect(aura?.definition.durationMs).toBeNull();
const cast = useCombatStore.getState().castAbility(heal.id, [0, 0, 0], 1_001);
expect(cast.ok, JSON.stringify(cast)).toBe(true);
expect(useCombatStore.getState().activeCast).toBeNull();
expect(useCombatStore.getState().auras.some((candidate) => (
candidate.definition.utilityTags?.includes("wow335-next-nature-instant")
))).toBe(false);
expect(useCombatStore.getState().combatEvents.some((event) => (
event.kind === "healing" && event.abilityId === heal.id && event.sourceActorId === PLAYER_AGGRO_ID
))).toBe(true);
});
});