diff options
author | David Athay <ko2fan@gmail.com> | 2009-05-19 15:58:58 +0100 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2009-05-19 15:58:58 +0100 |
commit | e975b11e1885457295a51778d8337b097549228d (patch) | |
tree | 09f340afb43894c87f38a0b198392305f67d6ee0 /src/localplayer.cpp | |
parent | 3dd404ee8a02958089bf2c6901fb877d2fae760e (diff) | |
download | mana-e975b11e1885457295a51778d8337b097549228d.tar.gz mana-e975b11e1885457295a51778d8337b097549228d.tar.bz2 mana-e975b11e1885457295a51778d8337b097549228d.tar.xz mana-e975b11e1885457295a51778d8337b097549228d.zip |
Fixed targeting and warn on attack-range not being found in itemdb.
Tried to make the client continue attacking (it does not need to send
attack packets, but just continue playing attack animation and sounds).
Now logs a warning when a weapon is found without an attack-range (I
keep finding weapons with an attack-range of 0 which makes it hard to
target monsters).
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index b9f4b850..31b963ab 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -209,18 +209,14 @@ void LocalPlayer::logic() // Find whether target is in range const int rangeX = abs(mTarget->getPosition().x - getPosition().x); const int rangeY = abs(mTarget->getPosition().y - getPosition().y); - const int attackRange = getAttackRange(); - const int inRange = rangeX > attackRange || rangeY > attackRange - ? 1 : 0; #else // Find whether target is in range const int rangeX = abs(mTarget->mX - mX); const int rangeY = abs(mTarget->mY - mY); +#endif const int attackRange = getAttackRange(); const int inRange = rangeX > attackRange || rangeY > attackRange ? 1 : 0; -#endif - mTarget->setTargetAnimation( mTargetCursor[inRange][mTarget->getTargetCursorSize()]); @@ -290,9 +286,7 @@ void LocalPlayer::nextStep() if (mGoingToTarget && mTarget && withinAttackRange(mTarget)) { mAction = Being::STAND; -#ifdef EATHENA_SUPPORT attack(mTarget, true); -#endif mGoingToTarget = false; mPath.clear(); return; @@ -703,11 +697,11 @@ void LocalPlayer::attack(Being *target, bool keep) #else int dist_x = target->mX - mX; int dist_y = target->mY - mY; -#endif // Must be standing to attack if (mAction != STAND) return; +#endif if (abs(dist_y) >= abs(dist_x)) { @@ -744,10 +738,12 @@ void LocalPlayer::attack(Being *target, bool keep) sound.playSfx("sfx/fist-swish.ogg"); } +#ifdef EATHENA_SUPPORT Net::getPlayerHandler()->attack(target->getId()); if (!keep) stopAttack(); +#endif } void LocalPlayer::stopAttack() @@ -872,7 +868,7 @@ int LocalPlayer::getAttackRange() const ItemInfo info = weapon->getInfo(); return info.getAttackRange(); } - return 32; // unarmed range + return 48; // unarmed range #else return mAttackRange; #endif |