summaryrefslogtreecommitdiff
path: root/src/monster.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-02-20 20:55:37 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-02-20 20:55:37 +0000
commite99b6aaeb119feabfa2f7c3c49908625981e9708 (patch)
tree00f599c90443be884b9b8b51618552c2f8834f2d /src/monster.cpp
parenteadbe0cb009b8c8fec622946f0b0109a2f07b1f1 (diff)
downloadmana-e99b6aaeb119feabfa2f7c3c49908625981e9708.tar.gz
mana-e99b6aaeb119feabfa2f7c3c49908625981e9708.tar.bz2
mana-e99b6aaeb119feabfa2f7c3c49908625981e9708.tar.xz
mana-e99b6aaeb119feabfa2f7c3c49908625981e9708.zip
Now different sounds can play when a monster misses the player.
Diffstat (limited to 'src/monster.cpp')
-rw-r--r--src/monster.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/monster.cpp b/src/monster.cpp
index 68e9d6ba..c20e12d0 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -73,11 +73,10 @@ Monster::setAction(Uint8 action)
break;
case DEAD:
currentAction = ACTION_DEAD;
- sound.playSfx(MonsterDB::get(mJob - 1002).getSound(EVENT_DIE));
+ sound.playSfx(getInfo().getSound(EVENT_DIE));
break;
case ATTACK:
currentAction = ACTION_ATTACK;
- sound.playSfx(MonsterDB::get(mJob - 1002).getSound(EVENT_HIT));
mSprites[BASE_SPRITE]->reset();
break;
case STAND:
@@ -94,3 +93,18 @@ Monster::setAction(Uint8 action)
mAction = action;
}
}
+
+void
+Monster::handleAttack(Being *victim, int damage)
+{
+ Being::handleAttack(victim, damage);
+
+ const MonsterInfo &mi = getInfo();
+ sound.playSfx(mi.getSound((damage > 0) ? EVENT_HIT : EVENT_MISS));
+}
+
+const MonsterInfo&
+Monster::getInfo() const
+{
+ return MonsterDB::get(mJob - 1002);
+}