From eb0f92fe8d919d3c98fbc4294c582514454dab99 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Fri, 26 Oct 2007 12:50:49 +0000 Subject: Implemented monster hurt sounds and added new sound effects by Cosmostrator. --- src/monster.cpp | 7 +++++++ src/monster.h | 7 +++++++ 2 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/monster.cpp b/src/monster.cpp index 00e58648..230c72ad 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -103,6 +103,13 @@ Monster::handleAttack(Being *victim, int damage) sound.playSfx(mi.getSound((damage > 0) ? MONSTER_EVENT_HIT : MONSTER_EVENT_MISS)); } +void +Monster::takeDamage(int amount) +{ + if (amount > 0) sound.playSfx(getInfo().getSound(MONSTER_EVENT_HURT)); + Being::takeDamage(amount); +} + Being::TargetCursorSize Monster::getTargetCursorSize() const { diff --git a/src/monster.h b/src/monster.h index 4a24068f..39556b44 100644 --- a/src/monster.h +++ b/src/monster.h @@ -51,6 +51,13 @@ class Monster : public Being */ virtual void handleAttack(Being *victim, int damage); + /** + * Puts a damage bubble above this monster and plays the hurt sound + * + * @param amount The amount of damage. + */ + virtual void takeDamage(int amount); + /** * Returns the MonsterInfo, with static data about this monster. */ -- cgit v1.2.3-60-g2f50