From 35bea0b5c14601e4e6ef52890417d75cc1a1e28e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 29 Sep 2011 20:12:49 +0300 Subject: Fix move to target in attack range. --- src/localplayer.cpp | 10 +++++++++- src/localplayer.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 721c71b1a..28ffc4cf5 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -3452,6 +3452,14 @@ int LocalPlayer::getPathLength(Being* being) } } +int LocalPlayer::getAttackRange2() +{ + int range = getAttackRange(); + if (range == 1) + range = 2; + return range; +} + void LocalPlayer::attack2(Being *target, bool keep, bool dontChangeEquipment) { if (!dontChangeEquipment && target) @@ -3459,7 +3467,7 @@ void LocalPlayer::attack2(Being *target, bool keep, bool dontChangeEquipment) if ((!target || getAttackType() == 0 || getAttackType() == 3) || (withinAttackRange(target, true, 1) - && getPathLength(target) <= getAttackRange() + 1)) + && getPathLength(target) <= getAttackRange2())) { attack(target, keep); if (getAttackType() == 2) diff --git a/src/localplayer.h b/src/localplayer.h index bbd17f53c..447306994 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -139,6 +139,8 @@ class LocalPlayer : public Being, public ActorSpriteListener, */ int getAttackRange(); + int getAttackRange2(); + void attack(Being *target = NULL, bool keep = false, bool dontChangeEquipment = false); -- cgit v1.2.3-70-g09d2