fix: enchanted items
This commit is contained in:
@@ -172,7 +172,7 @@ function roll(list, random){
|
|||||||
*/
|
*/
|
||||||
function genEnchanted(ids, enchant_pool, enchant_rolls, random, damage ){
|
function genEnchanted(ids, enchant_pool, enchant_rolls, random, damage ){
|
||||||
const id = roll(ids, random);
|
const id = roll(ids, random);
|
||||||
const item = Item.of(id);
|
let item = Item.of(id);
|
||||||
|
|
||||||
if(damage) {
|
if(damage) {
|
||||||
const dmg = Math.floor(item.maxDamage * (0.6 + 0.3 * random.nextFloat()));
|
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)){
|
for(const [enchant, level] of Object.entries(enchantments)){
|
||||||
item.enchant(enchant, level);
|
item = item.enchant(enchant, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
|||||||
Reference in New Issue
Block a user