#include "Hero.h"
+#include "Item.h"
+#include "Spell.h"
#include "../graphics/Animation.h"
#include "../graphics/Sprite.h"
#include "../loader/Interpreter.h"
, levelLadder(0)
, numLevels(0)
+, useMask(0)
+
, weapon(0)
, armor(0)
, shield(0)
}
+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;
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"));