From 8071fcbf88095bcaf54742062a4ebde87a801fd0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 9 Feb 2016 16:56:33 +0300 Subject: Allow select skill units and attack it. Also add key for select skill unit. --- src/actions/target.cpp | 9 +++++++++ src/actions/target.h | 1 + src/being/being.cpp | 8 +++++--- src/dyetool/actions/target.cpp | 1 + src/enums/input/inputaction.h | 1 + src/gui/viewport.cpp | 3 ++- src/input/inputactionmap.h | 6 ++++++ src/input/pages/basic.cpp | 6 ++++++ src/resources/db/skillunitdb.cpp | 4 ++-- 9 files changed, 33 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/actions/target.cpp b/src/actions/target.cpp index 7817ac8e5..f4a177b5d 100644 --- a/src/actions/target.cpp +++ b/src/actions/target.cpp @@ -67,6 +67,15 @@ impHandler0(targetMercenary) #endif } +impHandler0(targetSkillUnit) +{ +#ifdef EATHENA_SUPPORT + return setTarget(ActorType::SkillUnit, AllowSort_true); +#else + return false; +#endif +} + impHandler0(targetPet) { #ifdef EATHENA_SUPPORT diff --git a/src/actions/target.h b/src/actions/target.h index a1ca2e22b..954fcd195 100644 --- a/src/actions/target.h +++ b/src/actions/target.h @@ -33,6 +33,7 @@ namespace Actions decHandler(targetNPC); decHandler(targetMercenary); decHandler(targetPet); + decHandler(targetSkillUnit); decHandler(contextMenu); } // namespace Actions diff --git a/src/being/being.cpp b/src/being/being.cpp index 3edd7c70f..1f3a35844 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -699,9 +699,11 @@ void Being::takeDamage(Being *restrict const attacker, } else if (mType == ActorType::Monster #ifdef EATHENA_SUPPORT - || mType == ActorType::Mercenary - || mType == ActorType::Pet - || mType == ActorType::Homunculus + || + mType == ActorType::Mercenary || + mType == ActorType::Pet || + mType == ActorType::Homunculus || + mType == ActorType::SkillUnit #endif ) { diff --git a/src/dyetool/actions/target.cpp b/src/dyetool/actions/target.cpp index de77c4c73..952a93353 100644 --- a/src/dyetool/actions/target.cpp +++ b/src/dyetool/actions/target.cpp @@ -33,6 +33,7 @@ impHandlerVoid(targetClosestMonster) impHandlerVoid(targetNPC) impHandlerVoid(targetMercenary) impHandlerVoid(targetPet) +impHandlerVoid(targetSkillUnit) impHandlerVoid(contextMenu) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 68a11baa3..c35439497 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -625,6 +625,7 @@ enumStart(InputAction) RESET_MODIFIERS, BAR_TO_CHAT, SEEN, + TARGET_SKILL_UNIT, TOTAL } enumEnd(InputAction); diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index c7483b8a2..40f32457c 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -452,7 +452,8 @@ bool Viewport::leftMouseAction() } else if (!stopAttack && (type == ActorType::Monster || - type == ActorType::Npc)) + type == ActorType::Npc || + type == ActorType::SkillUnit)) { if ((localPlayer->withinAttackRange(mHoverBeing) || inputManager.isActionActive(InputAction::ATTACK))) diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 1bd74708d..a808a8208 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5239,6 +5239,12 @@ static const InputActionData inputActionData "seen|lastseen", UseArgs_true, Protected_true}, + {"keyTargetSkillUnit", + defaultAction(&Actions::targetSkillUnit), + InputCondition::INGAME | InputCondition::NOTARGET, + "targetskillunit|targetskill", + UseArgs_false, + Protected_false}, }; #undef defaultAction diff --git a/src/input/pages/basic.cpp b/src/input/pages/basic.cpp index d5c6f2a15..3817e34ac 100644 --- a/src/input/pages/basic.cpp +++ b/src/input/pages/basic.cpp @@ -131,6 +131,12 @@ SetupActionData setupActionDataBasic[] = InputAction::TARGET_MERCENARY, "", }, + { + // TRANSLATORS: input action name + N_("Target skill unit"), + InputAction::TARGET_SKILL_UNIT, + "", + }, { // TRANSLATORS: input action name N_("Change targeting type"), diff --git a/src/resources/db/skillunitdb.cpp b/src/resources/db/skillunitdb.cpp index c59f6f616..f77e3f3a2 100644 --- a/src/resources/db/skillunitdb.cpp +++ b/src/resources/db/skillunitdb.cpp @@ -101,9 +101,9 @@ void SkillUnitDb::loadXmlFile(const std::string &fileName) "name", _("skill"))); currentInfo->setTargetSelection(XML::getBoolProperty(skillUnitNode, - "targetSelection", false)); + "targetSelection", true)); - BeingCommon::readBasicAttributes(currentInfo, skillUnitNode, "talk"); + BeingCommon::readBasicAttributes(currentInfo, skillUnitNode, "attack"); currentInfo->setDeadSortOffsetY(XML::getProperty(skillUnitNode, "deadSortOffsetY", 31)); -- cgit v1.2.3-60-g2f50