dungeon_master.lua 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. 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. {name = "commoditymarkget:gold_coins", chance = 10, min = 30, max = 200},
  42. {name = "stations:scroll_teleport", chance = 40, min = 1, max = 1},
  43. {name = "stations:scroll_healing", chance = 50, min = 1, max = 1},
  44. },
  45. water_damage = 1,
  46. lava_damage = 1,
  47. light_damage = 0,
  48. fear_height = 3,
  49. animation = {
  50. stand_start = 0,
  51. stand_end = 19,
  52. walk_start = 20,
  53. walk_end = 35,
  54. punch_start = 36,
  55. punch_end = 48,
  56. shoot_start = 36,
  57. shoot_end = 48,
  58. speed_normal = 15,
  59. speed_run = 15,
  60. },
  61. })
  62. mobs:spawn({
  63. name = "mobs_monster:dungeon_master",
  64. nodes = {"default:stone", "nether:rack", "caverealms:stone_with_algae", "caverealms:stone_with_lichen", "cavrealms:stone_with_moss", "caverealms:hot_cobble" },
  65. max_light = 5,
  66. chance = 9000,
  67. active_object_count = 4,
  68. max_height = -70,
  69. })
  70. -- fireball (weapon)
  71. mobs:register_arrow("mobs_monster:fireball", {
  72. visual = "sprite",
  73. visual_size = {x = 1, y = 1},
  74. textures = {"mobs_fireball.png"},
  75. collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
  76. velocity = 7,
  77. tail = 1,
  78. tail_texture = "mobs_fireball.png",
  79. tail_size = 10,
  80. glow = 5,
  81. expire = 0.1,
  82. on_activate = function(self, staticdata, dtime_s)
  83. -- make fireball indestructable
  84. self.object:set_armor_groups({immortal = 1, fleshy = 100})
  85. end,
  86. -- if player has a good weapon with 7+ damage it can deflect fireball
  87. on_punch = function(self, hitter, tflp, tool_capabilities, dir)
  88. if hitter and hitter:is_player() and tool_capabilities and dir then
  89. local damage = tool_capabilities.damage_groups and
  90. tool_capabilities.damage_groups.fleshy or 1
  91. local tmp = tflp / (tool_capabilities.full_punch_interval or 1.4)
  92. if damage > 6 and tmp < 4 then
  93. self.object:set_velocity({
  94. x = dir.x * self.velocity,
  95. y = dir.y * self.velocity,
  96. z = dir.z * self.velocity,
  97. })
  98. end
  99. end
  100. end,
  101. -- direct hit, no fire... just plenty of pain
  102. hit_player = function(self, player)
  103. player:punch(self.object, 1.0, {
  104. full_punch_interval = 1.0,
  105. damage_groups = {fleshy = 8},
  106. }, nil)
  107. end,
  108. hit_mob = function(self, player)
  109. player:punch(self.object, 1.0, {
  110. full_punch_interval = 1.0,
  111. damage_groups = {fleshy = 8},
  112. }, nil)
  113. end,
  114. -- node hit
  115. hit_node = function(self, pos, node)
  116. mobs:boom(self, pos, 2)
  117. end
  118. })
  119. minetest.override_item("default:obsidian", {on_blast = function() end})