summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
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();
+ }
+}