diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-06-04 00:50:23 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-06-07 18:51:22 +0200 |
commit | afa134640b2e2c7c0f28a54c8691545848795dd9 (patch) | |
tree | b8c9f03debebc9a15de2a21f4d4a377247615c1d /src/resources | |
parent | 9b1c970c70f30733d5d851b834a860365819409c (diff) | |
download | mana-afa134640b2e2c7c0f28a54c8691545848795dd9.tar.gz mana-afa134640b2e2c7c0f28a54c8691545848795dd9.tar.bz2 mana-afa134640b2e2c7c0f28a54c8691545848795dd9.tar.xz mana-afa134640b2e2c7c0f28a54c8691545848795dd9.zip |
Added hit effects on victims from monsters attacks.
Resolves: Mana-Mantis #336.
Reviewed-by: Jaxad0127.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/beinginfo.cpp | 7 | ||||
-rw-r--r-- | src/resources/beinginfo.h | 9 | ||||
-rw-r--r-- | src/resources/monsterdb.cpp | 13 |
3 files changed, 22 insertions, 7 deletions
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index 22651f6f..e6dc948e 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -90,17 +90,20 @@ const std::string &BeingInfo::getSound(SoundEvent event) const const Attack *BeingInfo::getAttack(int id) const { - static Attack *empty = new Attack(SpriteAction::ATTACK, -1, std::string()); + static Attack *empty = new Attack(SpriteAction::ATTACK, -1, -1, -1, + std::string()); Attacks::const_iterator i = mAttacks.find(id); return (i == mAttacks.end()) ? empty : (*i).second; } void BeingInfo::addAttack(int id, std::string action, int effectId, + int hitEffectId, int criticalHitEffectId, const std::string &missileParticleFilename) { if (mAttacks[id]) delete mAttacks[id]; - mAttacks[id] = new Attack(action, effectId, missileParticleFilename); + mAttacks[id] = new Attack(action, effectId, hitEffectId, + criticalHitEffectId, missileParticleFilename); } diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h index b4529b2f..fef698bb 100644 --- a/src/resources/beinginfo.h +++ b/src/resources/beinginfo.h @@ -33,14 +33,16 @@ struct Attack { std::string mAction; - int mEffectId; + int mEffectId, mHitEffectId, mCriticalHitEffectId; std::string mMissileParticleFilename; - Attack(std::string action, int effectId, - std::string missileParticleFilename) + Attack(std::string action, int effectId, int hitEffectId, + int criticalHitEffectId, std::string missileParticleFilename) { mAction = action; mEffectId = effectId; + mHitEffectId = hitEffectId; + mCriticalHitEffectId = criticalHitEffectId; mMissileParticleFilename = missileParticleFilename; } }; @@ -96,6 +98,7 @@ class BeingInfo const std::string &getSound(SoundEvent event) const; void addAttack(int id, std::string action, int effectId, + int hitEffectId, int criticalHitEffectId, const std::string &missileParticleFilename); const Attack *getAttack(int id) const; diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp index ca9b8e83..6d7fe9dc 100644 --- a/src/resources/monsterdb.cpp +++ b/src/resources/monsterdb.cpp @@ -125,12 +125,21 @@ void MonsterDB::load() { const int id = XML::getProperty(spriteNode, "id", 0); int effectId = XML::getProperty(spriteNode, "effect-id", -1); + int hitEffectId = + XML::getProperty(spriteNode, "hit-effect-id", + paths.getIntValue("hitEffectId")); + int criticalHitEffectId = + XML::getProperty(spriteNode, "critical-hit-effect-id", + paths.getIntValue("criticalHitEffectId")); + const std::string missileParticleFilename = + XML::getProperty(spriteNode, "missile-particle", ""); + const std::string spriteAction = XML::getProperty(spriteNode, "action", "attack"); - const std::string missileParticleFilename = - XML::getProperty(spriteNode, "missile-particle", ""); + currentInfo->addAttack(id, spriteAction, effectId, + hitEffectId, criticalHitEffectId, missileParticleFilename); } else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx")) |