Scorpion/boss.lua

104 lines
3.3 KiB
Lua
Raw Permalink Normal View History

2019-08-05 07:35:04 -07:00
mobs:register_mob('scorpion:boss', {
type = 'monster',
passive = false,
attack_type = 'dogfight',
2019-09-07 12:19:21 -07:00
damage = 2,
2020-04-12 18:36:22 -07:00
hp_min = 75, hp_max = 175, armor = 20,
2019-08-05 07:35:04 -07:00
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},
2020-04-12 18:36:22 -07:00
{name = 'scorpion:shell', chance = 1, min = 20, max = 100},
2019-08-05 07:35:04 -07:00
},
water_damage = 20,
lava_damage = 60,
light_damage = 0,
2019-08-03 16:12:24 -07:00
reach = 5,
2019-08-05 07:35:04 -07:00
view_range = 12,
2019-08-03 16:12:24 -07:00
fear_height = 9,
2019-08-05 07:35:04 -07:00
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,
},
2019-08-03 16:12:24 -07:00
custom_attack = function(self)
2020-04-12 18:36:22 -07:00
local random_number = math.random(20)
2019-08-03 16:12:24 -07:00
print (random_number)
2020-04-12 18:36:22 -07:00
if random_number < 5 then
2019-08-03 16:12:24 -07:00
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)}
2019-08-05 07:35:04 -07:00
minetest.add_entity(pos1, 'scorpion:little')
2020-04-12 18:36:22 -07:00
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')
2019-08-05 07:35:04 -07:00
end
end,
on_die = function(self)
2020-04-12 18:36:22 -07:00
local random_number = math.random(0,2)
if random_number == 1 then
2019-09-07 12:19:21 -07:00
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
2020-04-12 18:36:22 -07:00
end
2019-08-03 16:12:24 -07:00
end,
})
2020-04-12 18:36:22 -07:00
mobs:spawn({
name = 'scorpion:boss',
2020-04-12 18:36:22 -07:00
nodes = {'default:desert_stone'},
max_light = 10,
2020-04-12 18:36:22 -07:00
min_height = 0,
max_height = 150,
interval = 45,
chance = 10000,
2020-04-12 18:36:22 -07:00
active_object_count = 1,
})