diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-03-13 20:02:32 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-03-15 22:53:35 +0100 |
commit | 3a31f9139a8ac4c74113392c76599873c18cea62 (patch) | |
tree | 63999febcc8646b925c26a3bd05b131c645a3499 /src/game-server/being.cpp | |
parent | 596c34c03d361f6631f73995a454e4f6dac70d97 (diff) | |
download | manaserv-3a31f9139a8ac4c74113392c76599873c18cea62.tar.gz manaserv-3a31f9139a8ac4c74113392c76599873c18cea62.tar.bz2 manaserv-3a31f9139a8ac4c74113392c76599873c18cea62.tar.xz manaserv-3a31f9139a8ac4c74113392c76599873c18cea62.zip |
Eliminated one version of Being::performAttack
There was a version taking an attack range, but the range was always the
same as the one specified in the Damage class.
Diffstat (limited to 'src/game-server/being.cpp')
-rw-r--r-- | src/game-server/being.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp index c2228dcc..e0e0dcc1 100644 --- a/src/game-server/being.cpp +++ b/src/game-server/being.cpp @@ -398,25 +398,25 @@ int Being::directionToAngle(int direction) } } -int Being::performAttack(Being *target, const Damage &damage) { - return performAttack(target, damage.range, damage); -} - -int Being::performAttack(Being *target, unsigned range, const Damage &damage) +int Being::performAttack(Being *target, const Damage &damage) { // check target legality - if (!target || target == this || target->getAction() == DEAD - || !target->canFight()) - return -1; - if (getMap()->getPvP() == PVP_NONE && target->getType() == OBJECT_CHARACTER - && getType() == OBJECT_CHARACTER) + if (!target + || target == this + || target->getAction() == DEAD + || !target->canFight()) + return -1; + + if (getMap()->getPvP() == PVP_NONE + && target->getType() == OBJECT_CHARACTER + && getType() == OBJECT_CHARACTER) return -1; // check if target is in range using the pythagorean theorem int distx = this->getPosition().x - target->getPosition().x; int disty = this->getPosition().y - target->getPosition().y; int distSquare = (distx * distx + disty * disty); - int maxDist = range + target->getSize(); + int maxDist = damage.range + target->getSize(); if (maxDist * maxDist < distSquare) return -1; |