dungeon_master.lua 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. local S = mobs.intllib
  2. -- Dungeon Master by PilzAdam
  3. mobs:register_mob("mobs_monster:dungeon_master", {
  4. type = "monster",
  5. passive = false,
  6. damage = 6,
  7. attack_type = "dogshoot",
  8. dogshoot_switch = 1,
  9. dogshoot_count_max = 12, -- shoot for 10 seconds
  10. dogshoot_count2_max = 3, -- dogfight for 3 seconds
  11. reach = 3,
  12. shoot_interval = 2.2,
  13. arrow = "mobs_monster:fireball",
  14. shoot_offset = 1,
  15. hp_min = 22,
  16. hp_max = 45,
  17. armor = 60,
  18. collisionbox = {-0.7, -1, -0.7, 0.7, 1.6, 0.7},
  19. visual = "mesh",
  20. mesh = "mobs_dungeon_master.b3d",
  21. textures = {
  22. {"mobs_dungeon_master.png"},
  23. {"mobs_dungeon_master2.png"},
  24. {"mobs_dungeon_master3.png"},
  25. },
  26. makes_footstep_sound = true,
  27. sounds = {
  28. random = "mobs_dungeonmaster",
  29. shoot_attack = "mobs_fireball",
  30. },
  31. walk_velocity = 1,
  32. run_velocity = 3,
  33. jump = true,
  34. view_range = 15,
  35. drops = {
  36. {name = "default:mese_crystal_fragment", chance = 1, min = 0, max = 2},
  37. {name = "mobs:leather", chance = 2, min = 0, max = 2},
  38. {name = "default:mese_crystal", chance = 3, min = 0, max = 2},
  39. {name = "default:diamond", chance = 4, min = 0, max = 1},
  40. {name = "default:diamondblock", chance = 30, min = 0, max = 1},
  41. },
  42. water_damage = 1,
  43. lava_damage = 1,
  44. light_damage = 0,
  45. fear_height = 3,
  46. animation = {
  47. stand_start = 0,
  48. stand_end = 19,
  49. walk_start = 20,
  50. walk_end = 35,
  51. punch_start = 36,
  52. punch_end = 48,
  53. shoot_start = 36,
  54. shoot_end = 48,
  55. speed_normal = 15,
  56. speed_run = 15,
  57. },
  58. })
  59. if not mobs.custom_spawn_monster then
  60. mobs:spawn({
  61. name = "mobs_monster:dungeon_master",
  62. nodes = {"default:stone"},
  63. max_light = 5,
  64. chance = 9000,
  65. active_object_count = 1,
  66. max_height = -70,
  67. })
  68. end
  69. mobs:register_egg("mobs_monster:dungeon_master", S("Dungeon Master"), "fire_basic_flame.png", 1, true)
  70. mobs:alias_mob("mobs:dungeon_master", "mobs_monster:dungeon_master") -- compatibility
  71. -- fireball (weapon)
  72. mobs:register_arrow("mobs_monster:fireball", {
  73. visual = "sprite",
  74. visual_size = {x = 1, y = 1},
  75. textures = {"mobs_fireball.png"},
  76. collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
  77. velocity = 7,
  78. tail = 1,
  79. tail_texture = "mobs_fireball.png",
  80. tail_size = 10,
  81. glow = 5,
  82. expire = 0.1,
  83. on_activate = function(self, staticdata, dtime_s)
  84. -- make fireball indestructable
  85. self.object:set_armor_groups({immortal = 1, fleshy = 100})
  86. end,
  87. -- if player has a good weapon with 7+ damage it can deflect fireball
  88. on_punch = function(self, hitter, tflp, tool_capabilities, dir)
  89. if hitter and hitter:is_player() and tool_capabilities and dir then
  90. local damage = tool_capabilities.damage_groups and
  91. tool_capabilities.damage_groups.fleshy or 1
  92. local tmp = tflp / (tool_capabilities.full_punch_interval or 1.4)
  93. if damage > 6 and tmp < 4 then
  94. self.object:set_velocity({
  95. x = dir.x * self.velocity,
  96. y = dir.y * self.velocity,
  97. z = dir.z * self.velocity,
  98. })
  99. end
  100. end
  101. end,
  102. -- direct hit, no fire... just plenty of pain
  103. hit_player = function(self, player)
  104. player:punch(self.object, 1.0, {
  105. full_punch_interval = 1.0,
  106. damage_groups = {fleshy = 8},
  107. }, nil)
  108. end,
  109. hit_mob = function(self, player)
  110. player:punch(self.object, 1.0, {
  111. full_punch_interval = 1.0,
  112. damage_groups = {fleshy = 8},
  113. }, nil)
  114. end,
  115. -- node hit
  116. hit_node = function(self, pos, node)
  117. mobs:boom(self, pos, 1)
  118. end
  119. })
  120. --minetest.override_item("default:obsidian", {on_blast = function() end})