summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-24 22:47:33 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-24 22:47:33 +0300
commitba2ad8131522e3bba0570580fdee3d5f3e0b7ffa (patch)
tree654ad26eb4212105ee64c9bd51e334eb05a22c2e /src/being/being.cpp
parent1d1ac3f13f96f0fa69fc57ea61af6e59d4e910a9 (diff)
downloadplus-ba2ad8131522e3bba0570580fdee3d5f3e0b7ffa.tar.gz
plus-ba2ad8131522e3bba0570580fdee3d5f3e0b7ffa.tar.bz2
plus-ba2ad8131522e3bba0570580fdee3d5f3e0b7ffa.tar.xz
plus-ba2ad8131522e3bba0570580fdee3d5f3e0b7ffa.zip
Add support for spirit balls effect.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 58fb9b2b7..ae0491372 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -200,6 +200,7 @@ Being::Being(const BeingId id,
mHorseInfo(nullptr),
mDownHorseSprites(),
mUpHorseSprites(),
+ mSpiritParticles(),
#endif
mX(0),
mY(0),
@@ -340,6 +341,9 @@ Being::~Being()
mPets.clear();
removeAllItemsParticles();
+#ifdef EATHENA_SUPPORT
+ mSpiritParticles.clear();
+#endif
}
void Being::createSpeechBubble()
@@ -4244,4 +4248,51 @@ void Being::setTrickDead(const bool b)
}
}
+void Being::setSpiritBalls(const unsigned int balls)
+{
+ if (!Particle::enabled)
+ {
+ mSpiritBalls = balls;
+ return;
+ }
+
+ if (balls > mSpiritBalls)
+ {
+ const int effectId = paths.getIntValue("spiritEffectId");
+ if (effectId != -1)
+ addSpiritBalls(balls - mSpiritBalls, effectId);
+ }
+ else if (balls < mSpiritBalls)
+ {
+ removeSpiritBalls(mSpiritBalls - balls);
+ }
+ mSpiritBalls = balls;
+}
+
+void Being::addSpiritBalls(const unsigned int balls,
+ const int effectId)
+{
+ if (!effectManager)
+ return;
+ for (unsigned int f = 0; f < balls; f ++)
+ {
+ Particle *const particle = effectManager->triggerReturn(
+ effectId,
+ this);
+ mSpiritParticles.push_back(particle);
+ }
+}
+
+void Being::removeSpiritBalls(const unsigned int balls)
+{
+ if (!particleEngine)
+ return;
+ for (unsigned int f = 0; f < balls && !mSpiritParticles.empty(); f ++)
+ {
+ Particle *const particle = mSpiritParticles.back();
+ mChildParticleEffects.removeLocally(particle);
+ mSpiritParticles.pop_back();
+ }
+}
+
#endif