summaryrefslogtreecommitdiff
path: root/src
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
parent010fe80b3e44cee70422a1f19367f7630fd8a7ab (diff)
downloadmanaverse-549c16295f341e51635a259695f14eb775aac730.tar.gz
manaverse-549c16295f341e51635a259695f14eb775aac730.tar.bz2
manaverse-549c16295f341e51635a259695f14eb775aac730.tar.xz
manaverse-549c16295f341e51635a259695f14eb775aac730.zip
Add min, max, critical hits to debug window.
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp20
-rw-r--r--src/being.h23
-rw-r--r--src/gui/debugwindow.cpp16
-rw-r--r--src/gui/debugwindow.h3
4 files changed, 62 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
diff --git a/src/being.h b/src/being.h
index 1569d5df8..9609c2909 100644
--- a/src/being.h
+++ b/src/being.h
@@ -667,6 +667,26 @@ class Being : public ActorSprite, public ConfigListener
int getAttackDelay()
{ return mAttackDelay; }
+ int getMinHit()
+ { return mMinHit; }
+
+ void setMinHit(int n)
+ { mMinHit = n; }
+
+ int getMaxHit()
+ { return mMaxHit; }
+
+ void setMaxHit(int n)
+ { mMaxHit = n; }
+
+ int getCriticalHit()
+ { return mCriticalHit; }
+
+ void setCriticalHit(int n)
+ { mCriticalHit = n; }
+
+ void updateHit(int amount);
+
protected:
/**
* Sets the new path for this being.
@@ -790,6 +810,9 @@ class Being : public ActorSprite, public ConfigListener
bool mEnemy;
std::string mIp;
int mAttackDelay;
+ int mMinHit;
+ int mMaxHit;
+ int mCriticalHit;
unsigned int mPvpRank;
int *mSpriteRemap;
int *mSpriteHide;
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index e9c79a890..cbfce25dc 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -246,6 +246,9 @@ TargetDebugTab::TargetDebugTab()
mTargetPartyLabel = new Label(strprintf("%s ?", _("Target Party:")));
mTargetGuildLabel = new Label(strprintf("%s ?", _("Target Guild:")));
mAttackDelayLabel = new Label(strprintf("%s ?", _("Attack delay:")));
+ mMinHitLabel = new Label(strprintf("%s ?", _("Minimal hit:")));
+ mMaxHitLabel = new Label(strprintf("%s ?", _("Maximum hit:")));
+ mCriticalHitLabel = new Label(strprintf("%s ?", _("Critical hit:")));
place(0, 0, mTargetLabel, 2);
place(0, 1, mTargetIdLabel, 2);
@@ -253,6 +256,9 @@ TargetDebugTab::TargetDebugTab()
place(0, 3, mAttackDelayLabel, 2);
place(0, 4, mTargetPartyLabel, 2);
place(0, 5, mTargetGuildLabel, 2);
+ place(0, 6, mMinHitLabel, 2);
+ place(0, 7, mMaxHitLabel, 2);
+ place(0, 8, mCriticalHitLabel, 2);
place.getCell().matchColWidth(0, 0);
place = h.getPlacer(0, 1);
@@ -288,6 +294,13 @@ void TargetDebugTab::logic()
mTargetGuildLabel->setCaption(strprintf("%s %s", _("Target Guild:"),
target->getGuildName().c_str()));
+ mMinHitLabel->setCaption(strprintf("%s %d",
+ _("Minimal hit:"), target->getMinHit()));
+ mMaxHitLabel->setCaption(strprintf("%s %d",
+ _("Maximum hit:"), target->getMaxHit()));
+ mCriticalHitLabel->setCaption(strprintf("%s %d",
+ _("Critical hit:"), target->getCriticalHit()));
+
const int delay = target->getAttackDelay();
if (delay)
{
@@ -308,6 +321,9 @@ void TargetDebugTab::logic()
mTargetPartyLabel->setCaption(strprintf("%s ?", _("Target Party:")));
mTargetGuildLabel->setCaption(strprintf("%s ?", _("Target Guild:")));
mAttackDelayLabel->setCaption(strprintf("%s ?", _("Attack delay:")));
+ mMinHitLabel->setCaption(strprintf("%s ?", _("Minimal hit:")));
+ mMaxHitLabel->setCaption(strprintf("%s ?", _("Maximum hit:")));
+ mCriticalHitLabel->setCaption(strprintf("%s ?", _("Critical hit:")));
}
mTargetLabel->adjustSize();
diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h
index b19a18450..b3432946b 100644
--- a/src/gui/debugwindow.h
+++ b/src/gui/debugwindow.h
@@ -84,6 +84,9 @@ class TargetDebugTab : public DebugTab
Label *mTargetPartyLabel;
Label *mTargetGuildLabel;
Label *mAttackDelayLabel;
+ Label *mMinHitLabel;
+ Label *mMaxHitLabel;
+ Label *mCriticalHitLabel;
};
class NetDebugTab : public DebugTab