summaryrefslogtreecommitdiff
path: root/src/game-server/being.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game-server/being.hpp')
-rw-r--r--src/game-server/being.hpp99
1 files changed, 31 insertions, 68 deletions
diff --git a/src/game-server/being.hpp b/src/game-server/being.hpp
index a245f617..cd613376 100644
--- a/src/game-server/being.hpp
+++ b/src/game-server/being.hpp
@@ -38,14 +38,7 @@ class MapComposite;
*/
enum
{
- ATT_HP_MAXIMUM = NB_BASE_ATTRIBUTES,
- ATT_PHYSICAL_ATTACK_MINIMUM,
- ATT_PHYSICAL_ATTACK_FLUCTUATION,
- ATT_PHYSICAL_DEFENCE,
- ATT_MAGIC,
- ATT_ACCURACY,
- ATT_SPEED,
- NB_COMPOUND_ATTRIBUTES
+
};
/**
@@ -92,25 +85,26 @@ enum Damagetype
struct Damage
{
int value;
- int penetration;
+ int piercing;
Element element;
Damagetype type;
Being *source;
};
/**
- * Type definition for a list of hits
+ * Structure that holds weapon stats that are relevant for damage calculation
*/
-typedef std::list<unsigned int> Hits;
+struct WeaponStats
+{
+ int piercing;
+ Element element;
+ int skill;
+};
/**
- * Structures for storing the attribute modifiers of a Being.
+ * Type definition for a list of hits
*/
-struct BeingModificators
-{
- std::vector<short> absoluteModificator;
- std::vector< std::list<short> > percentModificators;
-};
+typedef std::list<unsigned int> Hits;
/**
@@ -143,44 +137,16 @@ class Being : public MovingObject
~Being();
/**
- * Adds a fixed value stat modifier
- */
- void addAbsoluteStatModifier(int attributeNumber, short value);
-
- /**
- * Removes a fixed value stat modifier
- */
- void removeAbsoluteStatModifier(int attributeNumber, short value);
-
- /**
- * Adds a multiplier stat modificator in percent
- */
- void addPercentStatModifier(int attributeNumber, short value);
-
- /**
- * Removes a previously added percent stat modifier.
- * Does nothing and logs a warning when no modifier with the same
- * value has been added before.
- */
- void removePercentStatModifier(int attributeNumber, short value);
-
- /**
- * Returns a specific compound attribute of a being.
- */
- unsigned short getCompoundAttribute(int attributeNumber)
- { return mCompoundAttributes[attributeNumber]; }
-
- /**
* Creates a damage structure for a normal melee attack based on the
* current being stats and equipment.
*/
Damage getPhysicalAttackDamage();
/**
- * sets the hit points
+ * Sets the hit points to maximum
*/
- void setHitpoints(unsigned hp)
- { mHitpoints = hp; }
+ void fillHitpoints()
+ { mHitpoints = getAttribute(DERIVED_ATTR_HP_MAXIMUM); }
/**
* Takes a damage structure, computes the real damage based on the
@@ -228,44 +194,41 @@ class Being : public MovingObject
virtual void move();
/**
- * FOR TESTING PURPOSES ONLY
- * Sets a compound attribute.
- * Remember, they're modified after a modifier is added.
+ * Sets an attribute (doesn't work on derived attributes)
*/
- void setCompoundAttribute(int attributeNumber, unsigned short value)
- { mCompoundAttributes[attributeNumber] = value; }
-
- protected:
+ void setAttribute(int attributeNumber, unsigned short value)
+ {
+ mAttributes.at(attributeNumber) = value;
+ calculateDerivedAttributes();
+ }
/**
- * Sets a base attribute.
+ * Gets an attribute.
*/
- void setBaseAttribute(int attributeNumber, unsigned short value)
- { mBaseAttributes[attributeNumber] = value; }
+ unsigned short getAttribute(int attributeNumber) const
+ { return mAttributes.at(attributeNumber); }
+ protected:
/**
- * Gets a derived attribute.
+ * Calculates all derived attributes of a beings
*/
- unsigned short getBaseAttribute(int attributeNumber) const
- { return mBaseAttributes[attributeNumber]; }
+ void calculateDerivedAttributes();
/**
- * Recalculates the compound attributes of a being.
+ * Gets the stats of the currently equipped weapon that are relevant
+ * for damage calculation
*/
- void recalculateAllCompoundAttributes();
-
- void calculateCompoundAttribute(int attributeNumber);
+ virtual WeaponStats getWeaponStats();
int mHitpoints; /**< Hitpoints of the being */
Action mAction;
- BeingModificators mBeingModificators;
+
+ std::vector<unsigned short> mAttributes;
private:
Being(Being const &rhs);
Being &operator=(Being const &rhs);
- unsigned short mBaseAttributes[NB_BASE_ATTRIBUTES];
- unsigned short mCompoundAttributes[NB_COMPOUND_ATTRIBUTES];
Hits mHitsTaken; /**< List of punches taken since last update */
};