summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being/being.cpp51
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/enums/being/attacktype.h3
-rw-r--r--src/gui/widgets/skilldata.cpp3
-rw-r--r--src/gui/widgets/skilldata.h1
-rw-r--r--src/gui/windows/skilldialog.cpp2
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);
}