ManaPlus
Public Member Functions | Data Fields
StatusEffect Class Reference

#include <statuseffect.h>

Public Member Functions

 StatusEffect ()
 
 ~StatusEffect ()
 
void playSFX () const
 
void deliverMessage () const
 
ParticlegetStartParticle () const
 
ParticlegetParticle () const
 
AnimatedSpritegetIcon () const
 
std::string getAction () const
 

Data Fields

std::string mMessage
 
std::string mSFXEffect
 
std::string mStartParticleEffect
 
std::string mParticleEffect
 
std::string mIcon
 
std::string mAction
 
std::string mName
 
bool mIsPersistent
 
bool mIsPoison
 
bool mIsCart
 
bool mIsRiding
 
bool mIsTrickDead
 
bool mIsPostDelay
 

Detailed Description

Definition at line 33 of file statuseffect.h.

Constructor & Destructor Documentation

◆ StatusEffect()

StatusEffect::StatusEffect ( )

Definition at line 38 of file statuseffect.cpp.

38  :
39  mMessage(),
40  mSFXEffect(),
43  mIcon(),
44  mAction(),
45  mName(),
46  mIsPersistent(false),
47  mIsPoison(false),
48  mIsCart(false),
49  mIsRiding(false),
50  mIsTrickDead(false),
51  mIsPostDelay(false)
52 {
53 }
std::string mMessage
Definition: statuseffect.h:76
std::string mName
Definition: statuseffect.h:82
std::string mAction
Definition: statuseffect.h:81
std::string mParticleEffect
Definition: statuseffect.h:79
std::string mStartParticleEffect
Definition: statuseffect.h:78
std::string mSFXEffect
Definition: statuseffect.h:77
bool mIsPersistent
Definition: statuseffect.h:83
bool mIsTrickDead
Definition: statuseffect.h:87
bool mIsPostDelay
Definition: statuseffect.h:88
std::string mIcon
Definition: statuseffect.h:80

◆ ~StatusEffect()

StatusEffect::~StatusEffect ( )

Definition at line 55 of file statuseffect.cpp.

56 {
57 }

Member Function Documentation

◆ deliverMessage()

void StatusEffect::deliverMessage ( ) const

Delivers the chat message associated with this status effect, if possible.

Definition at line 65 of file statuseffect.cpp.

References ChatMsgType::BY_SERVER, ChatTab::chatLog(), localChatTab, and mMessage.

Referenced by LocalPlayer::handleStatusEffect().

66 {
67  if (!mMessage.empty() && (localChatTab != nullptr))
69 }
std::string mMessage
Definition: statuseffect.h:76
ChatTab * localChatTab
Definition: chattab.cpp:61
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord=IgnoreRecord_false, const TryRemoveColors tryRemoveColors=TryRemoveColors_true)
Definition: chattab.cpp:109

◆ getAction()

std::string StatusEffect::getAction ( ) const

Retrieves an action to perform, or SpriteAction::INVALID

Definition at line 95 of file statuseffect.cpp.

References SpriteAction::INVALID, and mAction.

96 {
97  if (mAction.empty())
98  return SpriteAction::INVALID;
99  return mAction;
100 }
std::string mAction
Definition: statuseffect.h:81
static const std::string INVALID
Definition: spriteaction.h:71

◆ getIcon()

AnimatedSprite * StatusEffect::getIcon ( ) const

Retrieves the status icon for this effect, if applicable

Definition at line 85 of file statuseffect.cpp.

References Configuration::getStringValue(), AnimatedSprite::load(), mIcon, pathJoin(), and paths.

Referenced by LocalPlayer::handleStatusEffect().

86 {
87  if (mIcon.empty())
88  {
89  return nullptr;
90  }
92  mIcon));
93 }
std::string getStringValue(const std::string &key) const
std::string pathJoin(std::string str1, const std::string &str2)
static AnimatedSprite * load(const std::string &filename, const int variant=0)
Configuration paths
std::string mIcon
Definition: statuseffect.h:80

◆ getParticle()

Particle * StatusEffect::getParticle ( ) const

Creates the particle effect associated with this status effect, if possible.

Definition at line 78 of file statuseffect.cpp.

References ParticleEngine::addEffect(), mParticleEffect, and particleEngine.

Referenced by ActorSprite::handleStatusEffect().

79 {
80  if (particleEngine == nullptr || mParticleEffect.empty())
81  return nullptr;
83 }
ParticleEngine * particleEngine
Particle * addEffect(const std::string &particleEffectFile, const int pixelX, const int pixelY, const int rotation=0)
std::string mParticleEffect
Definition: statuseffect.h:79

◆ getStartParticle()

Particle * StatusEffect::getStartParticle ( ) const

Creates the particle effect associated with this status effect, if possible.

Definition at line 71 of file statuseffect.cpp.

References ParticleEngine::addEffect(), mStartParticleEffect, and particleEngine.

Referenced by ActorSprite::handleStatusEffect().

72 {
73  if (particleEngine == nullptr || mStartParticleEffect.empty())
74  return nullptr;
76 }
ParticleEngine * particleEngine
Particle * addEffect(const std::string &particleEffectFile, const int pixelX, const int pixelY, const int rotation=0)
std::string mStartParticleEffect
Definition: statuseffect.h:78

◆ playSFX()

void StatusEffect::playSFX ( ) const

Plays the sound effect associated with this status effect, if possible.

Definition at line 59 of file statuseffect.cpp.

References mSFXEffect, SoundManager::playSfx(), and soundManager.

Referenced by LocalPlayer::handleStatusEffect().

60 {
61  if (!mSFXEffect.empty())
63 }
SoundManager soundManager
void playSfx(const std::string &path, const int x=0, const int y=0) const
std::string mSFXEffect
Definition: statuseffect.h:77

Field Documentation

◆ mAction

std::string StatusEffect::mAction

Definition at line 81 of file statuseffect.h.

Referenced by getAction(), and StatusEffectDB::loadXmlFile().

◆ mIcon

std::string StatusEffect::mIcon

Definition at line 80 of file statuseffect.h.

Referenced by getIcon(), and StatusEffectDB::loadXmlFile().

◆ mIsCart

bool StatusEffect::mIsCart

Definition at line 85 of file statuseffect.h.

Referenced by StatusEffectDB::loadXmlFile(), and ActorSprite::updateStatusEffect().

◆ mIsPersistent

bool StatusEffect::mIsPersistent

Definition at line 83 of file statuseffect.h.

Referenced by StatusEffectDB::loadXmlFile(), and ActorSprite::logic().

◆ mIsPoison

bool StatusEffect::mIsPoison

Definition at line 84 of file statuseffect.h.

Referenced by StatusEffectDB::loadXmlFile(), and ActorSprite::updateStatusEffect().

◆ mIsPostDelay

bool StatusEffect::mIsPostDelay

Definition at line 88 of file statuseffect.h.

Referenced by StatusEffectDB::loadXmlFile(), and ActorSprite::updateStatusEffect().

◆ mIsRiding

bool StatusEffect::mIsRiding

Definition at line 86 of file statuseffect.h.

Referenced by StatusEffectDB::loadXmlFile(), and ActorSprite::updateStatusEffect().

◆ mIsTrickDead

bool StatusEffect::mIsTrickDead

Definition at line 87 of file statuseffect.h.

Referenced by StatusEffectDB::loadXmlFile(), and ActorSprite::updateStatusEffect().

◆ mMessage

std::string StatusEffect::mMessage

Definition at line 76 of file statuseffect.h.

Referenced by deliverMessage(), and StatusEffectDB::loadXmlFile().

◆ mName

std::string StatusEffect::mName

◆ mParticleEffect

std::string StatusEffect::mParticleEffect

Definition at line 79 of file statuseffect.h.

Referenced by getParticle(), and StatusEffectDB::loadXmlFile().

◆ mSFXEffect

std::string StatusEffect::mSFXEffect

Definition at line 77 of file statuseffect.h.

Referenced by StatusEffectDB::loadXmlFile(), and playSFX().

◆ mStartParticleEffect

std::string StatusEffect::mStartParticleEffect

Definition at line 78 of file statuseffect.h.

Referenced by getStartParticle(), and StatusEffectDB::loadXmlFile().


The documentation for this class was generated from the following files: