diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-05 23:39:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-06 00:33:02 +0300 |
commit | d8fca9f196ad59be5b211325ac2d70e29379e825 (patch) | |
tree | bb65fde6f734283be151b5d21c771f425d84ef3e /src/being.cpp | |
parent | 69b5220d914fb3b874622dcbf8e0fbd4fd73d1f7 (diff) | |
download | manaverse-d8fca9f196ad59be5b211325ac2d70e29379e825.tar.gz manaverse-d8fca9f196ad59be5b211325ac2d70e29379e825.tar.bz2 manaverse-d8fca9f196ad59be5b211325ac2d70e29379e825.tar.xz manaverse-d8fca9f196ad59be5b211325ac2d70e29379e825.zip |
Fix default particle effects in attacks.
Was broken in previous commits.
Also add default value for "effectId" in paths.xml (by default -1)
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/being.cpp b/src/being.cpp index 48c6cbe8b..89134bd0b 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -657,12 +657,26 @@ void Being::takeDamage(Being *const attacker, const int amount, const BeingInfo *const info = attacker->getInfo(); if (info) { - const Attack *attack = info->getAttack(attackId); - - if (type != CRITICAL) - hitEffectId = attack->mHitEffectId; + const Attack *atk = info->getAttack(attackId); + if (atk) + { + if (type != CRITICAL) + hitEffectId = atk->mHitEffectId; + else + hitEffectId = atk->mCriticalHitEffectId; + } else - hitEffectId = attack->mCriticalHitEffectId; + { + if (type != CRITICAL) + { + hitEffectId = paths.getIntValue("hitEffectId"); + } + else + { + hitEffectId = paths.getIntValue( + "criticalHitEffectId"); + } + } } } else @@ -678,7 +692,8 @@ void Being::takeDamage(Being *const attacker, const int amount, // move skills effects to +100000 in effects list hitEffectId = attackId + 100000; } - effectManager->trigger(hitEffectId, this); + if (effectManager && hitEffectId >= 0) + effectManager->trigger(hitEffectId, this); } } } @@ -1053,7 +1068,7 @@ void Being::setAction(const Action &action, const int attackId) default: break; } - if (effectManager) + if (effectManager && effectId >= 0) effectManager->trigger(effectId, this, rotation); } } |