diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-07-23 03:12:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-07-23 03:12:38 +0300 |
commit | 871f05609ec03cad93773112c3324ba7b0488388 (patch) | |
tree | 3ec1d858a3d6a6a3a96b2ab954b41b01751b563e /src | |
parent | de2637f1e6211bb4a8b122b3aca53723a3440522 (diff) | |
download | plus-871f05609ec03cad93773112c3324ba7b0488388.tar.gz plus-871f05609ec03cad93773112c3324ba7b0488388.tar.bz2 plus-871f05609ec03cad93773112c3324ba7b0488388.tar.xz plus-871f05609ec03cad93773112c3324ba7b0488388.zip |
Allow skill source and destination particle effects depend on skill level.
Diffstat (limited to 'src')
-rw-r--r-- | src/being/being.cpp | 23 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 74 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.h | 13 | ||||
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 1 | ||||
-rw-r--r-- | src/resources/skill/skilldata.cpp | 6 | ||||
-rw-r--r-- | src/resources/skill/skilldata.h | 4 | ||||
-rw-r--r-- | src/resources/skill/skillinfo.cpp | 4 | ||||
-rw-r--r-- | src/resources/skill/skillinfo.h | 4 |
8 files changed, 40 insertions, 89 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 73b386467..53db29cff 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -1028,14 +1028,20 @@ void Being::handleSkillCasting(Being *restrict const victim, setAction(BeingAction::CAST, skillId); - skillDialog->playCastingSrcEffect(skillId, this); - skillDialog->playCastingDstEffect(skillId, victim); - const SkillData *restrict const data = skillDialog->getSkillDataByLevel( skillId, skillLevel); + if (data) + { + effectManager->triggerDefault(data->castingSrcEffectId, + this, + paths.getIntValue("skillCastingSrcEffectId")); + effectManager->triggerDefault(data->castingDstEffectId, + victim, + paths.getIntValue("skillCastingDstEffectId")); fireMissile(victim, data->castingParticle); + } } void Being::handleSkill(Being *restrict const victim, @@ -1050,10 +1056,15 @@ void Being::handleSkill(Being *restrict const victim, const SkillData *restrict const data = skill ? skill->getData1(skillLevel) : nullptr; if (data) + { + effectManager->triggerDefault(data->srcEffectId, + this, + paths.getIntValue("skillSrcEffectId")); + effectManager->triggerDefault(data->dstEffectId, + victim, + paths.getIntValue("skillDstEffectId")); fireMissile(victim, data->particle); - - skillDialog->playSrcEffect(skillId, this); - skillDialog->playDstEffect(skillId, victim); + } if (this != localPlayer && skill) { diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 966168464..02e67408d 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -381,14 +381,6 @@ SkillInfo *SkillDialog::loadSkill(XmlNodePtr node, node, "errorText", name); skill->alwaysVisible = fromBool(XML::getBoolProperty( node, "alwaysVisible", false), Visible); - skill->castingSrcEffectId = XML::getProperty( - node, "castingSrcEffectId", -1); - skill->castingDstEffectId = XML::getProperty( - node, "castingDstEffectId", -1); - skill->srcEffectId = XML::getProperty( - node, "srcEffectId", -1); - skill->dstEffectId = XML::getProperty( - node, "dstEffectId", -1); skill->castingAction = XML::getProperty(node, "castingAction", SpriteAction::CAST); skill->castingRideAction = XML::getProperty(node, @@ -468,6 +460,14 @@ void SkillDialog::loadSkillData(XmlNodePtr node, node, "hitEffectId", -1); data->missEffectId = XML::getProperty( node, "missEffectId", -1); + data->castingSrcEffectId = XML::getProperty( + node, "castingSrcEffectId", -1); + data->castingDstEffectId = XML::getProperty( + node, "castingDstEffectId", -1); + data->srcEffectId = XML::getProperty( + node, "srcEffectId", -1); + data->dstEffectId = XML::getProperty( + node, "dstEffectId", -1); skill->addData(level, data); } @@ -712,68 +712,18 @@ void SkillDialog::playRemoveEffect(const int id) const paths.getIntValue("skillRemoveEffectId")); } -void SkillDialog::playCastingSrcEffect(const int id, Being *const being) const -{ - if (!effectManager) - return; - SkillInfo *const info = getSkill(id); - if (!info) - return; - effectManager->triggerDefault(info->castingSrcEffectId, - being, - paths.getIntValue("skillCastingSrcEffectId")); -} - -void SkillDialog::playCastingDstEffect(const int id, - Being *const being) const -{ - if (!effectManager) - return; - SkillInfo *const info = getSkill(id); - if (!info) - return; - effectManager->triggerDefault(info->castingDstEffectId, - being, - paths.getIntValue("skillCastingDstEffectId")); -} - -void SkillDialog::playSrcEffect(const int id, - Being *const being) const -{ - if (!effectManager) - return; - SkillInfo *const info = getSkill(id); - if (!info) - return; - effectManager->triggerDefault(info->srcEffectId, - being, - paths.getIntValue("skillSrcEffectId")); -} - -void SkillDialog::playDstEffect(const int id, - Being *const being) const -{ - if (!effectManager) - return; - SkillInfo *const info = getSkill(id); - if (!info) - return; - effectManager->triggerDefault(info->dstEffectId, - being, - paths.getIntValue("skillDstEffectId")); -} - void SkillDialog::playCastingDstTileEffect(const int id, + const int level, const int x, const int y, const int delay) const { if (!effectManager) return; - SkillInfo *const info = getSkill(id); - if (!info) + SkillData *const data = getSkillDataByLevel(id, level); + if (!data) return; - effectManager->triggerDefault(info->castingDstEffectId, + effectManager->triggerDefault(data->castingDstEffectId, x * 32, y * 32, cur_time + delay / 1000, // end time in seconds diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h index bd66491e2..c322c6c0a 100644 --- a/src/gui/windows/skilldialog.h +++ b/src/gui/windows/skilldialog.h @@ -128,19 +128,8 @@ class SkillDialog final : public Window, void playRemoveEffect(const int id) const; - void playSrcEffect(const int id, - Being *const being) const; - - void playDstEffect(const int id, - Being *const being) const; - - void playCastingSrcEffect(const int id, - Being *const being) const; - - void playCastingDstEffect(const int id, - Being *const being) const; - void playCastingDstTileEffect(const int id, + const int level, const int x, const int y, const int delay) const; diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index 16a9f6fb8..cc16f4ad7 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -987,6 +987,7 @@ void BeingRecv::processSkillCastingContinue(Net::MessageIn &msg, if (srcBeing) srcBeing->setAction(BeingAction::CAST, skillId); skillDialog->playCastingDstTileEffect(skillId, + skillLevel, dstX, dstY, castTime); srcBeing->addCast(dstX, dstY, diff --git a/src/resources/skill/skilldata.cpp b/src/resources/skill/skilldata.cpp index fc42dc78d..74c7718a6 100644 --- a/src/resources/skill/skilldata.cpp +++ b/src/resources/skill/skilldata.cpp @@ -47,7 +47,11 @@ SkillData::SkillData() : updateEffectId(-1), removeEffectId(-1), hitEffectId(-1), - missEffectId(-1) + missEffectId(-1), + castingSrcEffectId(-1), + castingDstEffectId(-1), + srcEffectId(-1), + dstEffectId(-1) { } diff --git a/src/resources/skill/skilldata.h b/src/resources/skill/skilldata.h index a8c4e8ccd..016ba98cb 100644 --- a/src/resources/skill/skilldata.h +++ b/src/resources/skill/skilldata.h @@ -48,6 +48,10 @@ struct SkillData final int removeEffectId; int hitEffectId; int missEffectId; + int castingSrcEffectId; + int castingDstEffectId; + int srcEffectId; + int dstEffectId; SkillData(); A_DELETE_COPY(SkillData) diff --git a/src/resources/skill/skillinfo.cpp b/src/resources/skill/skillinfo.cpp index 3cae391e7..9c81219d5 100644 --- a/src/resources/skill/skillinfo.cpp +++ b/src/resources/skill/skillinfo.cpp @@ -54,10 +54,6 @@ SkillInfo::SkillInfo() : duration(0), durationTime(0), cooldown(0), - castingSrcEffectId(-1), - castingDstEffectId(-1), - srcEffectId(-1), - dstEffectId(-1), type(SkillType::Unknown), owner(SkillOwner::Player), modifiable(Modifiable_false), diff --git a/src/resources/skill/skillinfo.h b/src/resources/skill/skillinfo.h index 3e8b174df..a9554b1b9 100644 --- a/src/resources/skill/skillinfo.h +++ b/src/resources/skill/skillinfo.h @@ -65,10 +65,6 @@ struct SkillInfo final int duration; int durationTime; int cooldown; - int castingSrcEffectId; - int castingDstEffectId; - int srcEffectId; - int dstEffectId; SkillType::SkillType type; SkillOwner::Type owner; Modifiable modifiable; |