summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-04-29 01:21:45 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-04-30 15:59:52 +0200
commit8a67e721880959b431d220e2d1fd5b60a4f11ad7 (patch)
treee8383591a0cd3d4849309a6ab0fa1d67823f371c /src/being.cpp
parentfe87acd14acd2aa33c9b8a03a77d80d6a7648f1b (diff)
downloadmana-client-8a67e721880959b431d220e2d1fd5b60a4f11ad7.tar.gz
mana-client-8a67e721880959b431d220e2d1fd5b60a4f11ad7.tar.bz2
mana-client-8a67e721880959b431d220e2d1fd5b60a4f11ad7.tar.xz
mana-client-8a67e721880959b431d220e2d1fd5b60a4f11ad7.zip
Added customizable on-hit effects for characters.
This patch adds support for the following two parameters in weapon items: hit-effect-id: Effect triggered on the victim on normal hit. critical-hit-effect-id: Triggered on the victim on critical hit. (Specified in effects.xml) The patch also permits the use of custom defaults set in paths.xml by setting the following keys: (Paths are relative to the 'particles' key value, here.) hitEffectId: defaulted to effect id 26. criticalHitEffectId: defaulted to effect id 28. Resolves: Mana-mantis #337. Reviewed-by: bcs86
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 5911b03c..94ece475 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -389,10 +389,24 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
updateName();
}
- if (type != CRITICAL)
- effectManager->trigger(26, this);
+ // Init the particle effect path based on current weapon or default.
+ int hitEffectId = 0;
+ const ItemInfo *attackerWeapon = attacker->getEquippedWeapon();
+ if (attacker->getType() == PLAYER && attackerWeapon)
+ {
+ if (type != CRITICAL)
+ hitEffectId = attackerWeapon->getHitEffectId();
+ else
+ hitEffectId = attackerWeapon->getCriticalHitEffectId();
+ }
else
- effectManager->trigger(28, this);
+ {
+ if (type != CRITICAL)
+ hitEffectId = paths.getIntValue("hitEffectId");
+ else
+ hitEffectId = paths.getIntValue("criticalHitEffectId");
+ }
+ effectManager->trigger(hitEffectId, this);
}
}
@@ -405,7 +419,7 @@ void Being::handleAttack(Being *victim, int damage, AttackType type)
lookAt(victim->getPosition());
if (getType() == PLAYER && victim && mEquippedWeapon)
- fireMissile(victim, mEquippedWeapon->getMissileParticle());
+ fireMissile(victim, mEquippedWeapon->getMissileParticleFile());
else
fireMissile(victim, mInfo->getAttack(mAttackType)->missileParticle);