diff options
-rw-r--r-- | src/being/actorsprite.cpp | 5 | ||||
-rw-r--r-- | src/being/actorsprite.h | 7 | ||||
-rw-r--r-- | src/being/being.cpp | 56 | ||||
-rw-r--r-- | src/being/being.h | 4 | ||||
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/net/ea/beingrecv.cpp | 1 | ||||
-rw-r--r-- | src/statuseffect.cpp | 6 | ||||
-rw-r--r-- | src/statuseffect.h | 4 |
8 files changed, 78 insertions, 6 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index fa5301664..11099af01 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -75,7 +75,8 @@ ActorSprite::ActorSprite(const BeingId id) : mCursorPaddingY(0), mMustResetParticles(false), mPoison(false), - mHaveCart(false) + mHaveCart(false), + mTrickDead(false) { } @@ -240,6 +241,8 @@ void ActorSprite::updateStatusEffect(const int index, const Enable newStatus) setHaveCart(newStatus == Enable_true); else if (effect->isRiding()) setRiding(newStatus == Enable_true); + else if (effect->isTrickDead()) + setTrickDead(newStatus == Enable_true); handleStatusEffect(effect, index); } diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h index d5cb16613..76a4a53fc 100644 --- a/src/being/actorsprite.h +++ b/src/being/actorsprite.h @@ -179,6 +179,12 @@ class ActorSprite notfinal : public CompoundSprite, public Actor virtual void setRiding(const bool b) { mHorseId = b ? 1 : 0; } + virtual void setTrickDead(const bool b) + { mTrickDead = b; } + + bool isTrickDead() const A_WARN_UNUSED + { return mTrickDead; } + protected: /** * Notify self that the stun mode has been updated. Invoked by @@ -244,6 +250,7 @@ class ActorSprite notfinal : public CompoundSprite, public Actor bool mMustResetParticles; bool mPoison; bool mHaveCart; + bool mTrickDead; }; #endif // BEING_ACTORSPRITE_H diff --git a/src/being/being.cpp b/src/being/being.cpp index 4913d1b10..b21384a38 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -956,15 +956,21 @@ void Being::handleSkill(Being *const victim, const int damage, if (!victim || !mInfo || !skillDialog) return; - if (this != localPlayer) - setAction(BeingAction::ATTACK, 1); - const SkillInfo *const skill = skillDialog->getSkill(skillId); const SkillData *const data = skill ? skill->getData1(skillLevel) : nullptr; if (data) fireMissile(victim, data->particle); + if (this != localPlayer && skill) + { + const SkillType::SkillType type = skill->type; + if (type == SkillType::Attack || type == SkillType::Ground) + setAction(BeingAction::ATTACK, 1); + else + setAction(BeingAction::STAND, 1); + } + reset(); mActionTime = tick_time; @@ -1333,9 +1339,35 @@ std::string Being::getAttackAction(const Attack *const attack1) const } getSpriteAction(Dead, DEAD) -getSpriteAction(Stand, STAND) getSpriteAction(Spawn, SPAWN) +std::string Being::getStandAction() const +{ + if (mHorseId != 0) + return SpriteAction::STANDRIDE; + if (mMap) + { + const unsigned char mask = mMap->getBlockMask(mX, mY); + if (mTrickDead) + { + if (mask & BlockMask::AIR) + return SpriteAction::DEADSKY; + else if (mask & BlockMask::WATER) + return SpriteAction::DEADWATER; + else + return SpriteAction::DEAD; + } + else + { + if (mask & BlockMask::AIR) + return SpriteAction::STANDSKY; + else if (mask & BlockMask::WATER) + return SpriteAction::STANDWATER; + } + } + return SpriteAction::STAND; +} + void Being::setAction(const BeingActionT &action, const int attackId) { std::string currentAction = SpriteAction::INVALID; @@ -4107,4 +4139,20 @@ void Being::setHorse(const int horseId) mHorseInfo = nullptr; } } + +void Being::setTrickDead(const bool b) +{ + if (b != mTrickDead) + { + mTrickDead = b; + setAction(mAction, 0); + } +} + +void Being::serverRemove() +{ + // remove some flags what can survive player remove and next visible + mTrickDead = false; +} + #endif diff --git a/src/being/being.h b/src/being/being.h index d533570ca..11518a3c0 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -888,6 +888,8 @@ class Being notfinal : public ActorSprite, { return mLastAttackY; } #ifdef EATHENA_SUPPORT + void setTrickDead(const bool b) override final; + void setChat(ChatObject *const obj); ChatObject *getChat() const @@ -957,6 +959,8 @@ class Being notfinal : public ActorSprite, uint16_t getTeamId() const { return mTeamId; } + void serverRemove(); + protected: /** * Updates name's location. diff --git a/src/defaults.cpp b/src/defaults.cpp index a5d39d8fa..a53f708b8 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -609,6 +609,7 @@ DefaultsData* getPathsDefaults() AddDEF("poisonEffectName", "poison"); AddDEF("cartEffectName", "cart"); AddDEF("ridingEffectName", "riding"); + AddDEF("trickDeadEffectName", "trick dead"); AddDEF("gmTabMinimalLevel", "2"); AddDEF("team1badge", "team1.xml"); AddDEF("team2badge", "team2.xml"); diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp index a164706f0..599b43e6b 100644 --- a/src/net/ea/beingrecv.cpp +++ b/src/net/ea/beingrecv.cpp @@ -109,6 +109,7 @@ void BeingRecv::processBeingRemove(Net::MessageIn &msg) switch (type) { case 0: + dstBeing->serverRemove(); break; case 1: NotifyManager::notify( diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index 8090f8011..365887a90 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -48,7 +48,8 @@ StatusEffect::StatusEffect() : mPersistentParticleEffect(false), mIsPoison(false), mIsCart(false), - mIsRiding(false) + mIsRiding(false), + mIsTrickDead(false) { } @@ -204,6 +205,8 @@ void StatusEffect::loadXmlFile(const std::string &fileName) (name == paths.getStringValue("cartEffectName")); startEffect->mIsRiding = (name == paths.getStringValue("ridingEffectName")); + startEffect->mIsTrickDead = + (name == paths.getStringValue("trickDeadEffectName")); startEffect->mMessage = XML::getProperty( node, "start-message", ""); startEffect->mSFXEffect = XML::getProperty( @@ -219,6 +222,7 @@ void StatusEffect::loadXmlFile(const std::string &fileName) endEffect->mIsPoison = startEffect->mIsPoison; endEffect->mIsCart = startEffect->mIsCart; endEffect->mIsRiding = startEffect->mIsRiding; + endEffect->mIsTrickDead = startEffect->mIsTrickDead; endEffect->mMessage = XML::getProperty(node, "end-message", ""); endEffect->mSFXEffect = XML::getProperty(node, "end-audio", ""); endEffect->mParticleEffect = XML::getProperty( diff --git a/src/statuseffect.h b/src/statuseffect.h index 98ca18802..cb9641074 100644 --- a/src/statuseffect.h +++ b/src/statuseffect.h @@ -85,6 +85,9 @@ class StatusEffect final bool isRiding() const A_WARN_UNUSED { return mIsRiding; } + bool isTrickDead() const A_WARN_UNUSED + { return mIsTrickDead; } + /** * Retrieves a status effect. * @@ -135,6 +138,7 @@ class StatusEffect final bool mIsPoison; bool mIsCart; bool mIsRiding; + bool mIsTrickDead; }; #endif // STATUSEFFECT_H |