diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-03-11 19:59:55 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-03-11 19:59:55 +0000 |
commit | fc63e88f869919a8b035a5c41db8d05626526bde (patch) | |
tree | 8f1928d082ebbffc549c712a3f406c2141f43e01 /src/monster.cpp | |
parent | 7b0f0ec315e66dcbdda58ada8b09a59bc5dcf6c9 (diff) | |
download | mana-fc63e88f869919a8b035a5c41db8d05626526bde.tar.gz mana-fc63e88f869919a8b035a5c41db8d05626526bde.tar.bz2 mana-fc63e88f869919a8b035a5c41db8d05626526bde.tar.xz mana-fc63e88f869919a8b035a5c41db8d05626526bde.zip |
Merged 0.0 changes from revision 3065 to 3177 to trunk.
Diffstat (limited to 'src/monster.cpp')
-rw-r--r-- | src/monster.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/monster.cpp b/src/monster.cpp index dd4a321c..bea5b7a5 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -57,11 +57,10 @@ Monster::setAction(Action 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: @@ -80,3 +79,22 @@ Monster::setAction(Action action) mAction = action; } } + +void +Monster::handleAttack() +{ + Being::handleAttack(); + + const MonsterInfo &mi = getInfo(); + + // TODO: It's not possible to determine hit or miss here, so this stuff probably needs + // to be moved somewhere else. We may lose synchronization between attack animation and + // the sound, unless we adapt the protocol... + sound.playSfx(mi.getSound(EVENT_HIT)); +} + +const MonsterInfo& +Monster::getInfo() const +{ + return MonsterDB::get(mJob - 1002); +} |