summaryrefslogtreecommitdiff
path: root/src/resources/monsterinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/monsterinfo.cpp')
-rw-r--r--src/resources/monsterinfo.cpp40
1 files changed, 32 insertions, 8 deletions
diff --git a/src/resources/monsterinfo.cpp b/src/resources/monsterinfo.cpp
index 0ee08e42..a7ad51a3 100644
--- a/src/resources/monsterinfo.cpp
+++ b/src/resources/monsterinfo.cpp
@@ -54,16 +54,15 @@ MonsterInfo::addSound(MonsterSoundEvent event, std::string filename)
}
-std::string
+const std::string &
MonsterInfo::getSound(MonsterSoundEvent event) const
{
+ static std::string nothing("");
std::map<MonsterSoundEvent, std::vector<std::string>* >::const_iterator i;
-
i = mSounds.find(event);
-
if (i == mSounds.end())
{
- return "";
+ return nothing;
}
else
{
@@ -74,14 +73,39 @@ MonsterInfo::getSound(MonsterSoundEvent event) const
const std::string &
MonsterInfo::getAttackParticleEffect(int attackType) const
{
- static std::string something("graphics/particles/attack.particle.xml");
static std::string nothing("");
-
- if (attackType > 1) return something; else return nothing;
+ std::map<int, MonsterAttack*>::const_iterator i;
+ i = mMonsterAttacks.find(attackType);
+ if (i == mMonsterAttacks.end())
+ {
+ return nothing;
+ }
+ else
+ {
+ return (*i).second->particleEffect;
+ }
}
SpriteAction
MonsterInfo::getAttackAction(int attackType) const
{
- return ACTION_ATTACK;
+ std::map<int, MonsterAttack*>::const_iterator i;
+ i = mMonsterAttacks.find(attackType);
+ if (i == mMonsterAttacks.end())
+ {
+ return ACTION_ATTACK;
+ }
+ else
+ {
+ return (*i).second->action;
+ }
+}
+
+void
+MonsterInfo::addMonsterAttack (int id, const std::string &particleEffect, SpriteAction action)
+{
+ MonsterAttack* a = new MonsterAttack;
+ a->particleEffect = particleEffect;
+ a->action = action;
+ mMonsterAttacks[id] = a;
}