summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-06 20:08:17 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-06 20:08:17 +0300
commit7014a04cb0989b0e182f8a1346d33b005e200ad5 (patch)
tree6913b1b116431beb48943fac677ea65c046ea414 /src/being
parentb796051dc7ec88e1982ffbb2e488e908d839c1ef (diff)
downloadplus-7014a04cb0989b0e182f8a1346d33b005e200ad5.tar.gz
plus-7014a04cb0989b0e182f8a1346d33b005e200ad5.tar.bz2
plus-7014a04cb0989b0e182f8a1346d33b005e200ad5.tar.xz
plus-7014a04cb0989b0e182f8a1346d33b005e200ad5.zip
Move attacktype into separate file.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp32
-rw-r--r--src/being/being.h26
2 files changed, 20 insertions, 38 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 1ef37c15a..1ca4cb700 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -554,7 +554,7 @@ void Being::setSpeech(const std::string &text, const std::string &channel,
}
void Being::takeDamage(Being *const attacker, const int amount,
- const AttackType type, const int attackId)
+ const AttackType::Type type, const int attackId)
{
if (!userPalette || !attacker)
return;
@@ -563,17 +563,17 @@ void Being::takeDamage(Being *const attacker, const int amount,
Font *font = nullptr;
// TRANSLATORS: hit or miss message in attacks
- const std::string damage = amount ? toString(amount) : type == FLEE ?
- _("dodge") : _("miss");
+ const std::string damage = amount ? toString(amount)
+ : type == AttackType::FLEE ? _("dodge") : _("miss");
const Color *color;
if (gui)
font = gui->getInfoParticleFont();
// Selecting the right color
- if (type == CRITICAL || type == FLEE)
+ if (type == AttackType::CRITICAL || type == AttackType::FLEE)
{
- if (type == CRITICAL)
+ if (type == AttackType::CRITICAL)
attacker->setCriticalHit(amount);
if (attacker == localPlayer)
@@ -655,7 +655,7 @@ void Being::takeDamage(Being *const attacker, const int amount,
BLOCK_END("Being::takeDamage1")
BLOCK_START("Being::takeDamage2")
- if (type != SKILL)
+ if (type != AttackType::SKILL)
attacker->updateHit(amount);
if (amount > 0)
@@ -707,7 +707,7 @@ void Being::takeDamage(Being *const attacker, const int amount,
if (effectManager)
{
const int hitEffectId = getHitEffect(attacker,
- MISS, attackId);
+ AttackType::MISS, attackId);
if (hitEffectId >= 0)
effectManager->trigger(hitEffectId, this);
}
@@ -716,7 +716,7 @@ void Being::takeDamage(Being *const attacker, const int amount,
}
int Being::getHitEffect(const Being *const attacker,
- const AttackType type, const int attackId) const
+ const AttackType::Type type, const int attackId) const
{
if (!effectManager)
return 0;
@@ -725,7 +725,7 @@ int Being::getHitEffect(const Being *const attacker,
// Init the particle effect path based on current
// weapon or default.
int hitEffectId = 0;
- if (type != SKILL)
+ if (type != AttackType::SKILL)
{
if (attacker)
{
@@ -733,9 +733,9 @@ int Being::getHitEffect(const Being *const attacker,
= attacker->getEquippedWeapon();
if (attackerWeapon && attacker->getType() == ActorType::Player)
{
- if (type == MISS)
+ if (type == AttackType::MISS)
hitEffectId = attackerWeapon->getMissEffectId();
- else if (type != CRITICAL)
+ else if (type != AttackType::CRITICAL)
hitEffectId = attackerWeapon->getHitEffectId();
else
hitEffectId = attackerWeapon->getCriticalHitEffectId();
@@ -748,9 +748,9 @@ int Being::getHitEffect(const Being *const attacker,
const Attack *const atk = info->getAttack(attackId);
if (atk)
{
- if (type == MISS)
+ if (type == AttackType::MISS)
hitEffectId = atk->mMissEffectId;
- else if (type != CRITICAL)
+ else if (type != AttackType::CRITICAL)
hitEffectId = atk->mHitEffectId;
else
hitEffectId = atk->mCriticalHitEffectId;
@@ -780,11 +780,11 @@ int Being::getHitEffect(const Being *const attacker,
return hitEffectId;
}
-int Being::getDefaultEffectId(const AttackType &type)
+int Being::getDefaultEffectId(const AttackType::Type &type)
{
- if (type == MISS)
+ if (type == AttackType::MISS)
return paths.getIntValue("missEffectId");
- else if (type != CRITICAL)
+ else if (type != AttackType::CRITICAL)
return paths.getIntValue("hitEffectId");
else
return paths.getIntValue("criticalHitEffectId");
diff --git a/src/being/being.h b/src/being/being.h
index 6b8a4dd52..fab70ff8f 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -29,6 +29,7 @@
#include "being/actorsprite.h"
+#include "enums/being/attacktype.h"
#include "enums/being/beingaction.h"
#include "enums/being/beingdirection.h"
#include "enums/being/gender.h"
@@ -90,25 +91,6 @@ class Being notfinal : public ActorSprite,
friend class BeingEquipBackend;
friend class LocalPlayer;
- enum AttackType
- {
- HIT = 0,
- PICKUP = 1,
- SIT = 2,
- STAND = 3,
- REFLECT = 4,
- SPLASH = 5,
- SKILL = 6,
- REPEATE = 7,
- MULTI = 8,
- MULTI_REFLECT = 9,
- CRITICAL = 10,
- FLEE = 11,
- TOUCH_SKILL = 12,
-// SKILL = 0xff,
- MISS = 0xffff // pseudo value for miss attacks
- };
-
enum Reachable
{
REACH_UNKNOWN = 0,
@@ -221,7 +203,7 @@ class Being notfinal : public ActorSprite,
* @param id skill id
*/
void takeDamage(Being *const attacker, const int damage,
- const AttackType type, const int attackId = 1);
+ const AttackType::Type type, const int attackId = 1);
/**
* Handles an attack of another being by this being.
@@ -823,7 +805,7 @@ class Being notfinal : public ActorSprite,
void recalcSpritesOrder();
int getHitEffect(const Being *const attacker,
- const AttackType type,
+ const AttackType::Type type,
const int attackId) const A_WARN_UNUSED;
Cursor::Cursor getHoverCursor() const A_WARN_UNUSED
@@ -942,7 +924,7 @@ class Being notfinal : public ActorSprite,
void createSpeechBubble();
- static int getDefaultEffectId(const AttackType &type);
+ static int getDefaultEffectId(const AttackType::Type &type);
BeingInfo *mInfo;
AnimatedSprite *mEmotionSprite;