Upgrading should increase all numeric stats by 1
This commit is contained in:
@@ -35,16 +35,11 @@ export class UpgradeManager {
|
|||||||
item.name = `${baseName} +${item.upgradeLevel}`;
|
item.name = `${baseName} +${item.upgradeLevel}`;
|
||||||
|
|
||||||
// Increase all numeric stats by +1
|
// Increase all numeric stats by +1
|
||||||
if (item.type === "Weapon") {
|
const stats = (item as WeaponItem | ArmourItem).stats;
|
||||||
const weaponItem = item as WeaponItem;
|
for (const key of Object.keys(stats)) {
|
||||||
if (weaponItem.stats.attack !== undefined) {
|
const value = stats[key as keyof typeof stats];
|
||||||
weaponItem.stats.attack += 1;
|
if (typeof value === "number") {
|
||||||
}
|
(stats as Record<string, unknown>)[key] = value + 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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user