From e8f29b1cff5360c9d16587b91d72863af4763d08 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 31 Oct 2015 21:21:37 +0300 Subject: Add support for dead trick status effect (hercules) --- src/being/being.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 4 deletions(-) (limited to 'src/being/being.cpp') 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 -- cgit v1.2.3-70-g09d2