X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcommon%2FHero.h;h=623e2c4965fabbaaadc45efb3dbd3e47a7dd6149;hb=cc3d698b8c1ad09d7a3f9e3f28bc84e0ac1735ea;hp=77269c6b25572415a43c32da5e83cbd15c001f47;hpb=8d14039cfc64a5da19941eba65df34347fa374d5;p=l2e.git diff --git a/src/common/Hero.h b/src/common/Hero.h index 77269c6..623e2c4 100644 --- a/src/common/Hero.h +++ b/src/common/Hero.h @@ -1,10 +1,3 @@ -/* - * Hero.h - * - * Created on: Oct 7, 2012 - * Author: holy - */ - #ifndef COMMON_HERO_H_ #define COMMON_HERO_H_ @@ -27,6 +20,16 @@ public: ~Hero() { } public: + enum EquipSlot { + EQUIP_WEAPON, + EQUIP_ARMOR, + EQUIP_SHIELD, + EQUIP_HELMET, + EQUIP_RING, + EQUIP_JEWEL, + EQUIP_COUNT, + }; + const char *Name() const { return name; } Uint16 MaxHealth() const { return maxHealth; } @@ -50,27 +53,15 @@ public: int Experience() const { return experience; } int NextLevel() const; - Item *Weapon() { return weapon; } - Item *Armor() { return armor; } - Item *Shield() { return shield; } - Item *Helmet() { return helmet; } - Item *Ring() { return ring; } - Item *Jewel() { return jewel; } - - const Item *Weapon() const { return weapon; } - const Item *Armor() const { return armor; } - const Item *Shield() const { return shield; } - const Item *Helmet() const { return helmet; } - const Item *Ring() const { return ring; } - const Item *Jewel() const { return jewel; } - - bool HasWeapon() const { return weapon; } - bool HasArmor() const { return armor; } - bool HasShield() const { return shield; } - bool HasHelmet() const { return helmet; } - bool HasRing() const { return ring; } - bool HasJewel() const { return jewel; } + bool CanEquip(const Item &) const; + bool CanInvoke(const Spell &) const; + + const Item *Equipment(EquipSlot i) const { return equipment[i]; } + bool Equipped(EquipSlot i) const { return equipment[i]; } + void RemoveEquipment(EquipSlot i) { equipment[i] = 0; } + void SetEquipment(EquipSlot i, const Item *item) { equipment[i] = item; } + std::vector &Spells() { return spells; } const std::vector &Spells() const { return spells; } graphics::Sprite *BattleSprite() { return battleSprite; } @@ -87,13 +78,6 @@ public: // temporary setters public: - void SetWeapon(common::Item *i) { weapon = i; } - void SetArmor(common::Item *i) { armor = i; } - void SetShield(common::Item *i) { shield = i; } - void SetHelmet(common::Item *i) { helmet = i; } - void SetRing(common::Item *i) { ring = i; } - void SetJewel(common::Item *i) { jewel = i; } - void AddSpell(Spell *s) { spells.push_back(s); } private: @@ -111,12 +95,9 @@ private: int *levelLadder; int numLevels; - Item *weapon; - Item *armor; - Item *shield; - Item *helmet; - Item *ring; - Item *jewel; + int useMask; + + const Item *equipment[EQUIP_COUNT]; // TODO: vector does not seem to be a good choice std::vector spells;