Upgrading should increase all numeric stats by 1

This commit is contained in:
Peter Stockings
2026-01-25 17:25:10 +11:00
parent 1931482abd
commit 1d7be54fd9

View File

@@ -35,16 +35,11 @@ export class UpgradeManager {
item.name = `${baseName} +${item.upgradeLevel}`;
// Increase all numeric stats by +1
if (item.type === "Weapon") {
const weaponItem = item as WeaponItem;
if (weaponItem.stats.attack !== undefined) {
weaponItem.stats.attack += 1;
}
} else if (item.type === "BodyArmour" || item.type === "Helmet" ||
item.type === "Gloves" || item.type === "Boots") {
const armourItem = item as ArmourItem;
if (armourItem.stats.defense !== undefined) {
armourItem.stats.defense += 1;
const stats = (item as WeaponItem | ArmourItem).stats;
for (const key of Object.keys(stats)) {
const value = stats[key as keyof typeof stats];
if (typeof value === "number") {
(stats as Record<string, unknown>)[key] = value + 1;
}
}