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 34 of file statuseffect.h.

Constructor & Destructor Documentation

◆ StatusEffect()

StatusEffect::StatusEffect ( )

Definition at line 39 of file statuseffect.cpp.

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

◆ ~StatusEffect()

StatusEffect::~StatusEffect ( )

Definition at line 56 of file statuseffect.cpp.

57 {
58 }

Member Function Documentation

◆ deliverMessage()

void StatusEffect::deliverMessage ( ) const

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

Definition at line 66 of file statuseffect.cpp.

67 {
68  if (!mMessage.empty() &&
69  localChatTab != nullptr)
70  {
75  }
76 }
ChatTab * localChatTab
Definition: chattab.cpp:62
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
Definition: chattab.cpp:111
const bool IgnoreRecord_false
Definition: ignorerecord.h:30
const bool TryRemoveColors_true

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

Referenced by LocalPlayer::handleStatusEffect().

◆ getAction()

std::string StatusEffect::getAction ( ) const

Retrieves an action to perform, or SpriteAction::INVALID

Definition at line 103 of file statuseffect.cpp.

104 {
105  if (mAction.empty())
106  return SpriteAction::INVALID;
107  return mAction;
108 }
static const std::string INVALID
Definition: spriteaction.h:72

References SpriteAction::INVALID, and mAction.

◆ getIcon()

AnimatedSprite * StatusEffect::getIcon ( ) const

Retrieves the status icon for this effect, if applicable

Definition at line 92 of file statuseffect.cpp.

93 {
94  if (mIcon.empty())
95  {
96  return nullptr;
97  }
98  return AnimatedSprite::load(
99  pathJoin(paths.getStringValue("sprites"), mIcon),
100  0);
101 }
static AnimatedSprite * load(const std::string &filename, const int variant)
std::string getStringValue(const std::string &key) const
Configuration paths
std::string pathJoin(std::string str1, const std::string &str2)

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

Referenced by LocalPlayer::handleStatusEffect().

◆ getParticle()

Particle * StatusEffect::getParticle ( ) const

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

Definition at line 85 of file statuseffect.cpp.

86 {
87  if (particleEngine == nullptr || mParticleEffect.empty())
88  return nullptr;
89  return particleEngine->addEffect(mParticleEffect, 0, 0, 0);
90 }
Particle * addEffect(const std::string &particleEffectFile, const int pixelX, const int pixelY, const int rotation)
ParticleEngine * particleEngine

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

Referenced by ActorSprite::handleStatusEffect().

◆ getStartParticle()

Particle * StatusEffect::getStartParticle ( ) const

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

Definition at line 78 of file statuseffect.cpp.

79 {
80  if (particleEngine == nullptr || mStartParticleEffect.empty())
81  return nullptr;
83 }

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

Referenced by ActorSprite::handleStatusEffect().

◆ playSFX()

void StatusEffect::playSFX ( ) const

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

Definition at line 60 of file statuseffect.cpp.

61 {
62  if (!mSFXEffect.empty())
64 }
void playSfx(const std::string &path, const int x, const int y) const
SoundManager soundManager

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

Referenced by LocalPlayer::handleStatusEffect().

Field Documentation

◆ mAction

std::string StatusEffect::mAction

Definition at line 82 of file statuseffect.h.

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

◆ mIcon

std::string StatusEffect::mIcon

Definition at line 81 of file statuseffect.h.

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

◆ mIsCart

bool StatusEffect::mIsCart

Definition at line 86 of file statuseffect.h.

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

◆ mIsPersistent

bool StatusEffect::mIsPersistent

Definition at line 84 of file statuseffect.h.

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

◆ mIsPoison

bool StatusEffect::mIsPoison

Definition at line 85 of file statuseffect.h.

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

◆ mIsPostDelay

bool StatusEffect::mIsPostDelay

Definition at line 89 of file statuseffect.h.

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

◆ mIsRiding

bool StatusEffect::mIsRiding

Definition at line 87 of file statuseffect.h.

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

◆ mIsTrickDead

bool StatusEffect::mIsTrickDead

Definition at line 88 of file statuseffect.h.

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

◆ mMessage

std::string StatusEffect::mMessage

Definition at line 77 of file statuseffect.h.

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

◆ mName

std::string StatusEffect::mName

◆ mParticleEffect

std::string StatusEffect::mParticleEffect

Definition at line 80 of file statuseffect.h.

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

◆ mSFXEffect

std::string StatusEffect::mSFXEffect

Definition at line 78 of file statuseffect.h.

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

◆ mStartParticleEffect

std::string StatusEffect::mStartParticleEffect

Definition at line 79 of file statuseffect.h.

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


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