From 549c16295f341e51635a259695f14eb775aac730 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 3 May 2011 00:02:03 +0300 Subject: Add min, max, critical hits to debug window. --- src/being.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/being.cpp') 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::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 -- cgit v1.2.3-70-g09d2