69 lines
3.0 KiB
TypeScript
69 lines
3.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { applyAura, resolveDamageValue } from "./combatAuras";
|
|
import {
|
|
WOW335_WARRIOR_IMPROVED_DEFENSIVE_STANCE_ENRAGE_DURATION_MS,
|
|
wow335WarriorImprovedDefensiveStanceAdditiveIncomingDamage,
|
|
wow335WarriorImprovedDefensiveStanceEnrageAuraDefinition,
|
|
wow335WarriorImprovedDefensiveStanceProfile,
|
|
wow335WarriorImprovedDefensiveStanceShouldProc,
|
|
} from "./wow335WarriorImprovedDefensiveStanceRuntime";
|
|
|
|
describe("WoW 3.3.5 Warrior Improved Defensive Stance", () => {
|
|
it("reads rank-specific mitigation and avoidance-proc values from generated talent rows", () => {
|
|
expect(wow335WarriorImprovedDefensiveStanceProfile(1)).toMatchObject({
|
|
rank: 1,
|
|
damageTakenReductionPercent: 4,
|
|
procChancePercent: 50,
|
|
enragePhysicalDamagePercent: 6,
|
|
enrageDurationMs: WOW335_WARRIOR_IMPROVED_DEFENSIVE_STANCE_ENRAGE_DURATION_MS,
|
|
});
|
|
expect(wow335WarriorImprovedDefensiveStanceProfile(2)).toMatchObject({
|
|
rank: 2,
|
|
damageTakenReductionPercent: 8,
|
|
procChancePercent: 100,
|
|
enragePhysicalDamagePercent: 6,
|
|
enrageDurationMs: 12_000,
|
|
});
|
|
expect(wow335WarriorImprovedDefensiveStanceProfile(0)).toBeNull();
|
|
});
|
|
|
|
it("adds its percentage points to Defensive Stance's base reduction only while the stance is active", () => {
|
|
expect(wow335WarriorImprovedDefensiveStanceAdditiveIncomingDamage(1_000, 900, 1, true)).toBe(860);
|
|
expect(wow335WarriorImprovedDefensiveStanceAdditiveIncomingDamage(1_000, 900, 2, true)).toBe(820);
|
|
expect(wow335WarriorImprovedDefensiveStanceAdditiveIncomingDamage(1_000, 900, 2, false)).toBe(900);
|
|
});
|
|
|
|
it.each(["block", "parry", "dodge"] as const)("can proc from %s at the generated rank chance", (trigger) => {
|
|
expect(wow335WarriorImprovedDefensiveStanceShouldProc(1, trigger, 0.49)).toBe(true);
|
|
expect(wow335WarriorImprovedDefensiveStanceShouldProc(1, trigger, 0.5)).toBe(false);
|
|
expect(wow335WarriorImprovedDefensiveStanceShouldProc(2, trigger, 0.999)).toBe(true);
|
|
});
|
|
|
|
it("does not proc from ordinary hits or without the talent", () => {
|
|
expect(wow335WarriorImprovedDefensiveStanceShouldProc(2, "hit", 0)).toBe(false);
|
|
expect(wow335WarriorImprovedDefensiveStanceShouldProc(0, "block", 0)).toBe(false);
|
|
});
|
|
|
|
it("models the triggered Enrage as a 12-second physical-damage buff", () => {
|
|
const definition = wow335WarriorImprovedDefensiveStanceEnrageAuraDefinition();
|
|
const result = applyAura([], {
|
|
definition,
|
|
sourceId: "warrior",
|
|
targetId: "warrior",
|
|
now: 0,
|
|
});
|
|
expect(definition.dispelCategory).toBe("enrage");
|
|
expect(result.aura.expiresAt).toBe(WOW335_WARRIOR_IMPROVED_DEFENSIVE_STANCE_ENRAGE_DURATION_MS);
|
|
expect(resolveDamageValue(1_000, result.auras, {
|
|
direction: "dealt",
|
|
school: "physical",
|
|
attackKind: "melee",
|
|
})).toBe(1_060);
|
|
expect(resolveDamageValue(1_000, result.auras, {
|
|
direction: "dealt",
|
|
school: "fire",
|
|
attackKind: "spell",
|
|
})).toBe(1_000);
|
|
});
|
|
});
|