diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-09-29 20:12:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-09-29 20:12:49 +0300 |
commit | 35bea0b5c14601e4e6ef52890417d75cc1a1e28e (patch) | |
tree | 0ac03cdd85e68f39d5beb9545bf92113ef9fca46 | |
parent | 739fd277e28120cd643ac443a013b482698427ba (diff) | |
download | manaverse-35bea0b5c14601e4e6ef52890417d75cc1a1e28e.tar.gz manaverse-35bea0b5c14601e4e6ef52890417d75cc1a1e28e.tar.bz2 manaverse-35bea0b5c14601e4e6ef52890417d75cc1a1e28e.tar.xz manaverse-35bea0b5c14601e4e6ef52890417d75cc1a1e28e.zip |
Fix move to target in attack range.
-rw-r--r-- | src/localplayer.cpp | 10 | ||||
-rw-r--r-- | src/localplayer.h | 2 |
2 files changed, 11 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) 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); |