diff --git a/battlefield.lua b/battlefield.lua --- a/battlefield.lua +++ b/battlefield.lua @@ -431,12 +431,12 @@ bf_wait = obj { combatant = function(tab) tab.canshoot = function(s) local dist = math.sqrt((s.x - here().plX) * (s.x - here().plX) + (s.y - here().plY) * (s.y - here().plY)); - return dist < 4 and not tab.ally; + return dist < 6 and not tab.ally; end; tab.onthrust = function(s) - local dist = here().getDistance(here().plX, here().plY, s.x, s.y); - if (rnd(4) > dist) then + local dist = math.sqrt((s.x - here().plX) * (s.x - here().plX) + (s.y - here().plY) * (s.y - here().plY)); + if (rnd(4) > dist - 2) then tab.hp = tab.hp - 2; if (tab.hp > 0) then p(tab.thrustHit); @@ -450,7 +450,7 @@ combatant = function(tab) here():make_turn(); end; tab.onshoot = function(s) - local dist = math.sqrt((s.x - here().plX) * (s.x - here().plX) + (s.y - here().plY) * (s.y - here().plY));--here().getDistance(here().plX, here().plY, s.x, s.y); + local dist = math.sqrt((s.x - here().plX) * (s.x - here().plX) + (s.y - here().plY) * (s.y - here().plY)); if (rnd(4) > dist - 2) then if (dist == 0) then tab.hp = tab.hp - 2;