summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp24
-rw-r--r--src/being.h5
-rw-r--r--src/gui/gui.cpp4
-rw-r--r--src/net/beinghandler.cpp5
4 files changed, 31 insertions, 7 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 19c2224d..3214b491 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -189,10 +189,6 @@ void Being::takeDamage(int amount)
}
else
{
- // Hit particle effect
- controlParticle(particleEngine->addEffect(
- "graphics/particles/hit.particle.xml", 0, 0));
-
if (getType() == MONSTER)
{
font = hitBlueFont;
@@ -208,6 +204,26 @@ void Being::takeDamage(int amount)
mPx + 16, mPy + 16);
}
+void Being::showCrit()
+{
+ gcn::Font *font;
+ std::string text = "crit!";
+
+ // Selecting the right color
+ if (getType() == MONSTER)
+ {
+ font = hitBlueFont;
+ }
+ else
+ {
+ font = hitRedFont;
+ }
+
+ // Show crit notice
+ particleEngine->addTextRiseFadeOutEffect(text, font,
+ mPx + 16, mPy - 16);
+}
+
void Being::handleAttack(Being *victim, int damage)
{
setAction(Being::ATTACK);
diff --git a/src/being.h b/src/being.h
index b0c5b49e..62a1c937 100644
--- a/src/being.h
+++ b/src/being.h
@@ -166,6 +166,11 @@ class Being : public Sprite
virtual void takeDamage(int amount);
/**
+ * Puts a crit notification bubble above this being.
+ */
+ virtual void showCrit();
+
+ /**
* Handles an attack of another being by this being.
*
* @param victim The attacked being.
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index edc25152..6d70d532 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -180,9 +180,9 @@ Gui::Gui(Graphics *graphics):
// Load hits' colourful fonts
try {
hitRedFont = new gcn::ImageFont("graphics/gui/hits_red.png",
- "0123456789");
+ "0123456789crit! ");
hitBlueFont = new gcn::ImageFont("graphics/gui/hits_blue.png",
- "0123456789");
+ "0123456789crit! ");
hitYellowFont = new gcn::ImageFont("graphics/gui/hits_yellow.png",
"0123456789misxp ");
}
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index baca0cfc..85e18e5a 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -237,9 +237,12 @@ void BeingHandler::handleMessage(MessageIn *msg)
switch (type)
{
- case 0x00: // Damage
case 0x0a: // Critical Damage
if (dstBeing) {
+ dstBeing->showCrit();
+ }
+ case 0x00: // Damage
+ if (dstBeing) {
dstBeing->takeDamage(param1);
}
if (srcBeing) {