night_master.lua 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. local BOLT_CHANCE = 5
  2. local math_random = math.random
  3. mobs.register_mob("oerkki:night_master", {
  4. type = "monster",
  5. description = "Night Master",
  6. hp_max = 260,
  7. hp_min = 60,
  8. collisionbox = {-0.65, -0.4, -0.65, 0.65, 0.4, 0.65},
  9. visual = "mesh",
  10. mesh = "moonherontrio.x",
  11. textures = {
  12. {"moonherontrio.png"}
  13. },
  14. visual_size = {x = 18, y = 18},
  15. view_range = 40,
  16. rotate = 270,
  17. lifetimer = 5000,
  18. floats=1,
  19. walk_velocity = 3,
  20. run_velocity = 4,
  21. fall_speed = 0,
  22. stepheight = 3,
  23. sounds = {
  24. random = "night_master",
  25. shoot_attack = "dm_fireball",
  26. distance = 45,
  27. },
  28. damage = 10,
  29. jump = true,
  30. armor = 60,
  31. --drawtype = "front",
  32. water_damage = 0,
  33. lava_damage = 5,
  34. light_damage = 0,
  35. blood_texture = "nssm_blood.png",
  36. blood_amount = 50,
  37. fly = true,
  38. attack_type = "shoot",
  39. dogshoot_switch = 1,
  40. dogshoot_count_max = 10,
  41. shoot_interval = 5.0,
  42. arrow = "oerkki:flame_bolt",
  43. shoot_offset = 1,
  44. animation = {
  45. speed_normal = 25,
  46. speed_run = 35,
  47. stand_start = 60,
  48. stand_end = 120,
  49. walk_start = 20,
  50. walk_end = 50,
  51. run_start = 20,
  52. run_end = 50,
  53. punch_start = 130,
  54. punch_end = 160,
  55. },
  56. on_die = function(self, pos)
  57. minetest.add_particlespawner({
  58. amount=200, --amount
  59. time=0.1, --time
  60. minpos={x=pos.x-1, y=pos.y-1, z=pos.z-1}, --minpos
  61. maxpos={x=pos.x+1, y=pos.y+1, z=pos.z+1}, --maxpos
  62. minvel={x=-0, y=-0, z=-0}, --minvel
  63. maxvel={x=1, y=1, z=1}, --maxvel
  64. minacc={x=-0.5,y=5,z=-0.5}, --minacc
  65. maxacc={x=0.5,y=5,z=0.5}, --maxacc
  66. minexptime=0.1, --minexptime
  67. maxexptime=1, --maxexptime
  68. minsize=3, --minsize
  69. maxsize=4, --maxsize
  70. collisiondetection=false, --collisiondetection
  71. texture="tnt_smoke.png", --texture
  72. })
  73. self.object:remove()
  74. minetest.add_entity(pos, "oerkki:night_master_2")
  75. end,
  76. })
  77. mobs.register_mob("oerkki:night_master_2", {
  78. type = "monster",
  79. description = "Night Master",
  80. hp_max = 260,
  81. hp_min = 60,
  82. collisionbox = {-0.65, -0.4, -0.65, 0.65, 0.4, 0.65},
  83. visual = "mesh",
  84. mesh = "night_master_2.x",
  85. textures = {
  86. {"moonherontrio.png"}
  87. },
  88. visual_size = {x = 18, y = 18},
  89. view_range = 30,
  90. rotate = 270,
  91. lifetimer = 5000,
  92. floats = 1,
  93. walk_velocity = 3,
  94. run_velocity = 4,
  95. fall_speed = 0,
  96. stepheight = 3,
  97. sounds = {
  98. random = "night_master",
  99. distance = 45,
  100. },
  101. damage = 10,
  102. jump = true,
  103. armor = 60,
  104. drawtype = "front",
  105. water_damage = 0,
  106. lava_damage = 5,
  107. light_damage = 0,
  108. fly = true,
  109. attack_type = "dogfight",
  110. animation = {
  111. speed_normal = 25,
  112. speed_run = 35,
  113. stand_start = 60,
  114. stand_end = 120,
  115. walk_start = 20,
  116. walk_end = 50,
  117. run_start = 20,
  118. run_end = 50,
  119. punch_start = 130,
  120. punch_end = 160,
  121. },
  122. on_die = function(self, pos)
  123. minetest.add_particlespawner({
  124. amount=200, --amount
  125. time=0.1, --time
  126. minpos={x=pos.x-1, y=pos.y-1, z=pos.z-1}, --minpos
  127. maxpos={x=pos.x+1, y=pos.y+1, z=pos.z+1}, --maxpos
  128. minvel={x=-0, y=-0, z=-0}, --minvel
  129. maxvel={x=1, y=1, z=1}, --maxvel
  130. minacc={x=-0.5,y=5,z=-0.5}, --minacc
  131. maxacc={x=0.5,y=5,z=0.5}, --maxacc
  132. minexptime=0.1, --minexptime
  133. maxexptime=1, --maxexptime
  134. minsize=3, --minsize
  135. maxsize=4, --maxsize
  136. collisiondetection=false, --collisiondetection
  137. texture="tnt_smoke.png", --texture
  138. })
  139. self.object:remove()
  140. minetest.add_entity(pos, "oerkki:night_master_1")
  141. end,
  142. })
  143. mobs.register_mob("oerkki:night_master_1", {
  144. type = "monster",
  145. description = "Night Master",
  146. hp_max = 270,
  147. hp_min = 70,
  148. collisionbox = {-0.65, -0.4, -0.65, 0.65, 0.4, 0.65},
  149. visual = "mesh",
  150. mesh = "night_master_1.x",
  151. textures = {
  152. {"moonherontrio.png"}
  153. },
  154. visual_size = {x = 18, y = 18},
  155. view_range = 20,
  156. rotate = 270,
  157. lifetimer = 5000,
  158. floats=1,
  159. walk_velocity = 3,
  160. run_velocity = 4,
  161. fall_speed = 0,
  162. stepheight = 3,
  163. sounds = {
  164. random = "night_master",
  165. distance = 45,
  166. },
  167. damage = 12,
  168. jump = true,
  169. drops = {
  170. --{name = "mobs:flame_staff", chance = 1, min = 1, max = 1},
  171. --{name = "nssm:life_energy", chance = 1, min = 6, max = 7},
  172. --{name = "nssm:heron_leg", chance = 1, min = 1, max = 1},
  173. --{name = "nssm:night_feather", chance = 1, min = 1, max = 1},
  174. },
  175. armor = 50,
  176. drawtype = "front",
  177. water_damage = 0,
  178. lava_damage = 5,
  179. light_damage = 0,
  180. fly = true,
  181. attack_type = "dogfight",
  182. animation = {
  183. speed_normal = 25,
  184. speed_run = 35,
  185. stand_start = 60,
  186. stand_end = 120,
  187. walk_start = 20,
  188. walk_end = 50,
  189. run_start = 20,
  190. run_end = 50,
  191. punch_start = 130,
  192. punch_end = 160,
  193. }
  194. })
  195. local function arrow_effect(pos, radius, coverage)
  196. -- Note: only spawning flames over ground to prevent the flame bolt entity
  197. -- from falling out.
  198. local flames = fire.scatter_flame_around_over_ground(pos, radius, coverage)
  199. for k = 1, #flames, 1 do
  200. if math_random(1, BOLT_CHANCE) == 1 then
  201. local p = flames[k]
  202. -- Note: item is flammable, so will burn up if fire not put out.
  203. -- I have to manually set the ignite timer in order to prevent the item from
  204. -- disappearing instantly.
  205. local ent = minetest.add_item(p, "mobs:flame_bolt")
  206. if ent then
  207. local lua = ent:get_luaentity()
  208. lua.ignite_timer = math_random(10, 40)
  209. end
  210. end
  211. end
  212. end
  213. mobs.register_arrow("oerkki:flame_bolt", {
  214. visual = "sprite",
  215. visual_size = {x = 0.5, y = 0.5},
  216. textures = {"dm_fireball.png"},
  217. velocity = 8,
  218. -- Player hit, plenty of pain and a lot more flame.
  219. hit_player = function(self, player)
  220. player:punch(self.object, 1.0, {
  221. full_punch_interval = 1.0,
  222. damage_groups = {fleshy = 2},
  223. }, nil)
  224. arrow_effect(vector.round(player:get_pos()), 3, 10)
  225. end,
  226. -- Node hit, bursts into flame.
  227. hit_node = function(self, pos, node)
  228. arrow_effect(pos, 2, 5)
  229. end
  230. })
  231. mobs.register_egg("oerkki:night_master", "Night Master", "default_obsidian.png", 1)