capturetheflag/mods/ctf/ctf_classes/melee.lua
LoneWolfHT 9666b03ea3
Increase sword damage dealt by knights (#684)
* Extra sword damage for knights

* Make steel sword craftable
2020-10-13 08:42:41 -07:00

14 lines
416 B
Lua

minetest.register_on_player_hpchange(function(player, hp_change, reason)
if reason.type ~= "punch" or not reason.object or not reason.object:is_player() then
return hp_change
end
local class = ctf_classes.get(reason.object)
if class.properties.melee_bonus and reason.object:get_wielded_item():get_name():find("sword") then
return hp_change - class.properties.melee_bonus
end
return hp_change
end, true)