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
-1
@@ -1,4 +1,5 @@
|
||||
import generatedLootCatalog from "./generated/lootCatalog.json";
|
||||
import { normalizeRomNativeGearStats, type RomNativeGearStats } from "./romNativeStatsTypes";
|
||||
|
||||
export type ItemQuality = "common" | "uncommon" | "rare" | "epic" | "legendary" | "heirloom";
|
||||
export type DamageSchool = "physical" | "holy" | "fire" | "nature" | "frost" | "shadow" | "arcane";
|
||||
@@ -47,6 +48,8 @@ export interface ItemStats {
|
||||
readonly shadowResistance: number;
|
||||
readonly meleeWeapon: WeaponStats | null;
|
||||
readonly rangedWeapon: WeaponStats | null;
|
||||
/** Optional, explicitly RoM-native gear values; never projected into WotLK fields. */
|
||||
readonly romNative?: RomNativeGearStats;
|
||||
}
|
||||
|
||||
export const ITEM_STAT_KEYS = [
|
||||
@@ -95,6 +98,7 @@ export interface ItemStatSource {
|
||||
readonly sourceItemLevel?: number;
|
||||
readonly sourceStats?: SourceItemStats;
|
||||
readonly sourceWeapon?: WeaponStats | null;
|
||||
readonly romNative?: RomNativeGearStats;
|
||||
}
|
||||
|
||||
const ZERO_NUMERIC_STATS = Object.fromEntries(
|
||||
@@ -247,10 +251,12 @@ export function itemStatsFor(source: ItemStatSource): ItemStats {
|
||||
ITEM_STAT_KEYS.map((key) => [key, scaledStat(sourceStats[key], ratio, key)]),
|
||||
) as unknown as Readonly<Record<NumericItemStatKey, number>>;
|
||||
const weapon = scaledWeapon(sourceWeapon, ratio);
|
||||
const romNative = normalizeRomNativeGearStats(source.romNative);
|
||||
return Object.freeze({
|
||||
...numeric,
|
||||
meleeWeapon: source.inventorySlot === "ranged" ? null : weapon,
|
||||
rangedWeapon: source.inventorySlot === "ranged" ? weapon : null,
|
||||
...(romNative ? { romNative } : {}),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -275,14 +281,17 @@ export function normalizeItemStats(value: unknown, fallback: ItemStatSource): It
|
||||
) return null;
|
||||
return scaledWeapon(candidateWeapon as WeaponStats, 1);
|
||||
};
|
||||
const romNative = normalizeRomNativeGearStats(candidate.romNative);
|
||||
const normalized: ItemStats = Object.freeze({
|
||||
...numeric,
|
||||
meleeWeapon: normalizeWeapon(candidate.meleeWeapon),
|
||||
rangedWeapon: normalizeWeapon(candidate.rangedWeapon),
|
||||
...(romNative ? { romNative } : {}),
|
||||
});
|
||||
const hasStats = ITEM_STAT_KEYS.some((key) => normalized[key] > 0)
|
||||
|| normalized.meleeWeapon
|
||||
|| normalized.rangedWeapon;
|
||||
|| normalized.rangedWeapon
|
||||
|| normalized.romNative;
|
||||
return hasStats ? normalized : itemStatsFor(fallback);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user