dungeon_master.lua 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. mobs:spawn({
  60. name = "mobs_monster:dungeon_master",
  61. nodes = {"default:stone"},
  62. max_light = 5,
  63. chance = 9000,
  64. active_object_count = 1,
  65. max_height = -70,
  66. })
  67. mobs:register_egg("mobs_monster:dungeon_master", S("Dungeon Master"), "fire_basic_flame.png", 1, true)
  68. mobs:alias_mob("mobs:dungeon_master", "mobs_monster:dungeon_master") -- compatibility
  69. -- fireball (weapon)
  70. mobs:register_arrow("mobs_monster:fireball", {
  71. visual = "sprite",
  72. visual_size = {x = 1, y = 1},
  73. textures = {"mobs_fireball.png"},
  74. collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
  75. velocity = 7,
  76. tail = 1,
  77. tail_texture = "mobs_fireball.png",
  78. tail_size = 10,
  79. glow = 5,
  80. expire = 0.1,
  81. on_activate = function(self, staticdata, dtime_s)
  82. -- make fireball indestructable
  83. self.object:set_armor_groups({immortal = 1, fleshy = 100})
  84. end,
  85. -- if player has a good weapon with 7+ damage it can deflect fireball
  86. on_punch = function(self, hitter, tflp, tool_capabilities, dir)
  87. if hitter and hitter:is_player() and tool_capabilities and dir then
  88. local damage = tool_capabilities.damage_groups and
  89. tool_capabilities.damage_groups.fleshy or 1
  90. local tmp = tflp / (tool_capabilities.full_punch_interval or 1.4)
  91. if damage > 6 and tmp < 4 then
  92. self.object:set_velocity({
  93. x = dir.x * self.velocity,
  94. y = dir.y * self.velocity,
  95. z = dir.z * self.velocity,
  96. })
  97. end
  98. end
  99. end,
  100. -- direct hit, no fire... just plenty of pain
  101. hit_player = function(self, player)
  102. player:punch(self.object, 1.0, {
  103. full_punch_interval = 1.0,
  104. damage_groups = {fleshy = 8},
  105. }, nil)
  106. end,
  107. hit_mob = function(self, player)
  108. player:punch(self.object, 1.0, {
  109. full_punch_interval = 1.0,
  110. damage_groups = {fleshy = 8},
  111. }, nil)
  112. end,
  113. -- node hit
  114. hit_node = function(self, pos, node)
  115. mobs:boom(self, pos, 1)
  116. end
  117. })
  118. --minetest.override_item("default:obsidian", {on_blast = function() end})