X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcommon%2FHero.cpp;h=ab73a6be70d3ee91fbc003d4918342ebba28638c;hb=5795ffa948c6e39a624c4fc7773a99afb87579e1;hp=8222e124ce8e81686a876fbc94c23dd25c99a95f;hpb=c5ee1039b4cc41615c2402ecd7a73f62f9a7d2f5;p=l2e.git diff --git a/src/common/Hero.cpp b/src/common/Hero.cpp index 8222e12..ab73a6b 100644 --- a/src/common/Hero.cpp +++ b/src/common/Hero.cpp @@ -7,6 +7,8 @@ #include "Hero.h" +#include "Item.h" +#include "Spell.h" #include "../graphics/Animation.h" #include "../graphics/Sprite.h" #include "../loader/Interpreter.h" @@ -36,6 +38,8 @@ Hero::Hero() , levelLadder(0) , numLevels(0) +, useMask(0) + , weapon(0) , armor(0) , shield(0) @@ -76,6 +80,15 @@ int Hero::NextLevel() const { } +bool Hero::CanEquip(const Item &item) const { + return useMask & item.HeroMask(); +} + +bool Hero::CanInvoke(const Spell &spell) const { + return useMask & spell.HeroMask(); +} + + void Hero::CreateTypeDescription() { Hero h; @@ -96,6 +109,8 @@ void Hero::CreateTypeDescription() { td.AddField("level", FieldDescription(((char *)&h.level) - ((char *)&h), Interpreter::NUMBER_ID)); td.AddField("ladder", FieldDescription(((char *)&h.levelLadder) - ((char *)&h), Interpreter::NUMBER_ID).SetReferenced().SetAggregate()); + td.AddField("useMask", FieldDescription(((char *)&h.useMask) - ((char *)&h), Interpreter::NUMBER_ID)); + td.AddField("battleSprite", FieldDescription(((char *)&h.battleSprite) - ((char *)&h), Sprite::TYPE_ID).SetReferenced().SetDescription("the sprite used for battle scenes")); td.AddField("attackAnimation", FieldDescription(((char *)&h.attackAnimation) - ((char *)&h), Animation::TYPE_ID).SetReferenced().SetDescription("the animation played for physical attacks")); td.AddField("spellAnimation", FieldDescription(((char *)&h.spellAnimation) - ((char *)&h), Animation::TYPE_ID).SetReferenced().SetDescription("the animation played for magical attacks"));