summaryrefslogtreecommitdiff
path: root/src/monster.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2008-10-13 09:34:46 +0000
committerIra Rice <irarice@gmail.com>2008-10-13 09:34:46 +0000
commita4d2f2c0373848fa8a886c1dddc6247b81527df3 (patch)
treeb4d0f0dcab4bd9ff06a4cd0613e26f61fffb45ce /src/monster.cpp
parent1c337aae30b334d99a5ec81269f2c6d35b8004ea (diff)
downloadmana-a4d2f2c0373848fa8a886c1dddc6247b81527df3.tar.gz
mana-a4d2f2c0373848fa8a886c1dddc6247b81527df3.tar.bz2
mana-a4d2f2c0373848fa8a886c1dddc6247b81527df3.tar.xz
mana-a4d2f2c0373848fa8a886c1dddc6247b81527df3.zip
Added mob particle attack effects to mobs. Inspired by the TMW patch in
their trunk client.
Diffstat (limited to 'src/monster.cpp')
-rw-r--r--src/monster.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/monster.cpp b/src/monster.cpp
index 2b6fadce..61f1f5c3 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -46,6 +46,7 @@ Monster::Monster(Uint32 id, Uint16 job, Map *map):
// Setup Monster sprites
int c = BASE_SPRITE;
+
const std::list<std::string> &sprites = info.getSprites();
for (std::list<std::string>::const_iterator i = sprites.begin();
i != sprites.end();
@@ -103,6 +104,8 @@ Being::Type Monster::getType() const
void Monster::setAction(Action action)
{
SpriteAction currentAction = ACTION_INVALID;
+ int rotation = 0;
+ std::string particleEffect;
switch (action)
{
@@ -116,6 +119,24 @@ void Monster::setAction(Action action)
case ATTACK:
currentAction = ACTION_ATTACK;
mSprites[BASE_SPRITE]->reset();
+
+ //attack particle effect
+ particleEffect = getInfo().getAttackParticleEffect();
+ if (particleEffect != "")
+ {
+ switch (mDirection)
+ {
+ case DOWN: rotation = 0; break;
+ case LEFT: rotation = 90; break;
+ case UP: rotation = 180; break;
+ case RIGHT: rotation = 270; break;
+ default: break;
+ }
+ Particle *p;
+ p = particleEngine->addEffect(
+ particleEffect, 0, 0, rotation);
+ controlParticle(p);
+ }
break;
case STAND:
currentAction = ACTION_STAND;