boss.lua 4.2 KB

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