boss.lua 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. mobs:register_mob('scorpion:boss', {
  2. type = 'monster',
  3. passive = false,
  4. attack_type = 'dogfight',
  5. damage = 2,
  6. hp_min = 75, hp_max = 175, armor = 20,
  7. collisionbox = {-1, -0.95, -1, 1, .35, 1},
  8. visual = 'mesh',
  9. mesh = 'scorpion.b3d',
  10. drawtype = 'front',
  11. textures = {
  12. {'scorpion_red.png^scorpion_armor.png'},
  13. {'scorpion_green.png^scorpion_armor.png'},
  14. {'scorpion_tan.png^scorpion_armor.png'},
  15. },
  16. blood_texture = 'mobs_blood.png',
  17. visual_size = {x=20,y=20},
  18. makes_footstep_sound = true,
  19. sounds = {
  20. war_cry = 'scorpion_squeak',
  21. },
  22. walk_velocity = 3,
  23. run_velocity = 7,
  24. jump = true,
  25. stepheight = 3,
  26. drops = {
  27. {name = 'mobs:meat_raw', chance = 1, min = 5, max = 15},
  28. {name = 'default:diamondblock', chance = 3, min = 4, max = 15},
  29. {name = 'default:mese', chance = 3, min = 4, max = 15},
  30. {name = 'default:steel_ingot', chance = 2, min = 10, max = 40},
  31. {name = 'scorpion:shell', chance = 1, min = 20, max = 100},
  32. },
  33. water_damage = 20,
  34. lava_damage = 60,
  35. light_damage = 0,
  36. reach = 5,
  37. view_range = 12,
  38. fear_height = 9,
  39. animation = {
  40. speed_normal = 15, speed_run = 15,
  41. stand_start = 0, stand_end = 60,
  42. walk_start = 150, walk_end = 210,
  43. run_start = 150, run_end = 210,
  44. punch_start = 220, punch_end = 260,
  45. punch2_start = 265, punch2_end = 305,
  46. punch3_start = 70, punch3_end = 140,
  47. },
  48. custom_attack = function(self)
  49. local random_number = math.random(20)
  50. print (random_number)
  51. if random_number < 5 then
  52. local s = self.object:get_pos()
  53. local pos1 = {x=s.x+math.random(-3,3), y=s.y, z=s.z+math.random(-3,3)}
  54. minetest.add_entity(pos1, 'scorpion:little')
  55. elseif random_number == 16 then
  56. local s = self.object:get_pos()
  57. local pos1 = {x=s.x+math.random(-3,3), y=s.y, z=s.z+math.random(-3,3)}
  58. minetest.add_entity(pos1, 'scorpion:big')
  59. end
  60. end,
  61. on_die = function(self)
  62. local random_number = math.random(0,2)
  63. if random_number == 1 then
  64. local pos = self.object:get_pos()
  65. local objs = minetest.get_objects_inside_radius(pos, 4)
  66. for _, obj in pairs(objs) do
  67. if obj:is_player() then
  68. local pos1 = {x=pos.x+math.random(-2,2), y=pos.y, z=pos.z+math.random(-2,2)}
  69. local mob = minetest.add_entity(pos1, 'scorpion:pet')
  70. local ent2 = mob:get_luaentity()
  71. mob:set_properties({
  72. visual_size = {
  73. x = ent2.base_size.x / 2,
  74. y = ent2.base_size.y / 2
  75. },
  76. collisionbox = {
  77. ent2.base_colbox[1] / 2,
  78. ent2.base_colbox[2] / 2,
  79. ent2.base_colbox[3] / 2,
  80. ent2.base_colbox[4] / 2,
  81. ent2.base_colbox[5] / 2,
  82. ent2.base_colbox[6] / 2
  83. },
  84. })
  85. ent2.child = true
  86. end
  87. end
  88. end
  89. end,
  90. })
  91. mobs:spawn({
  92. name = 'scorpion:boss',
  93. nodes = {'default:desert_stone'},
  94. max_light = 10,
  95. min_height = 0,
  96. max_height = 150,
  97. interval = 45,
  98. chance = 10000,
  99. active_object_count = 1,
  100. })