From d8fca9f196ad59be5b211325ac2d70e29379e825 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 5 Oct 2012 23:39:39 +0300 Subject: Fix default particle effects in attacks. Was broken in previous commits. Also add default value for "effectId" in paths.xml (by default -1) --- src/being.cpp | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src/being.cpp') 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); } } -- cgit v1.2.3-60-g2f50