summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2010-01-09 23:47:50 +0200
committerBlue <bluesansdouze@gmail.com>2010-01-10 01:12:46 +0100
commit0c86751e2ca0674e1ae6e584b9e017af8d1e48fe (patch)
tree0bd5954c3887f5444ac587a1121019ccbdd47803 /src/being.cpp
parenta9da8dca359f1975d1be6bbef16ea72928652880 (diff)
downloadmana-0c86751e2ca0674e1ae6e584b9e017af8d1e48fe.tar.gz
mana-0c86751e2ca0674e1ae6e584b9e017af8d1e48fe.tar.bz2
mana-0c86751e2ca0674e1ae6e584b9e017af8d1e48fe.tar.xz
mana-0c86751e2ca0674e1ae6e584b9e017af8d1e48fe.zip
Show monster inflicted damage.
Disabled by default.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/being.cpp b/src/being.cpp
index b54f4c44..6ae71f85 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -94,7 +94,8 @@ Being::Being(int id, int job, Map *map):
#endif
mPx(0), mPy(0),
mX(0), mY(0),
- mUsedTargetCursor(NULL)
+ mUsedTargetCursor(NULL),
+ mTakedDamage(0)
{
setMap(map);
@@ -314,6 +315,12 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
if (amount > 0)
{
+ if (getType() == MONSTER)
+ {
+ mTakedDamage += amount;
+ updateName();
+ }
+
if (type != CRITICAL)
{
effectManager->trigger(26, this);
@@ -941,9 +948,19 @@ void Being::showName()
{
delete mDispName;
mDispName = 0;
+ std::string mDisplayName(mName);
+
+ if(getType() == MONSTER)
+ {
+ if (config.getValue("showMonstersTakedDamage", false))
+ {
+ mDisplayName += ", " + toString(getTakedDamage());
+ }
+ }
- mDispName = new FlashText(mName, getPixelX(), getPixelY(),
+ mDispName = new FlashText(mDisplayName, getPixelX(), getPixelY(),
gcn::Graphics::CENTER, mNameColor);
+
}
int Being::getNumberOfLayers() const
@@ -962,3 +979,11 @@ void Being::load()
mNumberOfHairstyles = hairstyles;
}
+
+void Being::updateName()
+{
+ if (mShowName)
+ {
+ showName();
+ }
+}