forked from phenom/healer-man
Release Healer Man 0.1.17
This commit is contained in:
1 parent
b57d2b2839
commit
fc8a7a722a
13 files changed
+235
-41
No files matched your search
@@ -13,6 +13,7 @@ import {
|
||||
MINIMUM_CORPSE_VISIBLE_MS,
|
||||
MOB_WOUND_ANIMATION_COOLDOWN_MS,
|
||||
PLAYER_AURA_ENTITY_ID,
|
||||
resolvedAbilityCosts,
|
||||
selectedMob,
|
||||
useCombatStore,
|
||||
} from "./combatStore";
|
||||
@@ -97,6 +98,32 @@ describe("combat store", () => {
|
||||
expect(useCombatStore.getState().mobs.ravager.engaged).toBe(true);
|
||||
});
|
||||
|
||||
it("uses the displayed primary mana and resolved percentage cost for affordability", () => {
|
||||
useCombatStore.getState().initializeCharacter({ classId: "mage", level: 1 });
|
||||
const initial = useCombatStore.getState();
|
||||
const frostbolt = initial.abilities.find((ability) => ability.id === "mage-frostbolt");
|
||||
expect(frostbolt).toBeDefined();
|
||||
const [cost] = resolvedAbilityCosts(frostbolt!, initial.talentModifiers, initial);
|
||||
expect(cost).toEqual({ resource: "mana", amount: Math.round(initial.maxResource * 0.14) });
|
||||
registerTarget("mana-target", [10, 0, 0]);
|
||||
|
||||
useCombatStore.setState({
|
||||
resource: cost.amount,
|
||||
resourcePools: { ...initial.resourcePools, mana: 0 },
|
||||
});
|
||||
expect(useCombatStore.getState().castAbility(frostbolt!.id, [0, 0, 0], 1_000)).toMatchObject({ ok: true });
|
||||
useCombatStore.getState().cancelCast();
|
||||
|
||||
useCombatStore.setState({
|
||||
resource: cost.amount - 1,
|
||||
resourcePools: { ...initial.resourcePools, mana: initial.maxResource },
|
||||
});
|
||||
expect(useCombatStore.getState().castAbility(frostbolt!.id, [0, 0, 0], 3_000)).toMatchObject({
|
||||
ok: false,
|
||||
reason: "not-enough-resource",
|
||||
});
|
||||
});
|
||||
|
||||
it("emits exactly one cast and release event and cancels presentation with the cast", () => {
|
||||
useCombatStore.getState().initializeCharacter({ classId: "mage", level: 1 });
|
||||
registerTarget("presentation-target", [10, 0, 0]);
|
||||
|
||||
Reference in new issue
Block a user