summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-29 20:12:49 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-29 20:12:49 +0300
commit35bea0b5c14601e4e6ef52890417d75cc1a1e28e (patch)
tree0ac03cdd85e68f39d5beb9545bf92113ef9fca46 /src/localplayer.cpp
parent739fd277e28120cd643ac443a013b482698427ba (diff)
downloadplus-35bea0b5c14601e4e6ef52890417d75cc1a1e28e.tar.gz
plus-35bea0b5c14601e4e6ef52890417d75cc1a1e28e.tar.bz2
plus-35bea0b5c14601e4e6ef52890417d75cc1a1e28e.tar.xz
plus-35bea0b5c14601e4e6ef52890417d75cc1a1e28e.zip
Fix move to target in attack range.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp10
1 files changed, 9 insertions, 1 deletions
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)