1
0
Fork 0

Revert weird changes

This commit is contained in:
NO411 2022-03-18 23:07:25 +01:00
parent 976cfba53a
commit 5bdf83cbfc
1 changed files with 5 additions and 12 deletions

View File

@ -327,8 +327,7 @@ function mcl_enchanting.get_random_enchantment(itemstack, treasure, weighted, ex
end end
end end
return #possible > 0 and possible[ return #possible > 0 and possible[mcl_enchanting.random(pr, 1, #possible)]
(pr, 1, #possible)]
end end
function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr) function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr)
@ -341,14 +340,10 @@ function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_leve
itemstack = ItemStack(itemstack) itemstack = ItemStack(itemstack)
local enchantability = minetest.get_item_group(itemname, "enchantability") local enchantability = minetest.get_item_group(itemname, "enchantability")
enchantability = 1 + enchantability = 1 + mcl_enchanting.random(pr, 0, math.floor(enchantability / 4)) + mcl_enchanting.random(pr, 0, math.floor(enchantability / 4))
(pr, 0, math.floor(enchantability / 4)) +
(pr, 0, math.floor(enchantability / 4))
enchantment_level = enchantment_level + enchantability enchantment_level = enchantment_level + enchantability
enchantment_level = enchantment_level + enchantment_level * ( enchantment_level = enchantment_level + enchantment_level * (mcl_enchanting.random(pr) + mcl_enchanting.random(pr) - 1) * 0.15
(pr) +
(pr) - 1) * 0.15
enchantment_level = math.max(math.floor(enchantment_level + 0.5), 1) enchantment_level = math.max(math.floor(enchantment_level + 0.5), 1)
local enchantments = {} local enchantments = {}
@ -395,8 +390,7 @@ function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_leve
mcl_enchanting.enchant(itemstack, selected_enchantment, enchantment_power) mcl_enchanting.enchant(itemstack, selected_enchantment, enchantment_power)
end end
until not no_reduced_bonus_chance and until not no_reduced_bonus_chance and mcl_enchanting.random(pr) >= (enchantment_level + 1) / 50
(pr) >= (enchantment_level + 1) / 50
return enchantments, description return enchantments, description
end end
@ -424,8 +418,7 @@ function mcl_enchanting.enchant_uniform_randomly(stack, exclude, pr)
local enchantment = mcl_enchanting.get_random_enchantment(stack, true, false, exclude, pr) local enchantment = mcl_enchanting.get_random_enchantment(stack, true, false, exclude, pr)
if enchantment then if enchantment then
mcl_enchanting.enchant(stack, enchantment, mcl_enchanting.enchant(stack, enchantment, mcl_enchanting.random(pr, 1, mcl_enchanting.enchantments[enchantment].max_level))
(pr, 1, mcl_enchanting.enchantments[enchantment].max_level))
end end
return stack return stack