dungeon_master.lua 3.5 KB

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