3 #include "TargetingMode.h"
4 #include "../loader/Interpreter.h"
5 #include "../loader/TypeDescription.h"
7 using loader::FieldDescription;
8 using loader::Interpreter;
9 using loader::TypeDescription;
24 bool Spell::Less(const Spell *lhs, const Spell *rhs) {
25 // TODO: find out real spell sorting order
26 return lhs->Cost() < rhs->Cost();
30 void Spell::CreateTypeDescription() {
33 TypeDescription &td(TypeDescription::Create(TYPE_ID, "Spell"));
34 td.SetDescription("All data about a spell (soon).");
35 td.SetConstructor(&Construct);
36 td.SetSize(sizeof(Spell));
38 td.AddField("name", FieldDescription(((char *)&s.name) - ((char *)&s), Interpreter::STRING_ID).SetReferenced().SetDescription("the spell's name"));
39 td.AddField("cost", FieldDescription(((char *)&s.cost) - ((char *)&s), Interpreter::NUMBER_ID).SetDescription("amount of magic points needed and deducted for invocation"));
40 td.AddField("targets", FieldDescription(((char *)&s.targetingMode) - ((char *)&s), TargetingMode::TYPE_ID).SetDescription("how target selection is to be performed"));
41 td.AddField("heroMask", FieldDescription(((char *)&s.heroMask) - ((char *)&s), Interpreter::NUMBER_ID).SetDescription("which heroes can invoke this spell"));
42 td.AddField("status", FieldDescription(((char *)&s.status) - ((char *)&s), Interpreter::BOOLEAN_ID).SetDescription("if the spell can be used at the status screen"));
43 td.AddField("battle", FieldDescription(((char *)&s.battle) - ((char *)&s), Interpreter::BOOLEAN_ID).SetDescription("if the spell can be used in battle"));
46 void Spell::Construct(void *data) {