diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-10-31 21:21:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-10-31 21:21:37 +0300 |
commit | e8f29b1cff5360c9d16587b91d72863af4763d08 (patch) | |
tree | 19f69b1cda80609c2c040e4ad6340b84dfd96b2b /src/being/being.cpp | |
parent | 2ff2ea08e8d158961d4d38c06ba93c52b919026d (diff) | |
download | plus-e8f29b1cff5360c9d16587b91d72863af4763d08.tar.gz plus-e8f29b1cff5360c9d16587b91d72863af4763d08.tar.bz2 plus-e8f29b1cff5360c9d16587b91d72863af4763d08.tar.xz plus-e8f29b1cff5360c9d16587b91d72863af4763d08.zip |
Add support for dead trick status effect (hercules)
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r-- | src/being/being.cpp | 56 |
1 files changed, 52 insertions, 4 deletions
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 |