From 15424641cca695650f4b56c37711c12c81cf2c32 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 14 Nov 2015 17:25:37 +0300 Subject: Add cast action to beings. --- src/being/being.cpp | 4 ++++ src/being/being.h | 2 ++ src/enums/being/beingaction.h | 1 + src/net/eathena/beingrecv.cpp | 7 +++++-- src/resources/spriteaction.h | 4 ++++ src/resources/spritedef.cpp | 4 ++++ 6 files changed, 20 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/being/being.cpp b/src/being/being.cpp index b4ea52df1..dd06c918d 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -1358,6 +1358,7 @@ std::string Being::getAttackAction(const Attack *const attack1) const getSpriteAction(Dead, DEAD) getSpriteAction(Spawn, SPAWN) +getSpriteAction(Cast, CAST) std::string Being::getStandAction() const { @@ -1442,6 +1443,9 @@ void Being::setAction(const BeingActionT &action, const int attackId) } } break; + case BeingAction::CAST: + currentAction = getCastAction(); + break; case BeingAction::HURT: if (mInfo) { diff --git a/src/being/being.h b/src/being/being.h index 11518a3c0..9c9fd6ade 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -597,6 +597,8 @@ class Being notfinal : public ActorSprite, */ std::string getSitAction() const A_WARN_UNUSED; + std::string getCastAction() const A_WARN_UNUSED; + std::string getMoveAction() const A_WARN_UNUSED; std::string getDeadAction() const A_WARN_UNUSED; diff --git a/src/enums/being/beingaction.h b/src/enums/being/beingaction.h index 51b3e4e2d..16ebe48c1 100644 --- a/src/enums/being/beingaction.h +++ b/src/enums/being/beingaction.h @@ -30,6 +30,7 @@ enumStart(BeingAction) STAND = 0, MOVE, ATTACK, + CAST, SIT, DEAD, HURT, diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index f80b16c54..836fdfc37 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -758,8 +758,6 @@ void BeingRecv::processMapType(Net::MessageIn &msg) void BeingRecv::processSkillCasting(Net::MessageIn &msg) { - // +++ need use other parameters - const BeingId srcId = msg.readBeingId("src id"); const BeingId dstId = msg.readBeingId("dst id"); const int dstX = msg.readInt16("dst x"); @@ -781,11 +779,16 @@ void BeingRecv::processSkillCasting(Net::MessageIn &msg) { // being to being Being *const srcBeing = actorManager->findBeing(srcId); Being *const dstBeing = actorManager->findBeing(dstId); + if (srcBeing) + srcBeing->setAction(BeingAction::CAST, skillId); skillDialog->playCastingSrcEffect(skillId, srcBeing); skillDialog->playCastingDstEffect(skillId, dstBeing); } else if (dstX != 0 || dstY != 0) { // being to position + Being *const srcBeing = actorManager->findBeing(srcId); + if (srcBeing) + srcBeing->setAction(BeingAction::CAST, skillId); skillDialog->playCastingDstTileEffect(skillId, dstX, dstY, castTime); diff --git a/src/resources/spriteaction.h b/src/resources/spriteaction.h index 61967f155..b39c1e96d 100644 --- a/src/resources/spriteaction.h +++ b/src/resources/spriteaction.h @@ -44,6 +44,7 @@ namespace SpriteAction static const std::string MOVE("walk"); static const std::string ATTACK("attack"); static const std::string SPAWN("spawn"); + static const std::string CAST("cast"); static const std::string FLY("fly"); static const std::string SWIM("swim"); @@ -57,6 +58,9 @@ namespace SpriteAction static const std::string ATTACKSKY("attacksky"); static const std::string ATTACKWATER("attackwater"); static const std::string ATTACKRIDE("attackride"); + static const std::string CASTSKY("castsky"); + static const std::string CASTWATER("castwater"); + static const std::string CASTRIDE("castride"); static const std::string SPAWNSKY("spawnsky"); static const std::string SPAWNWATER("spawnwater"); static const std::string SPAWNRIDE("spawnride"); diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index 9930f58b9..8626a9e6e 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -157,6 +157,7 @@ void SpriteDef::substituteActions() substituteAction(SpriteAction::STAND, SpriteAction::DEFAULT); substituteAction(SpriteAction::MOVE, SpriteAction::STAND); substituteAction(SpriteAction::ATTACK, SpriteAction::STAND); + substituteAction(SpriteAction::CAST, SpriteAction::ATTACK); substituteAction(SpriteAction::SIT, SpriteAction::STAND); substituteAction(SpriteAction::SITTOP, SpriteAction::SIT); substituteAction(SpriteAction::DEAD, SpriteAction::STAND); @@ -173,6 +174,9 @@ void SpriteDef::substituteActions() substituteAction(SpriteAction::ATTACKSKY, SpriteAction::ATTACK); substituteAction(SpriteAction::ATTACKWATER, SpriteAction::ATTACK); substituteAction(SpriteAction::ATTACKRIDE, SpriteAction::ATTACK); + substituteAction(SpriteAction::CASTSKY, SpriteAction::CAST); + substituteAction(SpriteAction::CASTWATER, SpriteAction::CAST); + substituteAction(SpriteAction::CASTRIDE, SpriteAction::CAST); substituteAction(SpriteAction::SPAWNSKY, SpriteAction::SPAWN); substituteAction(SpriteAction::SPAWNWATER, SpriteAction::SPAWN); substituteAction(SpriteAction::SPAWNRIDE, SpriteAction::SPAWN); -- cgit v1.2.3-70-g09d2