This commit is contained in:
Zughy 2020-12-13 21:26:32 +00:00
commit 722a939651

View File

@ -254,6 +254,8 @@ function block_league.apply_damage(user, targets, weapon, decrease_damage_with_d
targets = {targets} targets = {targets}
end end
local remaining_HP
-- per ogni giocatore colpito -- per ogni giocatore colpito
for _, target in pairs(targets) do for _, target in pairs(targets) do
@ -271,7 +273,13 @@ function block_league.apply_damage(user, targets, weapon, decrease_damage_with_d
target:add_player_velocity(knk) target:add_player_velocity(knk)
end end
local remaining_HP = target:get_hp() - damage if weapon.weapon_type == 1 and decrease_damage_with_distance then
local dist = get_dist(user:get_pos(), target:get_pos())
local damage = damage - (damage * dist / weapon.weapon_range)
remaining_HP = target:get_hp() - damage
else
remaining_HP = target:get_hp() - damage
end
-- applico il danno -- applico il danno
target:set_hp(remaining_HP, {type = "set_hp", player_name = p_name}) target:set_hp(remaining_HP, {type = "set_hp", player_name = p_name})