summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-31 21:21:37 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-31 21:21:37 +0300
commite8f29b1cff5360c9d16587b91d72863af4763d08 (patch)
tree19f69b1cda80609c2c040e4ad6340b84dfd96b2b /src/being
parent2ff2ea08e8d158961d4d38c06ba93c52b919026d (diff)
downloadmv-e8f29b1cff5360c9d16587b91d72863af4763d08.tar.gz
mv-e8f29b1cff5360c9d16587b91d72863af4763d08.tar.bz2
mv-e8f29b1cff5360c9d16587b91d72863af4763d08.tar.xz
mv-e8f29b1cff5360c9d16587b91d72863af4763d08.zip
Add support for dead trick status effect (hercules)
Diffstat (limited to 'src/being')
-rw-r--r--src/being/actorsprite.cpp5
-rw-r--r--src/being/actorsprite.h7
-rw-r--r--src/being/being.cpp56
-rw-r--r--src/being/being.h4
4 files changed, 67 insertions, 5 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index fa5301664..11099af01 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -75,7 +75,8 @@ ActorSprite::ActorSprite(const BeingId id) :
mCursorPaddingY(0),
mMustResetParticles(false),
mPoison(false),
- mHaveCart(false)
+ mHaveCart(false),
+ mTrickDead(false)
{
}
@@ -240,6 +241,8 @@ void ActorSprite::updateStatusEffect(const int index, const Enable newStatus)
setHaveCart(newStatus == Enable_true);
else if (effect->isRiding())
setRiding(newStatus == Enable_true);
+ else if (effect->isTrickDead())
+ setTrickDead(newStatus == Enable_true);
handleStatusEffect(effect, index);
}
diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h
index d5cb16613..76a4a53fc 100644
--- a/src/being/actorsprite.h
+++ b/src/being/actorsprite.h
@@ -179,6 +179,12 @@ class ActorSprite notfinal : public CompoundSprite, public Actor
virtual void setRiding(const bool b)
{ mHorseId = b ? 1 : 0; }
+ virtual void setTrickDead(const bool b)
+ { mTrickDead = b; }
+
+ bool isTrickDead() const A_WARN_UNUSED
+ { return mTrickDead; }
+
protected:
/**
* Notify self that the stun mode has been updated. Invoked by
@@ -244,6 +250,7 @@ class ActorSprite notfinal : public CompoundSprite, public Actor
bool mMustResetParticles;
bool mPoison;
bool mHaveCart;
+ bool mTrickDead;
};
#endif // BEING_ACTORSPRITE_H
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 4913d1b10..b21384a38 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -956,15 +956,21 @@ void Being::handleSkill(Being *const victim, const int damage,
if (!victim || !mInfo || !skillDialog)
return;
- if (this != localPlayer)
- setAction(BeingAction::ATTACK, 1);
-
const SkillInfo *const skill = skillDialog->getSkill(skillId);
const SkillData *const data = skill
? skill->getData1(skillLevel) : nullptr;
if (data)
fireMissile(victim, data->particle);
+ if (this != localPlayer && skill)
+ {
+ const SkillType::SkillType type = skill->type;
+ if (type == SkillType::Attack || type == SkillType::Ground)
+ setAction(BeingAction::ATTACK, 1);
+ else
+ setAction(BeingAction::STAND, 1);
+ }
+
reset();
mActionTime = tick_time;
@@ -1333,9 +1339,35 @@ std::string Being::getAttackAction(const Attack *const attack1) const
}
getSpriteAction(Dead, DEAD)
-getSpriteAction(Stand, STAND)
getSpriteAction(Spawn, SPAWN)
+std::string Being::getStandAction() const
+{
+ if (mHorseId != 0)
+ return SpriteAction::STANDRIDE;
+ if (mMap)
+ {
+ const unsigned char mask = mMap->getBlockMask(mX, mY);
+ if (mTrickDead)
+ {
+ if (mask & BlockMask::AIR)
+ return SpriteAction::DEADSKY;
+ else if (mask & BlockMask::WATER)
+ return SpriteAction::DEADWATER;
+ else
+ return SpriteAction::DEAD;
+ }
+ else
+ {
+ if (mask & BlockMask::AIR)
+ return SpriteAction::STANDSKY;
+ else if (mask & BlockMask::WATER)
+ return SpriteAction::STANDWATER;
+ }
+ }
+ return SpriteAction::STAND;
+}
+
void Being::setAction(const BeingActionT &action, const int attackId)
{
std::string currentAction = SpriteAction::INVALID;
@@ -4107,4 +4139,20 @@ void Being::setHorse(const int horseId)
mHorseInfo = nullptr;
}
}
+
+void Being::setTrickDead(const bool b)
+{
+ if (b != mTrickDead)
+ {
+ mTrickDead = b;
+ setAction(mAction, 0);
+ }
+}
+
+void Being::serverRemove()
+{
+ // remove some flags what can survive player remove and next visible
+ mTrickDead = false;
+}
+
#endif
diff --git a/src/being/being.h b/src/being/being.h
index d533570ca..11518a3c0 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -888,6 +888,8 @@ class Being notfinal : public ActorSprite,
{ return mLastAttackY; }
#ifdef EATHENA_SUPPORT
+ void setTrickDead(const bool b) override final;
+
void setChat(ChatObject *const obj);
ChatObject *getChat() const
@@ -957,6 +959,8 @@ class Being notfinal : public ActorSprite,
uint16_t getTeamId() const
{ return mTeamId; }
+ void serverRemove();
+
protected:
/**
* Updates name's location.