summaryrefslogtreecommitdiff
path: root/src/game-server/monster.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2008-02-11 23:42:48 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2008-02-11 23:42:48 +0000
commitf03e1cb4ce24e92fa3756d7b9aa9131853783810 (patch)
tree183c683de37783e42575f990d509b65cee0a44ab /src/game-server/monster.cpp
parent504b008e264a3213d9802e52b984196ff348f814 (diff)
downloadmanaserv-f03e1cb4ce24e92fa3756d7b9aa9131853783810.tar.gz
manaserv-f03e1cb4ce24e92fa3756d7b9aa9131853783810.tar.bz2
manaserv-f03e1cb4ce24e92fa3756d7b9aa9131853783810.tar.xz
manaserv-f03e1cb4ce24e92fa3756d7b9aa9131853783810.zip
Implemented getting size and speed from monster.xml
Diffstat (limited to 'src/game-server/monster.cpp')
-rw-r--r--src/game-server/monster.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp
index 4cad2311..772942d5 100644
--- a/src/game-server/monster.cpp
+++ b/src/game-server/monster.cpp
@@ -72,14 +72,15 @@ Monster::Monster(MonsterClass *specy):
setAttribute(i, specy->getAttribute(i));
}
+ setSpeed(specy->getSpeed());
+ setSize(specy->getSize());
+
// Some bogus stats for testing.
// TODO: Get all this stuff from the monster database.
mAttackPreDelay = 10;
mAttackAftDelay = 10;
mAttackRange = 32;
mAttackAngle = 10;
- setSpeed(300);
- setSize(8);
// Set positions relative to target from which the monster can attack
mAttackPositions.push_back(AttackPosition(+32, 0, DIRECTION_LEFT));
@@ -226,16 +227,19 @@ void Monster::update()
else
{
// We have no target - let's wander around
- mCountDown--;
- if (mCountDown <= 0)
+ if (getPosition() == getDestination())
{
- unsigned range = mSpecy->getStrollRange();
- if (range)
+ mCountDown--;
+ if (mCountDown <= 0)
{
- Point randomPos(rand() % (range * 2) - range + getPosition().x,
- rand() % (range * 2) - range + getPosition().y);
- setDestination(randomPos);
- mCountDown = 10 + rand() % 10;
+ unsigned range = mSpecy->getStrollRange();
+ if (range)
+ {
+ Point randomPos(rand() % (range * 2) - range + getPosition().x,
+ rand() % (range * 2) - range + getPosition().y);
+ setDestination(randomPos);
+ mCountDown = 10 + rand() % 10;
+ }
}
}
}