forked from phenom/healer-man
Update class mechanics, stat rulesets, and CoA reference catalogs
This commit is contained in:
1 parent
b16821e92e
commit
39458d5de6
221 files changed
+2584962
-568
No files matched your search
@@ -10,6 +10,7 @@ import {
|
||||
unequipInventorySlot,
|
||||
} from "./equipment";
|
||||
import { EMPTY_ITEM_STATS, type ItemStats } from "./itemStats";
|
||||
import { deriveRomNativeStats } from "./romNativeStats";
|
||||
|
||||
function stats(overrides: Partial<ItemStats>): ItemStats {
|
||||
return { ...EMPTY_ITEM_STATS, ...overrides };
|
||||
@@ -96,4 +97,33 @@ describe("equipment assignments", () => {
|
||||
expect(equipmentStats(assignments, [cloak, staff], "companion"))
|
||||
.toMatchObject({ strength: 8, stamina: 2, armor: 0 });
|
||||
});
|
||||
|
||||
it("bridges foreign direct stats per item while native payloads take precedence", () => {
|
||||
const sourceNative = item("native", "head", {
|
||||
stats: stats({ strength: 40, health: 99, mana: 99, romNative: { strength: 3, health: 5, mana: 5 } }),
|
||||
});
|
||||
const foreign = item("foreign", "back", {
|
||||
stats: stats({ strength: 2, health: 10, mana: 10, spirit: 700, attackPower: 500, armor: 100, spellPower: 600 }),
|
||||
});
|
||||
const inventory = [sourceNative, foreign];
|
||||
const assignments = { player: { head: sourceNative.instanceId, back: foreign.instanceId } };
|
||||
const equipped = equipmentStats(assignments, inventory, "player");
|
||||
expect(equipped).toMatchObject({ strength: 42, health: 109, mana: 109 });
|
||||
expect(equipped.romNative).toEqual({ strength: 5, health: 15, mana: 15 });
|
||||
|
||||
const withoutGear = deriveRomNativeStats({ classId: "rom-warrior", level: 1 });
|
||||
const withGear = deriveRomNativeStats({ classId: "rom-warrior", level: 1, gear: equipped.romNative });
|
||||
expect(withGear.attributes.strength - withoutGear.attributes.strength).toBe(5);
|
||||
expect(withGear.physicalAttack - withoutGear.physicalAttack).toBe(10);
|
||||
expect(withGear.health.max - withoutGear.health.max).toBeCloseTo(16);
|
||||
expect(withGear.attributes.wisdom).toBe(withoutGear.attributes.wisdom);
|
||||
const mageWithoutGear = deriveRomNativeStats({ classId: "rom-mage", level: 1 });
|
||||
const mageWithGear = deriveRomNativeStats({ classId: "rom-mage", level: 1, gear: equipped.romNative });
|
||||
expect(mageWithGear.mana.max - mageWithoutGear.mana.max).toBe(15);
|
||||
|
||||
const unequipped = equipmentStats({}, inventory, "player");
|
||||
expect(unequipped.romNative).toBeUndefined();
|
||||
expect(deriveRomNativeStats({ classId: "rom-warrior", level: 1, gear: unequipped.romNative }).health.max)
|
||||
.toBe(withoutGear.health.max);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user