| 1 |
/* |
| 2 |
* The Mana World |
| 3 |
* Copyright (C) 2008 The Mana World Development Team |
| 4 |
* |
| 5 |
* This file is part of The Mana World. |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
* any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program; if not, write to the Free Software |
| 19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef STATUS_EFFECT_H |
| 23 |
#define STATUS_EFFECT_H |
| 24 |
|
| 25 |
#include "resources/animation.h" |
| 26 |
#include "particle.h" |
| 27 |
#include "animatedsprite.h" |
| 28 |
#include "sound.h" |
| 29 |
|
| 30 |
class StatusEffect |
| 31 |
{ |
| 32 |
public: |
| 33 |
StatusEffect(); |
| 34 |
~StatusEffect(); |
| 35 |
|
| 36 |
/** |
| 37 |
* Plays the sound effect associated with this status effect, if possible. |
| 38 |
*/ |
| 39 |
void playSFX(); |
| 40 |
|
| 41 |
/** |
| 42 |
* Delivers the chat message associated with this status effect, if |
| 43 |
* possible. |
| 44 |
*/ |
| 45 |
void deliverMessage(); |
| 46 |
|
| 47 |
/** |
| 48 |
* Creates the particle effect associated with this status effect, if |
| 49 |
* possible. |
| 50 |
*/ |
| 51 |
Particle *getParticle(); |
| 52 |
|
| 53 |
/** |
| 54 |
* Retrieves the status icon for this effect, if applicable |
| 55 |
*/ |
| 56 |
AnimatedSprite *getIcon(); |
| 57 |
|
| 58 |
/** |
| 59 |
* Retrieves an action to perform, or ACTION_INVALID |
| 60 |
*/ |
| 61 |
SpriteAction getAction(); |
| 62 |
|
| 63 |
/** |
| 64 |
* Determines whether the particle effect should be restarted when the |
| 65 |
* being changes maps |
| 66 |
*/ |
| 67 |
bool particleEffectIsPersistent() const { return mPersistentParticleEffect; } |
| 68 |
|
| 69 |
|
| 70 |
/** |
| 71 |
* Retrieves a status effect. |
| 72 |
* |
| 73 |
* \param index Index of the status effect. |
| 74 |
* \param enabling Whether to retrieve the activating effect (true) or |
| 75 |
* the deactivating effect (false). |
| 76 |
*/ |
| 77 |
static StatusEffect *getStatusEffect(int index, bool enabling); |
| 78 |
|
| 79 |
/** |
| 80 |
* Retrieves a stun effect. |
| 81 |
* |
| 82 |
* \param index Index of the stun effect. |
| 83 |
* \param enabling Whether to retrieve the activating effect (true) or |
| 84 |
* the deactivating effect (false). |
| 85 |
*/ |
| 86 |
static StatusEffect *getStunEffect(int index, bool enabling); |
| 87 |
|
| 88 |
/** |
| 89 |
* Maps a block effect index to its corresponding effect index. Block |
| 90 |
* effect indices are used for opt2/opt3/status.option blocks; their |
| 91 |
* mapping to regular effect indices is handled in the config file. |
| 92 |
* |
| 93 |
* Returns -1 on failure. |
| 94 |
*/ |
| 95 |
static int blockEffectIndexToEffectIndex(int blocKIndex); |
| 96 |
|
| 97 |
static void load(); |
| 98 |
|
| 99 |
static void unload(); |
| 100 |
private: |
| 101 |
|
| 102 |
std::string mMessage; |
| 103 |
std::string mSFXEffect; |
| 104 |
std::string mParticleEffect; |
| 105 |
std::string mIcon; |
| 106 |
std::string mAction; |
| 107 |
bool mPersistentParticleEffect; |
| 108 |
}; |
| 109 |
|
| 110 |
#endif // !defined(STATUS_EFFECT_H) |