summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-10-02 19:36:43 +0300
committerAndrei Karas <akaras@inbox.ru>2011-10-02 20:31:46 +0300
commit2596c142137a45d88a65431956436b9a5d466859 (patch)
treec6ee4f5de040329e9da2c74e9ce08b927fd04ba9
parent99771a1fb50286fdb0b511f425312503e657eddc (diff)
downloadmv-2596c142137a45d88a65431956436b9a5d466859.tar.gz
mv-2596c142137a45d88a65431956436b9a5d466859.tar.bz2
mv-2596c142137a45d88a65431956436b9a5d466859.tar.xz
mv-2596c142137a45d88a65431956436b9a5d466859.zip
Add new move to target mode for archers.
In this mode player not selecting closer targets.
-rw-r--r--src/actorspritemanager.cpp16
-rw-r--r--src/gui/statuspopup.cpp5
-rw-r--r--src/gui/statuswindow.cpp3
-rw-r--r--src/localplayer.cpp3
4 files changed, 25 insertions, 2 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index 827d46f29..3a8b47aed 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -118,7 +118,11 @@ class SortBeingFunctor
return w1 < w2;
}
if (being1->getDistance() != being2->getDistance())
+ {
+ if (specialDistance && being1->getDistance() <= 2)
+ return false;
return being1->getDistance() < being2->getDistance();
+ }
int d1, d2;
#ifdef MANASERV_SUPPORT
@@ -164,7 +168,7 @@ class SortBeingFunctor
int defaultAttackIndex;
std::map<std::string, int> *priorityBeings;
int defaultPriorityIndex;
-
+ bool specialDistance;
} beingSorter;
ActorSpriteManager::ActorSpriteManager() :
@@ -764,6 +768,12 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
std::map<std::string, int> priorityMobsMap;
int defaultAttackIndex = 10000;
int defaultPriorityIndex = 10000;
+ bool specialDistance = false;
+ if (player_node->getMoveToTargetType() == 7
+ && player_node->getAttackRange() > 2)
+ {
+ specialDistance = true;
+ }
maxDist = maxDist * maxDist;
@@ -783,6 +793,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
priorityMobsMap = mPriorityAttackMobsMap;
beingSorter.attackBeings = &attackMobsMap;
beingSorter.priorityBeings = &priorityMobsMap;
+ beingSorter.specialDistance = specialDistance;
if (ignoreAttackMobs.find("") != ignoreAttackMobs.end())
ignoreDefault = true;
std::map<std::string, int>::const_iterator
@@ -928,6 +939,9 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
if (!valid)
continue;
+ if (specialDistance && being->getDistance() <= 2)
+ continue;
+
// logger->log("being name:" + being->getName());
// logger->log("index:" + toString(index));
// logger->log("d:" + toString(d));
diff --git a/src/gui/statuspopup.cpp b/src/gui/statuspopup.cpp
index fee6450df..a0c8e06d4 100644
--- a/src/gui/statuspopup.cpp
+++ b/src/gui/statuspopup.cpp
@@ -284,6 +284,11 @@ void StatusPopup::updateLabels()
_("(A) moves to target in attack range"),
keyboard.KEY_CHANGE_MOVE_TO_TARGET);
break;
+ case 7:
+ setLabelText(mMoveToTargetType,
+ _("(a) archer attack range"),
+ keyboard.KEY_CHANGE_MOVE_TO_TARGET);
+ break;
default:
setLabelText(mMoveToTargetType,
_("(?) move to target"), keyboard.KEY_CHANGE_MOVE_TO_TARGET);
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 170fd6ab4..c746eb82d 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -702,6 +702,9 @@ void StatusWindow::updateStatusBar(ProgressBar *bar, bool percent A_UNUSED)
case 6:
str += translateLetter(N_("(A)"));
break;
+ case 7:
+ str += translateLetter(N_("(a)"));
+ break;
default:
str += translateLetter(N_("(?)"));
break;
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 28ffc4cf5..8ab10b6da 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -1764,6 +1764,7 @@ void LocalPlayer::moveToTarget(unsigned int dist)
dist = 7;
break;
case 6:
+ case 7:
dist = mAttackRange;
if (dist == 1)
dist = 2;
@@ -2946,7 +2947,7 @@ void LocalPlayer::tryMagic(std::string spell, int baseMagic,
void LocalPlayer::changeMoveToTargetType()
{
mMoveToTargetType++;
- if (mMoveToTargetType > 6)
+ if (mMoveToTargetType > 7)
mMoveToTargetType = 0;
config.setValue("moveToTargetType", mMoveToTargetType);