summaryrefslogtreecommitdiff
path: root/src/monster.cpp
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2010-02-10 23:46:49 -0500
committerChuck Miller <shadowmil@gmail.com>2010-02-10 23:50:23 -0500
commit85e7f2a79477712bf3082cb82e6a73c51361abb0 (patch)
treec8a42adb06e0c5ba416bd30fcd1808c1e4f26ddc /src/monster.cpp
parent3a761a242436e521c7fa8ef3746551ac7b746308 (diff)
downloadmana-client-85e7f2a79477712bf3082cb82e6a73c51361abb0.tar.gz
mana-client-85e7f2a79477712bf3082cb82e6a73c51361abb0.tar.bz2
mana-client-85e7f2a79477712bf3082cb82e6a73c51361abb0.tar.xz
mana-client-85e7f2a79477712bf3082cb82e6a73c51361abb0.zip
Adds missile-particle attribute to items and monster attacks
To use simply add something like: missile-particle="graphics/particles/arrow.particle.xml" to the item's or monster's xml entry This will only work on equipped weapons, and on specified monster attacks. This patch also fixes a memory leak with target particles
Diffstat (limited to 'src/monster.cpp')
-rw-r--r--src/monster.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/monster.cpp b/src/monster.cpp
index 0d0757dd..45af468e 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -35,7 +35,8 @@
#include "resources/monsterinfo.h"
Monster::Monster(int id, int job, Map *map):
- Being(id, job, map)
+ Being(id, job, map),
+ mAttackType(1)
{
const MonsterInfo& info = getInfo();
@@ -100,6 +101,7 @@ void Monster::setAction(Action action, int attackType)
sound.playSfx(getInfo().getSound(MONSTER_EVENT_DIE));
break;
case ATTACK:
+ mAttackType = attackType;
currentAction = getInfo().getAttackAction(attackType);
for (SpriteIterator it = mSprites.begin(); it != mSprites.end(); it++)
(*it)->reset();
@@ -148,6 +150,8 @@ void Monster::handleAttack(Being *victim, int damage, AttackType type)
const MonsterInfo &mi = getInfo();
sound.playSfx(mi.getSound((damage > 0) ?
MONSTER_EVENT_HIT : MONSTER_EVENT_MISS));
+
+ fireMissile(victim, mi.getAttackMissileParticle(mAttackType));
}
void Monster::takeDamage(Being *attacker, int amount, AttackType type)