diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-04-09 18:57:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-04-09 18:57:45 +0300 |
commit | f5ccf6d55d650370ee85d92d9f2ed747ed41e200 (patch) | |
tree | 69e7bca54190b6cac6c2bbb60b4db19230875345 | |
parent | 4fe5fd9a471760c8ce54c71c8cdf3f27c8fb27ae (diff) | |
download | manaplus-f5ccf6d55d650370ee85d92d9f2ed747ed41e200.tar.gz manaplus-f5ccf6d55d650370ee85d92d9f2ed747ed41e200.tar.bz2 manaplus-f5ccf6d55d650370ee85d92d9f2ed747ed41e200.tar.xz manaplus-f5ccf6d55d650370ee85d92d9f2ed747ed41e200.zip |
Add to skills miss effect.
New skill attribute missEffectId.
-rw-r--r-- | src/being/being.cpp | 51 | ||||
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/enums/being/attacktype.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/skilldata.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/skilldata.h | 1 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 2 |
6 files changed, 43 insertions, 18 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 71265d9ac..6bb17ad4b 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -720,10 +720,21 @@ void Being::takeDamage(Being *const attacker, { if (effectManager) { - const int hitEffectId = getHitEffect(attacker, - AttackType::MISS, - attackId, - level); + int hitEffectId = -1; + if (type == AttackType::SKILL) + { + hitEffectId = getHitEffect(attacker, + AttackType::SKILLMISS, + attackId, + level); + } + else + { + hitEffectId = getHitEffect(attacker, + AttackType::MISS, + attackId, + level); + } if (hitEffectId >= 0) effectManager->trigger(hitEffectId, this); } @@ -743,7 +754,26 @@ int Being::getHitEffect(const Being *const attacker, // Init the particle effect path based on current // weapon or default. int hitEffectId = 0; - if (type != AttackType::SKILL) + if (type == AttackType::SKILL || type == AttackType::SKILLMISS) + { + SkillData *const data = skillDialog->getSkillDataByLevel( + attackId, level); + if (!data) + return -1; + if (type == AttackType::SKILL) + { + hitEffectId = data->hitEffectId; + if (hitEffectId == -1) + hitEffectId = paths.getIntValue("skillHitEffectId"); + } + else + { + hitEffectId = data->missEffectId; + if (hitEffectId == -1) + hitEffectId = paths.getIntValue("skillMissEffectId"); + } + } + else { if (attacker) { @@ -789,17 +819,6 @@ int Being::getHitEffect(const Being *const attacker, hitEffectId = getDefaultEffectId(type); } } - else - { - 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/defaults.cpp b/src/defaults.cpp index 4e89d32ec..39eae6711 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -506,6 +506,7 @@ DefaultsData* getPathsDefaults() AddDEF("skillCastingSrcEffectId", -1); AddDEF("skillCastingDstEffectId", -1); AddDEF("skillHitEffectId", -1); + AddDEF("skillMissEffectId", -1); AddDEF("minimaps", "graphics/minimaps/"); AddDEF("maps", "maps/"); diff --git a/src/enums/being/attacktype.h b/src/enums/being/attacktype.h index 02379e60a..d04f88ed9 100644 --- a/src/enums/being/attacktype.h +++ b/src/enums/being/attacktype.h @@ -40,7 +40,8 @@ namespace AttackType CRITICAL = 10, FLEE = 11, TOUCH_SKILL = 12, - MISS = 0xffff // pseudo value for miss attacks + MISS = 0xffff, // pseudo value for miss attacks + SKILLMISS // pseudo value for skill miss attacks }; } // namespace AttackType diff --git a/src/gui/widgets/skilldata.cpp b/src/gui/widgets/skilldata.cpp index 7accf214e..6137d768b 100644 --- a/src/gui/widgets/skilldata.cpp +++ b/src/gui/widgets/skilldata.cpp @@ -43,7 +43,8 @@ SkillData::SkillData() : soundMiss(std::string(), 0), updateEffectId(-1), removeEffectId(-1), - hitEffectId(-1) + hitEffectId(-1), + missEffectId(-1) { } diff --git a/src/gui/widgets/skilldata.h b/src/gui/widgets/skilldata.h index d374e7ec7..0317eccff 100644 --- a/src/gui/widgets/skilldata.h +++ b/src/gui/widgets/skilldata.h @@ -46,6 +46,7 @@ struct SkillData final int updateEffectId; int removeEffectId; int hitEffectId; + int missEffectId; SkillData(); A_DELETE_COPY(SkillData) diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 2e2e69fa9..2cf84c54c 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -376,6 +376,8 @@ void SkillDialog::loadXmlFile(const std::string &fileName) node, "removeEffectId", -1); data->hitEffectId = XML::getProperty( node, "hitEffectId", -1); + data->missEffectId = XML::getProperty( + node, "missEffectId", -1); skill->addData(level, data); } |