Update Healer Man server
This commit is contained in:
1 parent
35dfdaed61
commit
4fb7a0b9c8
161 files changed
+24618
-529
No files matched your search
@@ -0,0 +1,121 @@
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { abilityById } from "./abilityCatalog";
|
||||
import { PLAYER_AGGRO_ID } from "./aggro";
|
||||
import { useCombatStore } from "./combatStore";
|
||||
import { clearMobRuntimeRegistry, setMobPosition } from "./mobRuntimeRegistry";
|
||||
import { advanceDungeonPartyCombat, resetPartyRuntimeClock } from "./partyRuntime";
|
||||
import { clearPartyRuntimeRegistry, registerPartyRuntimePosition } from "./partyRuntimeRegistry";
|
||||
import { createConfiguredPartyMember, usePartyStore } from "./partyStore";
|
||||
import { ROM_PRIEST_MAGE_ENLIGHTENMENT } from "./romPriestMageRuntime";
|
||||
|
||||
const ACTIVE_TAG = "rom-priest-mage-enlightenment-active";
|
||||
|
||||
function initializePriestMage(): void {
|
||||
useCombatStore.getState().initializeCharacter({
|
||||
classId: "rom-priest",
|
||||
secondaryClassId: "rom-mage",
|
||||
raceId: "rom-human",
|
||||
level: 45,
|
||||
role: "healer",
|
||||
});
|
||||
}
|
||||
|
||||
function aura(actorId: string, tag: string, now: number) {
|
||||
return useCombatStore.getState().auras.find((entry) => entry.targetId === actorId
|
||||
&& (entry.expiresAt === null || entry.expiresAt > now)
|
||||
&& entry.definition.utilityTags?.includes(tag));
|
||||
}
|
||||
|
||||
describe("RoM Priest/Mage Enlightenment integration", () => {
|
||||
beforeEach(() => {
|
||||
clearMobRuntimeRegistry();
|
||||
clearPartyRuntimeRegistry();
|
||||
resetPartyRuntimeClock();
|
||||
initializePriestMage();
|
||||
usePartyStore.getState().initializeParty(
|
||||
"priest-mage-enlightenment-test", 45, useCombatStore.getState().health, "healer", 2, "rom",
|
||||
);
|
||||
});
|
||||
|
||||
it("triggers only on completed Heal and respects the caster's 20-second cooldown", () => {
|
||||
const heal = abilityById("rom-priest-primary-2");
|
||||
const wrongSpell = abilityById("rom-priest-primary-4");
|
||||
const passive = abilityById("rom-priest-rom-mage-elite-40");
|
||||
if (!heal || !wrongSpell || !passive) throw new Error("Missing local Priest/Mage Enlightenment rows");
|
||||
expect([heal.dbcSpellId, wrongSpell.dbcSpellId, passive.dbcSpellId]).toEqual([490_261, 491_165, 492_933]);
|
||||
expect(passive.effects).toEqual([]);
|
||||
expect(aura(PLAYER_AGGRO_ID, ACTIVE_TAG, 1_000)).toBeUndefined();
|
||||
expect(aura(PLAYER_AGGRO_ID, ROM_PRIEST_MAGE_ENLIGHTENMENT.cooldownAuraTag, 1_000)).toBeUndefined();
|
||||
|
||||
useCombatStore.getState().damagePlayer(100);
|
||||
expect(useCombatStore.getState().castAbility(heal.id, undefined, 1_000)).toMatchObject({ ok: true });
|
||||
useCombatStore.getState().tick(0.1, 3_100);
|
||||
expect(aura(PLAYER_AGGRO_ID, ACTIVE_TAG, 3_100)?.expiresAt).toBe(11_100);
|
||||
expect(aura(PLAYER_AGGRO_ID, ROM_PRIEST_MAGE_ENLIGHTENMENT.cooldownAuraTag, 3_100)?.expiresAt)
|
||||
.toBe(23_100);
|
||||
|
||||
useCombatStore.getState().registerMob("enlightenment-wrong-spell-target", {
|
||||
name: "Enlightenment wrong-spell target", maxHealth: 100_000, xpReward: 0,
|
||||
});
|
||||
setMobPosition("enlightenment-wrong-spell-target", [3, 0, 0]);
|
||||
useCombatStore.getState().selectMob("enlightenment-wrong-spell-target");
|
||||
expect(useCombatStore.getState().castAbility(wrongSpell.id, undefined, 5_000)).toMatchObject({ ok: true });
|
||||
expect(aura(PLAYER_AGGRO_ID, ACTIVE_TAG, 5_000)?.expiresAt).toBe(11_100);
|
||||
|
||||
expect(useCombatStore.getState().castAbility(heal.id, undefined, 7_000)).toMatchObject({ ok: true });
|
||||
useCombatStore.getState().tick(0.1, 9_100);
|
||||
expect(aura(PLAYER_AGGRO_ID, ACTIVE_TAG, 9_100)?.expiresAt).toBe(11_100);
|
||||
expect(aura(PLAYER_AGGRO_ID, ROM_PRIEST_MAGE_ENLIGHTENMENT.cooldownAuraTag, 9_100)?.expiresAt)
|
||||
.toBe(23_100);
|
||||
|
||||
expect(useCombatStore.getState().castAbility(heal.id, undefined, 24_000)).toMatchObject({ ok: true });
|
||||
useCombatStore.getState().tick(0.1, 26_100);
|
||||
expect(aura(PLAYER_AGGRO_ID, ACTIVE_TAG, 26_100)?.expiresAt).toBe(34_100);
|
||||
});
|
||||
|
||||
it("triggers after a party Priest/Mage finishes Heal and keeps the aura on that caster", () => {
|
||||
const seed = "priest-mage-enlightenment-party";
|
||||
const healer = createConfiguredPartyMember({
|
||||
name: "Enlightenment Priest",
|
||||
classId: "rom-priest",
|
||||
secondaryClassId: "rom-mage",
|
||||
specialization: "Primary",
|
||||
role: "healer",
|
||||
}, 45, 0, seed);
|
||||
const heal = abilityById("rom-priest-primary-2");
|
||||
const passive = abilityById("rom-priest-rom-mage-elite-40");
|
||||
if (!heal || !passive) throw new Error("Missing local Priest/Mage Heal or Enlightenment rows");
|
||||
usePartyStore.getState().initializeParty(seed, 45, useCombatStore.getState().health, "healer", 2, "rom");
|
||||
usePartyStore.setState({ members: [{
|
||||
...healer,
|
||||
resource: 10_000,
|
||||
maxResource: 10_000,
|
||||
resourcePools: { ...healer.resourcePools, mana: 10_000 },
|
||||
activeCast: {
|
||||
abilityId: heal.id,
|
||||
school: "holy",
|
||||
mode: "cast",
|
||||
startedAt: 500,
|
||||
completesAt: 2_500,
|
||||
originalDurationMs: 2_000,
|
||||
pushbackHits: 0,
|
||||
origin: [0, 0, 0],
|
||||
targetId: healer.id,
|
||||
},
|
||||
activeCastTargetId: healer.id,
|
||||
status: "healing",
|
||||
}] });
|
||||
registerPartyRuntimePosition(healer.id, [0, 0, 0]);
|
||||
useCombatStore.getState().synchronizeActors();
|
||||
expect(passive.effects).toEqual([]);
|
||||
expect(aura(healer.id, ACTIVE_TAG, 1_000)).toBeUndefined();
|
||||
|
||||
advanceDungeonPartyCombat(2_500);
|
||||
|
||||
expect(useCombatStore.getState().combatEvents.some((event) => event.sourceActorId === healer.id
|
||||
&& event.abilityId === heal.id && event.kind === "healing")).toBe(true);
|
||||
expect(aura(healer.id, ACTIVE_TAG, 2_500)?.expiresAt).toBe(10_500);
|
||||
expect(aura(healer.id, ROM_PRIEST_MAGE_ENLIGHTENMENT.cooldownAuraTag, 2_500)?.expiresAt).toBe(22_500);
|
||||
expect(aura(PLAYER_AGGRO_ID, ACTIVE_TAG, 2_500)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user