]> git.localhorst.tv Git - l2e.git/blob - src/common/Spell.cpp
4fce22f1e42ea3e15992b969a952c8296cd9ee60
[l2e.git] / src / common / Spell.cpp
1 /*
2  * Spell.cpp
3  *
4  *  Created on: Aug 10, 2012
5  *      Author: holy
6  */
7
8 #include "Spell.h"
9
10 #include "TargetingMode.h"
11 #include "../loader/Interpreter.h"
12 #include "../loader/TypeDescription.h"
13
14 using loader::FieldDescription;
15 using loader::Interpreter;
16 using loader::TypeDescription;
17
18 namespace common {
19
20 Spell::Spell()
21 : name(""), value(0), cost(0), status(false), battle(false) {
22
23 }
24
25
26 void Spell::CreateTypeDescription() {
27         Spell s;
28
29         TypeDescription &td(TypeDescription::Create(TYPE_ID, "Spell"));
30         td.SetDescription("All data about a spell (soon).");
31         td.SetConstructor(&Construct);
32         td.SetSize(sizeof(Spell));
33
34         td.AddField("name", FieldDescription(((char *)&s.name) - ((char *)&s), Interpreter::STRING_ID).SetReferenced().SetDescription("the spell's name"));
35         td.AddField("cost", FieldDescription(((char *)&s.cost) - ((char *)&s), Interpreter::NUMBER_ID).SetDescription("Amount of magic points needed and deducted for invocation"));
36         td.AddField("targets", FieldDescription(((char *)&s.targetingMode) - ((char *)&s), TargetingMode::TYPE_ID).SetDescription("how target selection is to be performed"));
37         td.AddField("status", FieldDescription(((char *)&s.status) - ((char *)&s), Interpreter::BOOLEAN_ID).SetDescription("if the spell can be used at the status screen"));
38         td.AddField("battle", FieldDescription(((char *)&s.battle) - ((char *)&s), Interpreter::BOOLEAN_ID).SetDescription("if the spell can be used in battle"));
39 }
40
41 void Spell::Construct(void *data) {
42         new (data) Spell;
43 }
44
45 }