summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-27 22:24:01 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-27 22:24:01 +0300
commit60859a71dd9794b0216cc7a60146d417e06dbbad (patch)
tree2e4bed96f702247edac6e967d77b3be4a8110eec /src/being/being.cpp
parent9fc44b1a5274ad8a1f7bcb6a1649e77e88a74640 (diff)
downloadManaVerse-60859a71dd9794b0216cc7a60146d417e06dbbad.tar.gz
ManaVerse-60859a71dd9794b0216cc7a60146d417e06dbbad.tar.bz2
ManaVerse-60859a71dd9794b0216cc7a60146d417e06dbbad.tar.xz
ManaVerse-60859a71dd9794b0216cc7a60146d417e06dbbad.zip
Show hp bar for mercenary.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp74
1 files changed, 73 insertions, 1 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index b7770c037..a44870e13 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -42,6 +42,7 @@
#include "being/playerrelations.h"
#ifdef EATHENA_SUPPORT
#include "being/homunculusinfo.h"
+#include "being/mercenaryinfo.h"
#endif // EATHENA_SUPPORT
#include "const/utils/timer.h"
@@ -3603,6 +3604,18 @@ void Being::drawHomunculus(Graphics *restrict const graphics,
drawBeingCursor(graphics, px, py);
drawHomunculusSpriteAt(graphics, px, py);
}
+
+void Being::drawMercenary(Graphics *restrict const graphics,
+ const int offsetX,
+ const int offsetY) const restrict2
+{
+ // getActorX() + offsetX;
+ const int px = mPixelX - mapTileSize / 2 + offsetX;
+ // getActorY() + offsetY;
+ const int py = mPixelY - mapTileSize + offsetY;
+ drawBeingCursor(graphics, px, py);
+ drawMercenarySpriteAt(graphics, px, py);
+}
#endif // EATHENA_SUPPORT
void Being::drawPortal(Graphics *restrict const graphics,
@@ -3638,8 +3651,12 @@ void Being::draw(Graphics *restrict const graphics,
offsetX,
offsetY);
break;
- case ActorType::Pet:
case ActorType::Mercenary:
+ drawMercenary(graphics,
+ offsetX,
+ offsetY);
+ break;
+ case ActorType::Pet:
case ActorType::SkillUnit:
case ActorType::Unknown:
#endif
@@ -3874,6 +3891,61 @@ void Being::drawHomunculusSpriteAt(Graphics *restrict const graphics,
}
}
}
+
+void Being::drawMercenarySpriteAt(Graphics *restrict const graphics,
+ const int x,
+ const int y) const restrict2
+{
+ if (mHighlightMonsterAttackRange &&
+ mAction != BeingAction::DEAD)
+ {
+ if (!userPalette)
+ {
+ CompoundSprite::drawSimple(graphics, x, y);
+ return;
+ }
+
+ int attackRange;
+ if (mAttackRange)
+ attackRange = mapTileSize * mAttackRange;
+ else
+ attackRange = mapTileSize;
+
+ graphics->setColor(userPalette->getColorWithAlpha(
+ UserColorId::MONSTER_ATTACK_RANGE));
+
+ graphics->fillRectangle(Rect(
+ x - attackRange, y - attackRange,
+ 2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize));
+ }
+
+ CompoundSprite::drawSimple(graphics, x, y);
+
+ if (mShowMobHP &&
+ mInfo)
+ {
+ const MercenaryInfo *const info = PlayerInfo::getMercenary();
+ if (info &&
+ mId == info->id)
+ {
+ // show hp bar here
+ int maxHP = PlayerInfo::getStatBase(Attributes::MERC_MAX_HP);
+ if (!maxHP)
+ maxHP = mInfo->getMaxHP();
+
+ drawHpBar(graphics,
+ maxHP,
+ PlayerInfo::getStatBase(Attributes::MERC_HP),
+ mDamageTaken,
+ UserColorId::MONSTER_HP,
+ UserColorId::MONSTER_HP2,
+ x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
+ y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
+ 2 * 50,
+ 4);
+ }
+ }
+}
#endif
void Being::drawPortalSpriteAt(Graphics *restrict const graphics,