summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-05 23:39:39 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-06 00:33:02 +0300
commitd8fca9f196ad59be5b211325ac2d70e29379e825 (patch)
treebb65fde6f734283be151b5d21c771f425d84ef3e /src/being.cpp
parent69b5220d914fb3b874622dcbf8e0fbd4fd73d1f7 (diff)
downloadplus-d8fca9f196ad59be5b211325ac2d70e29379e825.tar.gz
plus-d8fca9f196ad59be5b211325ac2d70e29379e825.tar.bz2
plus-d8fca9f196ad59be5b211325ac2d70e29379e825.tar.xz
plus-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.cpp29
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);
}
}