, level(0)
, experience(0)
+, levelLadder(0)
+, numLevels(0)
, weapon(0)
, armor(0)
}
+int Hero::NextLevel() const {
+ int levelOffset(Level() - 1);
+ if (levelOffset < numLevels) {
+ return levelLadder[levelOffset] - Experience();
+ } else {
+ return 0;
+ }
+}
+
+
void Hero::CreateTypeDescription() {
Hero h;
td.AddField("stats", FieldDescription(((char *)&h.stats) - ((char *)&h), Stats::TYPE_ID));
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("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"));
Uint8 Level() const { return level; }
int Experience() const { return experience; }
+ int NextLevel() const;
Item *Weapon() { return weapon; }
Item *Armor() { return armor; }
int level;
int experience;
+ int *levelLadder;
+ int numLevels;
+
Item *weapon;
Item *armor;
Item *shield;