From 27d585c7db1395b5e4b2caa4149a99d57f9ffbff Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 23 Jul 2016 02:34:02 +0300 Subject: Add skill attacking src and dst effects. New skills attributes: srcEffectId, dstEffectId --- src/being/being.cpp | 3 +++ src/defaults.cpp | 2 ++ src/gui/windows/skilldialog.cpp | 29 +++++++++++++++++++++++++++++ src/gui/windows/skilldialog.h | 6 ++++++ src/resources/skill/skillinfo.cpp | 2 ++ src/resources/skill/skillinfo.h | 2 ++ 6 files changed, 44 insertions(+) (limited to 'src') diff --git a/src/being/being.cpp b/src/being/being.cpp index 0cf52c353..73b386467 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -1052,6 +1052,9 @@ void Being::handleSkill(Being *restrict const victim, if (data) fireMissile(victim, data->particle); + skillDialog->playSrcEffect(skillId, this); + skillDialog->playDstEffect(skillId, victim); + if (this != localPlayer && skill) { const SkillType::SkillType type = skill->type; diff --git a/src/defaults.cpp b/src/defaults.cpp index be736f48a..3dab5c6d1 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -523,6 +523,8 @@ DefaultsData* getPathsDefaults() AddDEF("completeQuestEffectId", -1); AddDEF("skillLevelUpEffectId", -1); AddDEF("skillRemoveEffectId", -1); + AddDEF("skillSrcEffectId", -1); + AddDEF("skillDstEffectId", -1); AddDEF("skillCastingSrcEffectId", -1); AddDEF("skillCastingDstEffectId", -1); AddDEF("skillCastingGroundEffectId", -1); diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 8dcc10e2d..966168464 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -385,6 +385,10 @@ SkillInfo *SkillDialog::loadSkill(XmlNodePtr node, 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, @@ -733,6 +737,31 @@ void SkillDialog::playCastingDstEffect(const int id, 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 x, diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h index b5baa35d6..bd66491e2 100644 --- a/src/gui/windows/skilldialog.h +++ b/src/gui/windows/skilldialog.h @@ -128,6 +128,12 @@ 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; diff --git a/src/resources/skill/skillinfo.cpp b/src/resources/skill/skillinfo.cpp index 9d71ffda7..3cae391e7 100644 --- a/src/resources/skill/skillinfo.cpp +++ b/src/resources/skill/skillinfo.cpp @@ -56,6 +56,8 @@ SkillInfo::SkillInfo() : 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 dc83a1a63..3e8b174df 100644 --- a/src/resources/skill/skillinfo.h +++ b/src/resources/skill/skillinfo.h @@ -67,6 +67,8 @@ struct SkillInfo final int cooldown; int castingSrcEffectId; int castingDstEffectId; + int srcEffectId; + int dstEffectId; SkillType::SkillType type; SkillOwner::Type owner; Modifiable modifiable; -- cgit v1.2.3-70-g09d2