add custom on_punch for dungeon master fireball

This commit is contained in:
TenPlus1 2018-09-09 11:11:40 +01:00
parent e862912cca
commit 70cc684e41
1 changed files with 25 additions and 5 deletions

View File

@ -7,17 +7,17 @@ local S = mobs.intllib
mobs:register_mob("mobs_monster:dungeon_master", {
type = "monster",
passive = false,
damage = 4,
damage = 6,
attack_type = "dogshoot",
dogshoot_switch = 1,
dogshoot_count_max = 12, -- shoot for 10 seconds
dogshoot_count2_max = 3, -- dogfight for 3 seconds
reach = 3,
shoot_interval = 2.5,
shoot_interval = 2.2,
arrow = "mobs_monster:fireball",
shoot_offset = 1,
hp_min = 12,
hp_max = 35,
hp_min = 22,
hp_max = 45,
armor = 60,
collisionbox = {-0.7, -1, -0.7, 0.7, 1.6, 0.7},
visual = "mesh",
@ -83,13 +83,33 @@ mobs:register_arrow("mobs_monster:fireball", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"mobs_fireball.png"},
velocity = 6,
collisionbox = {-0.2, -0.2, -0.2, 0.2, 0.2, 0.2},
velocity = 7,
tail = 1,
tail_texture = "mobs_fireball.png",
tail_size = 10,
glow = 5,
expire = 0.1,
-- if player has a good weapon with 7+ damage it can deflect fireball
on_punch = function(self, hitter, tflp, tool_capabilities, dir)
if hitter and hitter:is_player() and tool_capabilities and dir then
local damage = tool_capabilities.damage_groups and
tool_capabilities.damage_groups.fleshy or 1
if damage > 6 then
self.object:set_velocity({
x = dir.x * self.velocity,
y = dir.y * self.velocity,
z = dir.z * self.velocity,
})
end
end
end,
-- direct hit, no fire... just plenty of pain
hit_player = function(self, player)
player:punch(self.object, 1.0, {