diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-04-09 17:53:52 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-04-09 17:53:52 +0300 |
commit | 4fe5fd9a471760c8ce54c71c8cdf3f27c8fb27ae (patch) | |
tree | 4efae7d8e5ef3f60b5b8dd9231fa2770492908a0 /src | |
parent | 0de391b6566f347d546be4dc56999b3c502fa46b (diff) | |
download | manaverse-4fe5fd9a471760c8ce54c71c8cdf3f27c8fb27ae.tar.gz manaverse-4fe5fd9a471760c8ce54c71c8cdf3f27c8fb27ae.tar.bz2 manaverse-4fe5fd9a471760c8ce54c71c8cdf3f27c8fb27ae.tar.xz manaverse-4fe5fd9a471760c8ce54c71c8cdf3f27c8fb27ae.zip |
On skill attacks on target for show effect use skill attribute skillHitEffectId.
Diffstat (limited to 'src')
-rw-r--r-- | src/being/being.cpp | 28 | ||||
-rw-r--r-- | src/being/being.h | 10 | ||||
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 13 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.h | 3 | ||||
-rw-r--r-- | src/net/ea/beinghandler.cpp | 5 | ||||
-rw-r--r-- | src/net/eathena/beinghandler.cpp | 3 |
7 files changed, 51 insertions, 12 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index fbdd6fc79..71265d9ac 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -561,8 +561,11 @@ void Being::setSpeech(const std::string &text, const std::string &channel, } } -void Being::takeDamage(Being *const attacker, const int amount, - const AttackType::Type type, const int attackId) +void Being::takeDamage(Being *const attacker, + const int amount, + const AttackType::Type type, + const int attackId, + const int level) { if (!userPalette || !attacker) return; @@ -705,7 +708,10 @@ void Being::takeDamage(Being *const attacker, const int amount, if (effectManager) { - const int hitEffectId = getHitEffect(attacker, type, attackId); + const int hitEffectId = getHitEffect(attacker, + type, + attackId, + level); if (hitEffectId >= 0) effectManager->trigger(hitEffectId, this); } @@ -715,7 +721,9 @@ void Being::takeDamage(Being *const attacker, const int amount, if (effectManager) { const int hitEffectId = getHitEffect(attacker, - AttackType::MISS, attackId); + AttackType::MISS, + attackId, + level); if (hitEffectId >= 0) effectManager->trigger(hitEffectId, this); } @@ -724,7 +732,9 @@ void Being::takeDamage(Being *const attacker, const int amount, } int Being::getHitEffect(const Being *const attacker, - const AttackType::Type type, const int attackId) const + const AttackType::Type type, + const int attackId, + const int level) const { if (!effectManager) return 0; @@ -781,8 +791,14 @@ int Being::getHitEffect(const Being *const attacker, } else { - // move skills effects to +100000 in effects list hitEffectId = attackId + 100000; + SkillData *const data = skillDialog->getSkillDataByLevel( + attackId, level); + if (!data) + return -1; + hitEffectId = data->hitEffectId; + if (hitEffectId == -1) + hitEffectId = paths.getIntValue("skillHitEffectId"); } BLOCK_END("Being::getHitEffect") return hitEffectId; diff --git a/src/being/being.h b/src/being/being.h index 23afd549f..767f7f3cd 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -201,8 +201,11 @@ class Being notfinal : public ActorSprite, * @param type the attack type * @param id skill id */ - void takeDamage(Being *const attacker, const int damage, - const AttackType::Type type, const int attackId = 1); + void takeDamage(Being *const attacker, + const int damage, + const AttackType::Type type, + const int attackId = 1, + const int level = 1); /** * Handles an attack of another being by this being. @@ -805,7 +808,8 @@ class Being notfinal : public ActorSprite, int getHitEffect(const Being *const attacker, const AttackType::Type type, - const int attackId) const A_WARN_UNUSED; + const int attackId, + const int level) const A_WARN_UNUSED; Cursor::Cursor getHoverCursor() const A_WARN_UNUSED { return mInfo ? mInfo->getHoverCursor() : Cursor::CURSOR_POINTER; } diff --git a/src/defaults.cpp b/src/defaults.cpp index c0dce23ff..4e89d32ec 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -505,6 +505,7 @@ DefaultsData* getPathsDefaults() AddDEF("skillRemoveEffectId", -1); AddDEF("skillCastingSrcEffectId", -1); AddDEF("skillCastingDstEffectId", -1); + AddDEF("skillHitEffectId", -1); AddDEF("minimaps", "graphics/minimaps/"); AddDEF("maps", "maps/"); diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index a835666f3..2e2e69fa9 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -596,6 +596,19 @@ SkillData *SkillDialog::getSkillData(const int id) const return nullptr; } +SkillData *SkillDialog::getSkillDataByLevel(const int id, + const int level) const +{ + const SkillMap::const_iterator it = mSkills.find(id); + if (it != mSkills.end()) + { + SkillInfo *const info = it->second; + if (info) + return info->getData1(level); + } + return nullptr; +} + void SkillDialog::playUpdateEffect(const int id) const { if (!effectManager) diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h index 9388e96cb..7a55c691b 100644 --- a/src/gui/windows/skilldialog.h +++ b/src/gui/windows/skilldialog.h @@ -134,6 +134,9 @@ class SkillDialog final : public Window, SkillData *getSkillData(const int id) const; + SkillData *getSkillDataByLevel(const int id, + const int level) const; + private: void addSkillDuration(SkillInfo *const skill); diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index eeffe62f5..40ee477a0 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -162,7 +162,7 @@ void BeingHandler::processSkillDamage(Net::MessageIn &msg) if (srcBeing) srcBeing->handleSkill(dstBeing, param1, id, level); if (dstBeing) - dstBeing->takeDamage(srcBeing, param1, AttackType::SKILL, id); + dstBeing->takeDamage(srcBeing, param1, AttackType::SKILL, id, level); BLOCK_END("BeingHandler::processSkillDamage") } @@ -206,8 +206,9 @@ void BeingHandler::processBeingAction(Net::MessageIn &msg) } if (dstBeing) { + // level not present, using 1 dstBeing->takeDamage(srcBeing, param1, - static_cast<AttackType::Type>(type)); + static_cast<AttackType::Type>(type), 1); } break; diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 3f0ecf4ac..b0620b1f2 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -1306,8 +1306,9 @@ void BeingHandler::processBeingAction2(Net::MessageIn &msg) } if (dstBeing) { + // level not present, using 1 dstBeing->takeDamage(srcBeing, param1, - static_cast<AttackType::Type>(type)); + static_cast<AttackType::Type>(type), 1); } break; |