summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-05-02 16:56:22 +0300
committerAndrei Karas <akaras@inbox.ru>2011-05-02 16:56:41 +0300
commitbcb217f987a65fe4165caf55d96bd016933e9be6 (patch)
tree35fbc2ef8b5738b27ff7afe9287f3b6197bda868 /src
parent6ff97aad8bf4af8e1a69665b3ad414042efada02 (diff)
downloadmanaverse-bcb217f987a65fe4165caf55d96bd016933e9be6.tar.gz
manaverse-bcb217f987a65fe4165caf55d96bd016933e9be6.tar.bz2
manaverse-bcb217f987a65fe4165caf55d96bd016933e9be6.tar.xz
manaverse-bcb217f987a65fe4165caf55d96bd016933e9be6.zip
Save being speed in being object.
Diffstat (limited to 'src')
-rw-r--r--src/being.h7
-rw-r--r--src/net/tmwa/beinghandler.cpp24
2 files changed, 25 insertions, 6 deletions
diff --git a/src/being.h b/src/being.h
index c83d0fb48..1569d5df8 100644
--- a/src/being.h
+++ b/src/being.h
@@ -661,6 +661,12 @@ class Being : public ActorSprite, public ConfigListener
Uint8 calcDirection() const;
+ void setAttackDelay(int n)
+ { mAttackDelay = n; }
+
+ int getAttackDelay()
+ { return mAttackDelay; }
+
protected:
/**
* Sets the new path for this being.
@@ -783,6 +789,7 @@ class Being : public ActorSprite, public ConfigListener
bool mErased;
bool mEnemy;
std::string mIp;
+ int mAttackDelay;
unsigned int mPvpRank;
int *mSpriteRemap;
int *mSpriteHide;
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index adf49a734..7474eb66c 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -472,12 +472,13 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
break;
case SMSG_SKILL_DAMAGE:
+ {
msg.readInt16(); // Skill Id
srcBeing = actorSpriteManager->findBeing(msg.readInt32());
dstBeing = actorSpriteManager->findBeing(msg.readInt32());
msg.readInt32(); // Server tick
- msg.readInt32(); // src speed
- msg.readInt32(); // dst speed
+ int srcSpeed = msg.readInt32(); // src speed
+ int dstSpeed = msg.readInt32(); // dst speed
param1 = msg.readInt32(); // Damage
msg.readInt16(); // Skill level
msg.readInt16(); // Div
@@ -485,19 +486,26 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
if (dstBeing)
{
// Perhaps a new skill attack type should be created and used?
+ if (dstSpeed)
+ dstBeing->setAttackDelay(dstSpeed);
dstBeing->takeDamage(srcBeing, param1, Being::HIT);
}
if (srcBeing)
+ {
+ if (srcSpeed)
+ srcBeing->setAttackDelay(srcSpeed);
srcBeing->handleAttack(dstBeing, param1, Being::HIT);
+ }
break;
-
+ }
case SMSG_BEING_ACTION:
+ {
srcBeing = actorSpriteManager->findBeing(msg.readInt32());
dstBeing = actorSpriteManager->findBeing(msg.readInt32());
msg.readInt32(); // server tick
- msg.readInt32(); // src speed
- msg.readInt32(); // dst speed
+ int srcSpeed = msg.readInt32(); // src speed
+ int dstSpeed = msg.readInt32(); // dst speed
param1 = msg.readInt16();
msg.readInt16(); // param 2
type = msg.readInt8();
@@ -512,11 +520,15 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
case Being::FLEE: // Lucky Dodge
if (dstBeing)
{
+ if (dstSpeed)
+ dstBeing->setAttackDelay(dstSpeed);
dstBeing->takeDamage(srcBeing, param1,
static_cast<Being::AttackType>(type));
}
if (srcBeing)
{
+ if (srcSpeed)
+ srcBeing->setAttackDelay(srcSpeed);
srcBeing->handleAttack(dstBeing, param1,
static_cast<Being::AttackType>(type));
if (srcBeing->getType() == Being::PLAYER)
@@ -567,7 +579,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
*/
}
break;
-
+ }
case SMSG_BEING_SELFEFFECT:
{
if (!effectManager)