1
0
Fork 0

Luck of the Sea

objects
Elias Fleckenstein 2020-12-23 15:18:20 +01:00
parent 8f62a3fe0c
commit a7ff5be28b
2 changed files with 10 additions and 6 deletions

View File

@ -375,8 +375,7 @@ end
power_range_table = {{12, 50}, {19, 50}, {26, 50}},
}]]--
-- unimplemented
--[[mcl_enchanting.enchantments.luck_of_the_sea = {
mcl_enchanting.enchantments.luck_of_the_sea = {
name = S("Luck of the Sea"),
max_level = 3,
primary = {fishing_rod = true},
@ -390,7 +389,7 @@ end
requires_tool = false,
treasure = false,
power_range_table = {{15, 61}, {24, 71}, {33, 81}},
}]]--
}
-- implemented in mcl_fishing
mcl_enchanting.enchantments.lure = {

View File

@ -52,10 +52,15 @@ local fish = function(itemstack, player)
local items
local itemcount = 1
local itemwear = 0
-- FIXME: Maybe use a better seeding
local pr = PseudoRandom(os.time() * math.random(1, 100))
local r = pr:next(1, 100)
if r <= 85 then
local fish_values = {85, 84.8, 84.7, 84.5}
local junk_values = {10, 8.1, 6.1, 4.2}
local luck_of_the_sea = math.min(mcl_enchanting.get_enchantment(itemstack, "luck_of_the_sea"), 3)
local index = luck_of_the_sea + 1
local fish_value = fish_values[index]
local junk_value = junk_values[index] + fish_value
if r <= fish_value then
-- Fish
items = mcl_loot.get_loot({
items = {
@ -65,7 +70,7 @@ local fish = function(itemstack, player)
{ itemstring = "mcl_fishing:pufferfish_raw", weight = 13 },
}
}, pr)
elseif r <= 95 then
elseif r <= junk_value then
-- Junk
items = mcl_loot.get_loot({
items = {