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,131 @@
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { applyAura, resolveDamageValue } from "./combatAuras";
|
||||
import { clearMobRuntimeRegistry, setMobPosition } from "./mobRuntimeRegistry";
|
||||
import { preloadAbilityCatalogsForClasses } from "./abilityCatalog";
|
||||
import { PLAYER_AURA_ENTITY_ID, useCombatStore } from "./combatStore";
|
||||
import { talentModifiersForRanks, applyTalentModifierValue } from "./talentModifiers";
|
||||
import {
|
||||
WOW335_DRUID_FERAL_INSTINCT_ENRAGE_AURA_TAG,
|
||||
WOW335_DRUID_FERAL_INSTINCT_TIGER_AURA_TAG,
|
||||
} from "./wow335DruidTalentRuntime";
|
||||
|
||||
const TARGET_ID = "feral-instinct-target";
|
||||
|
||||
function abilityId(name: string): string {
|
||||
const ability = useCombatStore.getState().abilities.find((candidate) => candidate.name === name);
|
||||
expect(ability, name).toBeDefined();
|
||||
return ability!.id;
|
||||
}
|
||||
|
||||
function setFeralRank(rank: number): void {
|
||||
useCombatStore.setState((state) => {
|
||||
const talentRanks = { ...state.talentRanks, "talent-799": rank };
|
||||
return { talentRanks, talentModifiers: talentModifiersForRanks(talentRanks, "druid") };
|
||||
});
|
||||
}
|
||||
|
||||
describe("WoW Druid Feral Instinct", () => {
|
||||
beforeEach(async () => {
|
||||
clearMobRuntimeRegistry();
|
||||
await preloadAbilityCatalogsForClasses(["druid"]);
|
||||
useCombatStore.getState().initializeCharacter({ classId: "druid", level: 80, xp: 0 });
|
||||
useCombatStore.getState().resetSettings();
|
||||
useCombatStore.getState().setPlayerPosition([0, 0, 0]);
|
||||
useCombatStore.getState().registerMob(TARGET_ID, { name: "Target", level: 1, maxHealth: 1_000_000 });
|
||||
setMobPosition(TARGET_ID, [4, 0, 0]);
|
||||
useCombatStore.getState().selectMob(TARGET_ID);
|
||||
useCombatStore.setState((state) => ({
|
||||
resource: state.maxResource,
|
||||
resourcePools: {
|
||||
...state.resourcePools,
|
||||
energy: 100,
|
||||
rage: 100,
|
||||
mana: state.maxResourcePools.mana,
|
||||
},
|
||||
maxResourcePools: { ...state.maxResourcePools, energy: 100, rage: 100 },
|
||||
auras: [...applyAura(state.auras, {
|
||||
definition: {
|
||||
id: "feral-instinct-test-hit",
|
||||
name: "Test Hit Chance",
|
||||
disposition: "buff",
|
||||
durationMs: null,
|
||||
modifiers: [
|
||||
{ kind: "stat", stat: "hit", operation: "flat", value: 100 },
|
||||
{ kind: "stat", stat: "physical-critical-strike", operation: "flat", value: 0 },
|
||||
],
|
||||
},
|
||||
sourceId: PLAYER_AURA_ENTITY_ID,
|
||||
targetId: PLAYER_AURA_ENTITY_ID,
|
||||
now: 0,
|
||||
}).auras],
|
||||
}));
|
||||
});
|
||||
|
||||
it("applies the rank bonus only to Swipe and Ravage, without unconditional damage or mitigation", () => {
|
||||
for (const [rank, percent] of [[1, 10], [2, 20], [3, 30]] as const) {
|
||||
const modifiers = talentModifiersForRanks({ "talent-799": rank }, "druid");
|
||||
expect(modifiers).toHaveLength(1);
|
||||
expect(modifiers[0]).toMatchObject({ kind: "damage-percent", amount: percent });
|
||||
for (const name of ["Swipe (Bear)", "Swipe (Cat)", "Ravage"]) {
|
||||
expect(applyTalentModifierValue(100, modifiers, "damage-percent", {
|
||||
abilityName: name,
|
||||
tags: ["damage"],
|
||||
})).toBeCloseTo(100 + percent);
|
||||
}
|
||||
expect(applyTalentModifierValue(100, modifiers, "damage-percent", {
|
||||
abilityName: "Claw",
|
||||
tags: ["damage"],
|
||||
})).toBe(100);
|
||||
expect(applyTalentModifierValue(100, modifiers, "damage-taken-percent", {
|
||||
tags: ["physical"],
|
||||
})).toBe(100);
|
||||
}
|
||||
});
|
||||
|
||||
it("activates Tiger's Fury damage and Enrage mitigation only for their sourced durations", () => {
|
||||
setFeralRank(3);
|
||||
expect(useCombatStore.getState().castAbility(abilityId("Tiger's Fury"), { targetActorId: null, now: 1_000 }).ok).toBe(true);
|
||||
expect(useCombatStore.getState().castAbility(abilityId("Enrage"), { targetActorId: null, now: 1_000 }).ok).toBe(true);
|
||||
|
||||
const auras = useCombatStore.getState().auras.filter((aura) => aura.targetId === PLAYER_AURA_ENTITY_ID);
|
||||
const tiger = auras.find((aura) => aura.definition.utilityTags?.includes(WOW335_DRUID_FERAL_INSTINCT_TIGER_AURA_TAG));
|
||||
const enrage = auras.find((aura) => aura.definition.utilityTags?.includes(WOW335_DRUID_FERAL_INSTINCT_ENRAGE_AURA_TAG));
|
||||
expect(tiger?.expiresAt).toBe(7_000);
|
||||
expect(enrage?.expiresAt).toBe(11_000);
|
||||
expect(resolveDamageValue(1_000, [tiger!], { direction: "dealt", school: "physical", attackKind: "melee" })).toBe(1_030);
|
||||
expect(resolveDamageValue(1_000, [enrage!], { direction: "taken", school: "physical", attackKind: "melee" })).toBe(970);
|
||||
|
||||
setFeralRank(0);
|
||||
expect(useCombatStore.getState().castAbility(abilityId("Tiger's Fury"), { targetActorId: null, now: 32_000 }).ok).toBe(true);
|
||||
expect(useCombatStore.getState().auras.some((aura) => (
|
||||
aura.targetId === PLAYER_AURA_ENTITY_ID
|
||||
&& aura.definition.utilityTags?.includes(WOW335_DRUID_FERAL_INSTINCT_TIGER_AURA_TAG)
|
||||
&& (aura.expiresAt === null || aura.expiresAt > 32_000)
|
||||
))).toBe(false);
|
||||
});
|
||||
|
||||
it("reduces Tiger's Fury and Enrage cooldowns by one second on landed Swipe damage", () => {
|
||||
setFeralRank(1);
|
||||
const tigerId = abilityId("Tiger's Fury");
|
||||
const enrageId = abilityId("Enrage");
|
||||
useCombatStore.setState((state) => ({ cooldowns: { ...state.cooldowns, [tigerId]: 20_000, [enrageId]: 20_000 } }));
|
||||
|
||||
expect(useCombatStore.getState().castAbility(abilityId("Swipe (Bear)"), {
|
||||
targetActorId: TARGET_ID,
|
||||
now: 1_000,
|
||||
}).ok).toBe(true);
|
||||
expect(useCombatStore.getState().combatEvents.some((event) => (
|
||||
event.kind === "damage" && event.targetActorId === TARGET_ID && event.effectiveAmount > 0
|
||||
))).toBe(true);
|
||||
expect(useCombatStore.getState().cooldowns[tigerId]).toBe(19_000);
|
||||
expect(useCombatStore.getState().cooldowns[enrageId]).toBe(19_000);
|
||||
|
||||
useCombatStore.setState((state) => ({ cooldowns: { ...state.cooldowns, [tigerId]: 30_000, [enrageId]: 30_000 } }));
|
||||
expect(useCombatStore.getState().castAbility(abilityId("Claw"), {
|
||||
targetActorId: TARGET_ID,
|
||||
now: 3_000,
|
||||
}).ok).toBe(true);
|
||||
expect(useCombatStore.getState().cooldowns[tigerId]).toBe(30_000);
|
||||
expect(useCombatStore.getState().cooldowns[enrageId]).toBe(30_000);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user