summaryrefslogtreecommitdiff
path: root/src/game-server/autoattack.h
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-09-28 23:39:01 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-09-28 23:39:01 +0200
commit77ea3d90114a7d6503d19e89ffaf2e548f63e420 (patch)
treef92edc2775fde07a7b9df4ccf7c8f70f436c2c13 /src/game-server/autoattack.h
parent60b44b8efa96d318fb22077011f2ccb5d2f03104 (diff)
downloadmanaserv-77ea3d90114a7d6503d19e89ffaf2e548f63e420.tar.gz
manaserv-77ea3d90114a7d6503d19e89ffaf2e548f63e420.tar.bz2
manaserv-77ea3d90114a7d6503d19e89ffaf2e548f63e420.tar.xz
manaserv-77ea3d90114a7d6503d19e89ffaf2e548f63e420.zip
Started to fix the autoattack system.
I simply made the default autoattack look for the default skill and add exp to it when killing monsters. Now the player can earn xp again even if it's not well handled between two logins.
Diffstat (limited to 'src/game-server/autoattack.h')
-rw-r--r--src/game-server/autoattack.h48
1 files changed, 20 insertions, 28 deletions
diff --git a/src/game-server/autoattack.h b/src/game-server/autoattack.h
index 2e891fa9..5995d248 100644
--- a/src/game-server/autoattack.h
+++ b/src/game-server/autoattack.h
@@ -23,18 +23,8 @@
#include <cstddef>
#include <list>
-#include <limits>
-/**
- * Methods of damage calculation
- */
-enum DamageType
-{
- DAMAGE_PHYSICAL = 0,
- DAMAGE_MAGICAL,
- DAMAGE_DIRECT,
- DAMAGE_OTHER = -1
-};
+#include "common/defines.h"
/**
* Structure that describes the severity and nature of an attack a being can
@@ -42,28 +32,30 @@ enum DamageType
*/
struct Damage
{
+ unsigned int skill; /**< Skill used by source (needed for exp calculation) */
unsigned short base; /**< Base amount of damage. */
unsigned short delta; /**< Additional damage when lucky. */
unsigned short cth; /**< Chance to hit. Opposes the evade attribute. */
unsigned char element; /**< Elemental damage. */
DamageType type; /**< Damage type: Physical or magical? */
- unsigned trueStrike : 1; /**< Override dodge calculation */
- std::list<size_t> usedSkills; /**< Skills used by source (needed for exp calculation) */
- unsigned short range; /**< Maximum distance that this attack can be used from */
+ bool trueStrike; /**< Override dodge calculation */
+ unsigned short range; /**< Maximum distance that this attack can be used from, in pixels */
- Damage(unsigned short base,
+ Damage(unsigned int skill,
+ unsigned short base,
unsigned short delta,
unsigned short cth,
unsigned char element,
DamageType type = DAMAGE_OTHER,
- unsigned short range = std::numeric_limits<unsigned short>::max())
- : base(base)
- , delta(delta)
- , cth(cth)
- , element(element)
- , type(type)
- , trueStrike(false)
- , range(range)
+ unsigned short range = DEFAULT_TILE_LENGTH):
+ skill(skill),
+ base(base),
+ delta(delta),
+ cth(cth),
+ element(element),
+ type(type),
+ trueStrike(false),
+ range(range)
{}
};
@@ -74,11 +66,11 @@ struct Damage
class AutoAttack
{
public:
- AutoAttack(Damage &damage, unsigned int delay, unsigned int warmup)
- : mDamage(damage)
- , mTimer(0)
- , mAspd(delay)
- , mWarmup(warmup && warmup < delay ? warmup : delay >> 2)
+ AutoAttack(Damage &damage, unsigned int warmup, unsigned int cooldown):
+ mDamage(damage),
+ mTimer(0),
+ mAspd(cooldown),
+ mWarmup(warmup && warmup < cooldown ? warmup : cooldown >> 2)
{}
unsigned short getTimer() const { return mTimer; }