summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being.cpp15
-rw-r--r--src/being.h2
-rw-r--r--src/gui/skilldialog.cpp8
-rw-r--r--src/gui/skilldialog.h2
-rw-r--r--src/net/ea/beinghandler.cpp4
5 files changed, 21 insertions, 10 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 6f530f9e8..09ec02389 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -762,7 +762,7 @@ void Being::handleAttack(Being *const victim, const int damage,
}
void Being::handleSkill(Being *const victim, const int damage,
- const int skillId)
+ const int skillId, const int skillLevel)
{
if (!victim || !mInfo || !skillDialog)
return;
@@ -770,9 +770,10 @@ void Being::handleSkill(Being *const victim, const int damage,
if (this != player_node)
setAction(Being::ATTACK, 1);
- const SkillInfo *const skill = skillDialog->getSkill(skillId);
- if (skill)
- fireMissile(victim, skill->data->particle);
+ SkillInfo *const skill = skillDialog->getSkill(skillId);
+ const SkillData *const data = skill ? skill->getData1(skillLevel) : nullptr;
+ if (data)
+ fireMissile(victim, data->particle);
#ifdef MANASERV_SUPPORT
if (Net::getNetworkType() != ServerInfo::MANASERV)
@@ -792,12 +793,12 @@ void Being::handleSkill(Being *const victim, const int damage,
if (damage && victim->mType == PLAYER && victim->mAction == SIT)
victim->setAction(STAND);
- if (skill)
+ if (data)
{
if (damage > 0)
- sound.playSfx(skill->data->soundHit, mX, mY);
+ sound.playSfx(data->soundHit, mX, mY);
else
- sound.playSfx(skill->data->soundMiss, mX, mY);
+ sound.playSfx(data->soundMiss, mX, mY);
}
else
{
diff --git a/src/being.h b/src/being.h
index 8005881ca..c8abf988f 100644
--- a/src/being.h
+++ b/src/being.h
@@ -277,7 +277,7 @@ class Being : public ActorSprite, public ConfigListener
const int attackId = 1);
virtual void handleSkill(Being *const victim, const int damage,
- const int skillId);
+ const int skillId, const int skillLevel);
const ItemInfo *getEquippedWeapon() const A_WARN_UNUSED
{ return mEquippedWeapon; }
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 992877671..ee2834a35 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -727,6 +727,14 @@ SkillData *SkillInfo::getData(const int l)
return (*it).second;
}
+SkillData *SkillInfo::getData1(const int l)
+{
+ SkillDataMapIter it = dataMap.find(l);
+ if (it == dataMap.end())
+ return dataMap[0];
+ return (*it).second;
+}
+
SkillData::SkillData() :
icon(nullptr)
{
diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h
index 3cfff0c84..7ca8b942a 100644
--- a/src/gui/skilldialog.h
+++ b/src/gui/skilldialog.h
@@ -92,6 +92,8 @@ struct SkillInfo final
SkillData *getData(const int level);
+ SkillData *getData1(const int level);
+
void addData(const int level, SkillData *const data);
};
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index bb7b7bc67..5df1ce823 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -460,7 +460,7 @@ void BeingHandler::processSkillDamage(Net::MessageIn &msg)
msg.readInt32(); // src speed
msg.readInt32(); // dst speed
param1 = msg.readInt32(); // Damage
- msg.readInt16(); // Skill level
+ const int level = msg.readInt16(); // Skill level
msg.readInt16(); // Div
msg.readInt8(); // Skill hit/type (?)
if (dstBeing)
@@ -474,7 +474,7 @@ void BeingHandler::processSkillDamage(Net::MessageIn &msg)
// if (srcSpeed)
// srcBeing->setAttackDelay(srcSpeed);
// srcBeing->handleAttack(dstBeing, param1, Being::HIT);
- srcBeing->handleSkill(dstBeing, param1, id);
+ srcBeing->handleSkill(dstBeing, param1, id, level);
}
}