fix: enchanted items

This commit is contained in:
hypercross 2025-12-03 23:07:25 +08:00
parent 210e149df2
commit bb0a3b0b8e
1 changed files with 2 additions and 2 deletions

View File

@ -172,7 +172,7 @@ function roll(list, random){
*/
function genEnchanted(ids, enchant_pool, enchant_rolls, random, damage ){
const id = roll(ids, random);
const item = Item.of(id);
let item = Item.of(id);
if(damage) {
const dmg = Math.floor(item.maxDamage * (0.6 + 0.3 * random.nextFloat()));
@ -188,7 +188,7 @@ function genEnchanted(ids, enchant_pool, enchant_rolls, random, damage ){
}
for(const [enchant, level] of Object.entries(enchantments)){
item.enchant(enchant, level);
item = item.enchant(enchant, level);
}
return item;