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}`;
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user