0
0
Fork 0
This commit is contained in:
Lizzy Fleckenstein 2020-12-23 17:41:42 +01:00
parent a7ff5be28b
commit da7240d6c1
28 changed files with 188 additions and 87 deletions

View File

@ -643,11 +643,13 @@ end
-- drop items
local item_drop = function(self, cooked)
local item_drop = function(self, cooked, looting_level)
-- no drops if disabled by setting
if not mobs_drop_items then return end
looting_level = looting_level or 0
-- no drops for child mobs (except monster)
if (self.child and self.type ~= "monster") then
return
@ -659,11 +661,33 @@ local item_drop = function(self, cooked)
self.drops = self.drops or {} -- nil check
for n = 1, #self.drops do
if random(1, self.drops[n].chance) == 1 then
num = random(self.drops[n].min or 1, self.drops[n].max or 1)
item = self.drops[n].name
local dropdef = self.drops[n]
local chance = 1 / dropdef.chance
local looting_type = dropdef.looting
if looting_level > 0 then
local chance_function = dropdef.looting_chance_function
if chance_function then
chance = chance_function(looting_level)
elseif looting_type == "rare" then
chance = chance + (dropdef.looting_factor or 0.01) * looting_level
end
end
local num = 0
local do_common_looting = (looting_level > 0 and looting_type == "common")
if random() < chance then
num = random(dropdef.min or 1, dropdef.max or 1)
elseif not dropdef.looting_ignore_chance then
do_common_looting = false
end
if do_common_looting then
num = num + math.floor(math.random(0, looting_level) + 0.5)
end
if num > 0 then
item = dropdef.name
-- cook items when true
if cooked then

View File

@ -41,7 +41,8 @@ mobs:register_mob("mobs_mc:blaze", {
{name = mobs_mc.items.blaze_rod,
chance = 1,
min = 0,
max = 1,},
max = 1,
looting = "common",},
},
animation = {
stand_speed = 25,

View File

@ -32,11 +32,13 @@ mobs:register_mob("mobs_mc:chicken", {
{name = mobs_mc.items.chicken_raw,
chance = 1,
min = 1,
max = 1,},
max = 1,
looting = "common",},
{name = mobs_mc.items.feather,
chance = 1,
min = 0,
max = 2,},
max = 2,
looting = "common",},
},
fall_damage = 0,
fall_speed = -2.25,

View File

@ -23,11 +23,13 @@ local cow_def = {
{name = mobs_mc.items.beef_raw,
chance = 1,
min = 1,
max = 3,},
max = 3,
looting = "common",},
{name = mobs_mc.items.leather,
chance = 1,
min = 0,
max = 2,},
max = 2,
looting = "common",},
},
runaway = true,
sounds = {

View File

@ -78,7 +78,7 @@ mobs:register_mob("mobs_mc:creeper", {
end,
on_die = function(self, pos)
-- Drop a random music disc
-- TODO: Only do this if killed by skeleton
-- TODO: Only do this if killed by skeleton or stray
if math.random(1, 200) == 1 then
local r = math.random(1, #mobs_mc.items.music_discs)
minetest.add_item({x=pos.x, y=pos.y+1, z=pos.z}, mobs_mc.items.music_discs[r])
@ -89,7 +89,8 @@ mobs:register_mob("mobs_mc:creeper", {
{name = mobs_mc.items.gunpowder,
chance = 1,
min = 0,
max = 2,},
max = 2,
looting = "common",},
-- Head
-- TODO: Only drop if killed by charged creeper

View File

@ -220,7 +220,8 @@ mobs:register_mob("mobs_mc:enderman", {
{name = mobs_mc.items.ender_pearl,
chance = 1,
min = 0,
max = 1,},
max = 1,
looting = "common"},
},
animation = select_enderman_animation("normal"),
_taken_node = "",

View File

@ -38,8 +38,8 @@ mobs:register_mob("mobs_mc:ghast", {
walk_velocity = 1.6,
run_velocity = 3.2,
drops = {
{name = mobs_mc.items.gunpowder, chance = 1, min = 0, max = 2,},
{name = mobs_mc.items.ghast_tear, chance = 3,min = 0,max = 1,},
{name = mobs_mc.items.gunpowder, chance = 1, min = 0, max = 2, looting = "common"},
{name = mobs_mc.items.ghast_tear, chance = 10/6, min = 0, max = 1, looting = "common", looting_ignore_chance = true},
},
animation = {
stand_speed = 50, walk_speed = 50, run_speed = 50,

View File

@ -46,7 +46,8 @@ mobs:register_mob("mobs_mc:guardian", {
{name = mobs_mc.items.prismarine_shard,
chance = 1,
min = 0,
max = 32,},
max = 32,
looting = "common",},
-- TODO: Reduce of drops when ocean monument is ready.
-- The following drops are approximations
@ -54,29 +55,39 @@ mobs:register_mob("mobs_mc:guardian", {
{name = mobs_mc.items.fish_raw,
chance = 4,
min = 1,
max = 1,},
max = 1,
looting = "common",},
{name = mobs_mc.items.prismarine_crystals,
chance = 4,
min = 1,
max = 2,},
max = 2,
looting = "common",},
-- Rare drop: fish
{name = mobs_mc.items.fish_raw,
chance = 160, -- 2.5% / 4
min = 1,
max = 1,},
max = 1,
looting = "rare",
looting_factor = 0.0025,},
{name = mobs_mc.items.salmon_raw,
chance = 160,
min = 1,
max = 1,},
max = 1,
looting = "rare",
looting_factor = 0.0025,},
{name = mobs_mc.items.clownfish_raw,
chance = 160,
min = 1,
max = 1,},
max = 1,
looting = "rare",
looting_factor = 0.0025,},
{name = mobs_mc.items.pufferfish_raw,
chance = 160,
min = 1,
max = 1,},
max = 1,
looting = "rare",
looting_factor = 0.0025,},
},
fly = true,
makes_footstep_sound = false,

View File

@ -51,7 +51,8 @@ mobs:register_mob("mobs_mc:guardian_elder", {
{name = mobs_mc.items.prismarine_shard,
chance = 1,
min = 1,
max = 64,},
max = 64,
looting = "common",},
-- TODO: Only drop if killed by player
{name = mobs_mc.items.wet_sponge,
@ -64,29 +65,39 @@ mobs:register_mob("mobs_mc:guardian_elder", {
{name = mobs_mc.items.fish_raw,
chance = 4,
min = 1,
max = 1,},
max = 1,
looting = "common",},
{name = mobs_mc.items.prismarine_crystals,
chance = 1,
min = 1,
max = 10,},
max = 10,
looting = "common",},
-- Rare drop: fish
{name = mobs_mc.items.fish_raw,
chance = 160, -- 2.5% / 4
min = 1,
max = 1,},
max = 1,
looting = "rare",
looting_factor = 0.01 / 4,},
{name = mobs_mc.items.salmon_raw,
chance = 160,
min = 1,
max = 1,},
max = 1,
looting = "rare",
looting_factor = 0.01 / 4,},
{name = mobs_mc.items.clownfish_raw,
chance = 160,
min = 1,
max = 1,},
max = 1,
looting = "rare",
looting_factor = 0.01 / 4,},
{name = mobs_mc.items.pufferfish_raw,
chance = 160,
min = 1,
max = 1,},
max = 1,
looting = "rare",
looting_factor = 0.01 / 4,},
},
fly = true,
makes_footstep_sound = false,

View File

@ -127,7 +127,8 @@ local horse = {
{name = mobs_mc.items.leather,
chance = 1,
min = 0,
max = 2,},
max = 2,
looting = "common",},
},
do_custom = function(self, dtime)

View File

@ -54,7 +54,8 @@ mobs:register_mob("mobs_mc:llama", {
{name = mobs_mc.items.leather,
chance = 1,
min = 0,
max = 2,},
max = 2,
looting = "common",},
},
fear_height = 4,
sounds = {

View File

@ -37,7 +37,8 @@ mobs:register_mob("mobs_mc:parrot", {
{name = mobs_mc.items.feather,
chance = 1,
min = 1,
max = 2,},
max = 2,
looting = "common",},
},
animation = {
stand_speed = 50,

View File

@ -27,7 +27,8 @@ mobs:register_mob("mobs_mc:pig", {
{name = mobs_mc.items.porkchop_raw,
chance = 1,
min = 1,
max = 3,},
max = 3,
looting = "common",},
},
fear_height = 4,
sounds = {

View File

@ -36,12 +36,14 @@ mobs:register_mob("mobs_mc:polar_bear", {
{name = mobs_mc.items.fish_raw,
chance = 2,
min = 0,
max = 2,},
max = 2,
looting = "common",},
-- 1/4 to drop raw salmon
{name = mobs_mc.items.salmon_raw,
chance = 4,
min = 0,
max = 2,},
max = 2,
looting = "common",},
},
floats = 1,

View File

@ -41,11 +41,9 @@ local rabbit = {
runaway = true,
jump = true,
drops = {
{name = mobs_mc.items.rabbit_raw, chance = 1, min = 0, max = 1},
{name = mobs_mc.items.rabbit_hide, chance = 1, min = 0, max = 1},
{name = mobs_mc.items.rabbit_foot, chance = 10, min = 0, max = 1},
-- TODO: Drop rabbit's foot when it's useful
--{name = mobs_mc.items.rabbit_foot, chance = 10, min = 1, max = 1},
{name = mobs_mc.items.rabbit_raw, chance = 1, min = 0, max = 1, looting = "common",},
{name = mobs_mc.items.rabbit_hide, chance = 1, min = 0, max = 1, looting = "common",},
{name = mobs_mc.items.rabbit_foot, chance = 10, min = 0, max = 1, looting = "rare", looting_factor = 0.03,},
},
fear_height = 4,
animation = {

View File

@ -63,11 +63,13 @@ mobs:register_mob("mobs_mc:sheep", {
{name = mobs_mc.items.mutton_raw,
chance = 1,
min = 1,
max = 2,},
max = 2,
looting = "common",},
{name = colors["unicolor_white"][1],
chance = 1,
min = 1,
max = 1,},
max = 1,
looting = "common",},
},
fear_height = 4,
sounds = {

View File

@ -35,9 +35,11 @@ mobs:register_mob("mobs_mc:shulker", {
jump = false,
drops = {
{name = mobs_mc.items.shulker_shell,
chance = 1,
min = 0,
max = 1,},
chance = 2,
min = 1,
max = 1,
looting = "rare",
looting_factor = 0.0625},
},
animation = {
stand_speed = 25, walk_speed = 25, run_speed = 50, punch_speed = 25,

View File

@ -46,15 +46,18 @@ local skeleton = {
{name = mobs_mc.items.arrow,
chance = 1,
min = 0,
max = 2,},
max = 2,
looting = "common",},
{name = mobs_mc.items.bow,
chance = 11,
chance = 100 / 8.5,
min = 1,
max = 1,},
max = 1,
looting = "rare",},
{name = mobs_mc.items.bone,
chance = 1,
min = 0,
max = 2,},
max = 2,
looting = "common",},
-- Head
-- TODO: Only drop if killed by charged creeper
@ -116,12 +119,21 @@ stray.textures = {
-- TODO: different sound (w/ echo)
-- TODO: stray's arrow inflicts slowness status
table.insert(stray.drops, {
-- Chance to drop additional arrow.
-- TODO: Should be tipped arrow of slowness
name = mobs_mc.items.arrow,
name = "mcl_potions:slowness_arrow",
chance = 2,
min = 1,
max = 1,
looting = "rare",
looting_chance_function = function(lvl)
local chance = 0.5
for i = 1, lvl do
if chance > 1 then
return 1
end
chance = chance + (1 - chance) / 2
end
return chance
end,
})
mobs:register_mob("mobs_mc:stray", stray)

View File

@ -45,17 +45,20 @@ mobs:register_mob("mobs_mc:witherskeleton", {
{name = mobs_mc.items.coal,
chance = 1,
min = 0,
max = 1,},
max = 1,
looting = "common",},
{name = mobs_mc.items.bone,
chance = 1,
min = 0,
max = 2,},
max = 2,
looting = "common",},
-- Head
{name = mobs_mc.items.head_wither_skeleton,
chance = 40, -- 2.5% chance
min = 1,
max = 1,},
max = 1,
looting = "rare",},
},
animation = {
stand_start = 0,

View File

@ -49,8 +49,10 @@ local spider = {
view_range = 16,
floats = 1,
drops = {
{name = mobs_mc.items.string, chance = 1, min = 0, max = 2,},
{name = mobs_mc.items.spider_eye, chance = 3, min = 1, max = 1,},
{name = mobs_mc.items.string, chance = 1, min = 0, max = 2, looting = "common"},
{name = mobs_mc.items.spider_eye, chance = 3, min = 1, max = 1, looting = "common", looting_chance_function = function(lvl)
return 1 - 2 / (lvl + 3)
end},
},
specific_attack = { "player", "mobs_mc:iron_golem" },
fear_height = 4,

View File

@ -42,7 +42,8 @@ mobs:register_mob("mobs_mc:squid", {
{name = mobs_mc.items.black_dye,
chance = 1,
min = 1,
max = 3,},
max = 3,
looting = "common",},
},
visual_size = {x=3, y=3},
makes_footstep_sound = false,

View File

@ -55,7 +55,8 @@ mobs:register_mob("mobs_mc:evoker", {
{name = mobs_mc.items.emerald,
chance = 1,
min = 0,
max = 1,},
max = 1,
looting = "common",},
{name = mobs_mc.items.totem,
chance = 1,
min = 1,

View File

@ -41,11 +41,13 @@ mobs:register_mob("mobs_mc:vindicator", {
{name = mobs_mc.items.emerald,
chance = 1,
min = 0,
max = 1,},
max = 1,
looting = "common",},
{name = mobs_mc.items.iron_axe,
chance = 11,
chance = 100 / 8.5,
min = 1,
max = 1,},
max = 1,
looting = "rare",},
},
-- TODO: sounds
animation = {

View File

@ -44,19 +44,26 @@ mobs:register_mob("mobs_mc:villager_zombie", {
{name = mobs_mc.items.rotten_flesh,
chance = 1,
min = 0,
max = 2,},
max = 2,
looting = "common",},
{name = mobs_mc.items.iron_ingot,
chance = 120, -- 2.5% / 3
min = 1,
max = 1,},
max = 1,
looting = "rare",
looting_factor = 0.01 / 3,},
{name = mobs_mc.items.carrot,
chance = 120, -- 2.5% / 3
min = 1,
max = 1,},
max = 1,
looting = "rare",
looting_factor = 0.01 / 3,},
{name = mobs_mc.items.potato,
chance = 120, -- 2.5% / 3
min = 1,
max = 1,},
max = 1,
looting = "rare",
looting_factor = 0.01 / 3,},
},
sounds = {
random = "mobs_mc_zombie_growl",

View File

@ -41,13 +41,13 @@ mobs:register_mob("mobs_mc:witch", {
dogshoot_count_max =1.8,
max_drops = 3,
drops = {
{name = mobs_mc.items.glass_bottle, chance = 8, min = 0, max = 2,},
{name = mobs_mc.items.glowstone_dust, chance = 8, min = 0, max = 2,},
{name = mobs_mc.items.gunpowder, chance = 8, min = 0, max = 2,},
{name = mobs_mc.items.redstone, chance = 8, min = 0, max = 2,},
{name = mobs_mc.items.spider_eye, chance = 8, min = 0, max = 2,},
{name = mobs_mc.items.sugar, chance = 8, min = 0, max = 2,},
{name = mobs_mc.items.stick, chance = 4, min = 0, max = 2,},
{name = mobs_mc.items.glass_bottle, chance = 8, min = 0, max = 2, looting = "common",},
{name = mobs_mc.items.glowstone_dust, chance = 8, min = 0, max = 2, looting = "common",},
{name = mobs_mc.items.gunpowder, chance = 8, min = 0, max = 2, looting = "common",},
{name = mobs_mc.items.redstone, chance = 8, min = 0, max = 2, looting = "common",},
{name = mobs_mc.items.spider_eye, chance = 8, min = 0, max = 2, looting = "common",},
{name = mobs_mc.items.sugar, chance = 8, min = 0, max = 2, looting = "common",},
{name = mobs_mc.items.stick, chance = 4, min = 0, max = 2, looting = "common",},
},
-- TODO: sounds
animation = {

View File

@ -13,19 +13,26 @@ local drops_common = {
{name = mobs_mc.items.rotten_flesh,
chance = 1,
min = 0,
max = 2,},
max = 2,
looting = "common",},
{name = mobs_mc.items.iron_ingot,
chance = 120, -- 2.5% / 3
min = 1,
max = 1,},
max = 1,
looting = "rare",
looting_factor = 0.01 / 3,},
{name = mobs_mc.items.carrot,
chance = 120, -- 2.5% / 3
min = 1,
max = 1,},
max = 1,
looting = "rare",
looting_factor = 0.01 / 3,},
{name = mobs_mc.items.potato,
chance = 120, -- 2.5% / 3
min = 1,
max = 1,},
max = 1,
looting = "rare",
looting_factor = 0.01 / 3,},
}
local drops_zombie = table.copy(drops_common)

View File

@ -50,19 +50,23 @@ local pigman = {
{name = mobs_mc.items.rotten_flesh,
chance = 1,
min = 1,
max = 1,},
max = 1,
looting = "common"},
{name = mobs_mc.items.gold_nugget,
chance = 1,
min = 0,
max = 1,},
max = 1,
looting = "common"},
{name = mobs_mc.items.gold_ingot,
chance = 40, -- 2.5%
min = 1,
max = 1,},
max = 1,
looting = "rare"},
{name = mobs_mc.items.gold_sword,
chance = 12, -- 8.333%, approximation to 8.5%
chance = 100 / 8.5,
min = 1,
max = 1,},
max = 1,
looting = "rare"},
},
animation = {
stand_speed = 25,

View File

@ -341,8 +341,8 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
return knockback
end
-- unimplemented
--[[mcl_enchanting.enchantments.looting = {
-- implemented in mcl_mobs and mobs_mc
mcl_enchanting.enchantments.looting = {
name = S("Looting"),
max_level = 3,
primary = {sword = true},
@ -356,7 +356,7 @@ end
requires_tool = false,
treasure = false,
power_range_table = {{15, 61}, {24, 71}, {33, 81}},
}]]--
}
-- requires missing MineClone2 feature
--[[mcl_enchanting.enchantments.loyalty = {
@ -375,6 +375,7 @@ end
power_range_table = {{12, 50}, {19, 50}, {26, 50}},
}]]--
-- implemented in mcl_fishing
mcl_enchanting.enchantments.luck_of_the_sea = {
name = S("Luck of the Sea"),
max_level = 3,