summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-05-03 00:02:03 +0300
committerAndrei Karas <akaras@inbox.ru>2011-05-03 00:02:03 +0300
commit549c16295f341e51635a259695f14eb775aac730 (patch)
tree09d73cd30e95ce73ebf0d1438c4f1915366558ef /src/being.cpp
parent010fe80b3e44cee70422a1f19367f7630fd8a7ab (diff)
downloadmv-549c16295f341e51635a259695f14eb775aac730.tar.gz
mv-549c16295f341e51635a259695f14eb775aac730.tar.bz2
mv-549c16295f341e51635a259695f14eb775aac730.tar.xz
mv-549c16295f341e51635a259695f14eb775aac730.zip
Add min, max, critical hits to debug window.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 2ea399aae..95ba4a63a 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -207,6 +207,9 @@ Being::Being(int id, Type type, Uint16 subtype, Map *map):
mEnemy(false),
mIp(""),
mAttackDelay(0),
+ mMinHit(0),
+ mMaxHit(0),
+ mCriticalHit(0),
mPvpRank(0)
{
mSpriteRemap = new int[20];
@@ -496,6 +499,9 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
// Selecting the right color
if (type == CRITICAL || type == FLEE)
{
+ if (type == CRITICAL)
+ attacker->setCriticalHit(amount);
+
if (attacker == player_node)
{
color = &userPalette->getColor(
@@ -508,6 +514,7 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
}
else if (!amount)
{
+
if (attacker == player_node)
{
// This is intended to be the wrong direction to visually
@@ -570,6 +577,8 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
color, font, true);
}
+ attacker->updateHit(amount);
+
if (amount > 0)
{
if (player_node && player_node == this)
@@ -2157,3 +2166,14 @@ void Being::searchSlotValueItr(std::vector<int>::iterator &it, int &idx,
idx = -1;
return;
}
+
+void Being::updateHit(int amount)
+{
+ if (amount > 0)
+ {
+ if (!mMinHit || amount < mMinHit)
+ mMinHit = amount;
+ if (amount != mCriticalHit && (!mMaxHit || amount > mMaxHit))
+ mMaxHit = amount;
+ }
+} \ No newline at end of file