Scorpion/boss.lua

104 lines
3.3 KiB
Lua

mobs:register_mob('scorpion:boss', {
type = 'monster',
passive = false,
attack_type = 'dogfight',
damage = 2,
hp_min = 75, hp_max = 175, armor = 20,
collisionbox = {-1, -0.95, -1, 1, .35, 1},
visual = 'mesh',
mesh = 'scorpion.b3d',
drawtype = 'front',
textures = {
{'scorpion_red.png^scorpion_armor.png'},
{'scorpion_green.png^scorpion_armor.png'},
{'scorpion_tan.png^scorpion_armor.png'},
},
blood_texture = 'mobs_blood.png',
visual_size = {x=20,y=20},
makes_footstep_sound = true,
sounds = {
war_cry = 'scorpion_squeak',
},
walk_velocity = 3,
run_velocity = 7,
jump = true,
stepheight = 3,
drops = {
{name = 'mobs:meat_raw', chance = 1, min = 5, max = 15},
{name = 'default:diamondblock', chance = 3, min = 4, max = 15},
{name = 'default:mese', chance = 3, min = 4, max = 15},
{name = 'default:steel_ingot', chance = 2, min = 10, max = 40},
{name = 'scorpion:shell', chance = 1, min = 20, max = 100},
},
water_damage = 20,
lava_damage = 60,
light_damage = 0,
reach = 5,
view_range = 12,
fear_height = 9,
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 60,
walk_start = 150, walk_end = 210,
run_start = 150, run_end = 210,
punch_start = 220, punch_end = 260,
punch2_start = 265, punch2_end = 305,
punch3_start = 70, punch3_end = 140,
},
custom_attack = function(self)
local random_number = math.random(20)
print (random_number)
if random_number < 5 then
local s = self.object:get_pos()
local pos1 = {x=s.x+math.random(-3,3), y=s.y, z=s.z+math.random(-3,3)}
minetest.add_entity(pos1, 'scorpion:little')
elseif random_number == 16 then
local s = self.object:get_pos()
local pos1 = {x=s.x+math.random(-3,3), y=s.y, z=s.z+math.random(-3,3)}
minetest.add_entity(pos1, 'scorpion:big')
end
end,
on_die = function(self)
local random_number = math.random(0,2)
if random_number == 1 then
local pos = self.object:get_pos()
local objs = minetest.get_objects_inside_radius(pos, 4)
for _, obj in pairs(objs) do
if obj:is_player() then
local pos1 = {x=pos.x+math.random(-2,2), y=pos.y, z=pos.z+math.random(-2,2)}
local mob = minetest.add_entity(pos1, 'scorpion:pet')
local ent2 = mob:get_luaentity()
mob:set_properties({
visual_size = {
x = ent2.base_size.x / 2,
y = ent2.base_size.y / 2
},
collisionbox = {
ent2.base_colbox[1] / 2,
ent2.base_colbox[2] / 2,
ent2.base_colbox[3] / 2,
ent2.base_colbox[4] / 2,
ent2.base_colbox[5] / 2,
ent2.base_colbox[6] / 2
},
})
ent2.child = true
end
end
end
end,
})
mobs:spawn({
name = 'scorpion:boss',
nodes = {'default:desert_stone'},
max_light = 10,
min_height = 0,
max_height = 150,
interval = 45,
chance = 10000,
active_object_count = 1,
})