X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FMonster.cpp;h=a252e5f4e5084c2823ef8cf7019177e660be2b37;hb=092a2dd175a4001a495c84ee85211734fb928c83;hp=f0b9f3782f0587c1d289d671b669c73c970427b7;hpb=d5959073b2c413ba1bd6f3d14bc8bcf59304e488;p=l2e.git diff --git a/src/battle/Monster.cpp b/src/battle/Monster.cpp index f0b9f37..a252e5f 100644 --- a/src/battle/Monster.cpp +++ b/src/battle/Monster.cpp @@ -1,12 +1,19 @@ -/* - * Monster.cpp - * - * Created on: Aug 3, 2012 - * Author: holy - */ - #include "Monster.h" +#include "../common/Stats.h" +#include "../graphics/Animation.h" +#include "../graphics/Sprite.h" +#include "../loader/Interpreter.h" +#include "../loader/TypeDescription.h" +#include "../math/Vector.h" + +using common::Stats; +using graphics::Animation; +using graphics::Sprite; +using loader::FieldDescription; +using loader::Interpreter; +using loader::TypeDescription; + namespace battle { Monster::Monster() @@ -46,4 +53,32 @@ void Monster::SubtractHealth(int amount) { } } + +void Monster::CreateTypeDescription() { + Monster m; + + TypeDescription &td(TypeDescription::Create(TYPE_ID, "Monster")); + td.SetDescription("All data of a monster."); + td.SetConstructor(&Construct); + td.SetSize(sizeof(Monster)); + + td.AddField("name", FieldDescription(((char *)&m.name) - ((char *)&m), Interpreter::STRING_ID).SetReferenced()); + td.AddField("sprite", FieldDescription(((char *)&m.sprite) - ((char *)&m), Sprite::TYPE_ID).SetReferenced()); + td.AddField("level", FieldDescription(((char *)&m.level) - ((char *)&m), Interpreter::NUMBER_ID)); + + td.AddField("maxHealth", FieldDescription(((char *)&m.maxHealth) - ((char *)&m), Interpreter::NUMBER_ID)); + td.AddField("health", FieldDescription(((char *)&m.health) - ((char *)&m), Interpreter::NUMBER_ID)); + td.AddField("maxMana", FieldDescription(((char *)&m.maxMana) - ((char *)&m), Interpreter::NUMBER_ID)); + td.AddField("mana", FieldDescription(((char *)&m.mana) - ((char *)&m), Interpreter::NUMBER_ID)); + td.AddField("stats", FieldDescription(((char *)&m.stats) - ((char *)&m), Stats::TYPE_ID)); + + td.AddField("attackAnimation", FieldDescription(((char *)&m.attackAnimation) - ((char *)&m), Animation::TYPE_ID).SetReferenced()); + td.AddField("spellAnimation", FieldDescription(((char *)&m.spellAnimation) - ((char *)&m), Animation::TYPE_ID).SetReferenced()); + td.AddField("meleeAnimation", FieldDescription(((char *)&m.meleeAnimation) - ((char *)&m), Animation::TYPE_ID).SetReferenced()); +} + +void Monster::Construct(void *data) { + new (data) Monster; +} + }