X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcommon%2FHero.h;h=00924d400ef7eaf3f2fca291d80c695132141076;hb=350055a7ff27c74882aff8a4d6af2014782f830b;hp=d78d14958f37344de310847c8be5f3145cb073e9;hpb=06b6411e5dc8fc6b905530f7adbde8bd0c2bb0ea;p=l2e.git diff --git a/src/common/Hero.h b/src/common/Hero.h index d78d149..00924d4 100644 --- a/src/common/Hero.h +++ b/src/common/Hero.h @@ -11,6 +11,7 @@ #include "fwd.h" #include "Stats.h" #include "../graphics/fwd.h" +#include "../map/Entity.h" #include @@ -18,11 +19,24 @@ namespace common { class Hero { +public: + static const int TYPE_ID = 301; + public: Hero(); ~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; } @@ -43,49 +57,34 @@ public: const Stats &GetStats() const { return stats; } Uint8 Level() const { return level; } + int Experience() const { return experience; } + int NextLevel() const; + + bool CanEquip(const Item &) const; + bool CanInvoke(const Spell &) 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; } + 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; } + const graphics::Sprite *BattleSprite() const { return battleSprite; } graphics::Animation *MeleeAnimation() { return meleeAnimation; } graphics::Animation *AttackAnimation() { return attackAnimation; } graphics::Animation *SpellAnimation() { return spellAnimation; } - graphics::Sprite *MapSprite() { return mapSprite; } + map::Entity &MapEntity() { return mapEntity; } + const map::Entity &MapEntity() const { return mapEntity; } static void CreateTypeDescription(); static void Construct(void *); // 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: @@ -98,13 +97,14 @@ private: Stats stats; int level; + int experience; + + int *levelLadder; + int numLevels; + + int useMask; - Item *weapon; - Item *armor; - Item *shield; - Item *helmet; - Item *ring; - Item *jewel; + const Item *equipment[EQUIP_COUNT]; // TODO: vector does not seem to be a good choice std::vector spells; @@ -114,7 +114,7 @@ private: graphics::Animation *attackAnimation; graphics::Animation *spellAnimation; - graphics::Sprite *mapSprite; + map::Entity mapEntity; };