]> git.localhorst.tv Git - l2e.git/blob - src/common/Ikari.cpp
3a023926b5fe8e5d94c9448c49ef03d61bda459c
[l2e.git] / src / common / Ikari.cpp
1 /*
2  * Ikari.cpp
3  *
4  *  Created on: Aug 10, 2012
5  *      Author: holy
6  */
7
8 #include "Ikari.h"
9
10 #include "../loader/TypeDescription.h"
11
12 using loader::FieldDescription;
13 using loader::TypeDescription;
14
15 namespace common {
16
17 Ikari::Ikari()
18 : name("")
19 , cost(0)
20 , isPhysical(false) {
21
22 }
23
24
25 void Ikari::CreateTypeDescription() {
26         Ikari i;
27
28         int boolId(TypeDescription::GetTypeId("Boolean"));
29         int numberId(TypeDescription::GetTypeId("Number")); // FIXME: need small number type
30         int stringId(TypeDescription::GetTypeId("String"));
31         int targetsId(TypeDescription::GetTypeId("TargetingMode"));
32
33         TypeDescription &td(TypeDescription::CreateOrGet("Ikari"));
34         td.SetDescription(
35                         "Information of a single ikari attack.");
36         td.SetConstructor(&Construct);
37         td.SetSize(sizeof(Ikari));
38
39         td.AddField("name", FieldDescription(((char *)&i.name) - ((char *)&i), stringId).SetReferenced().SetDescription("the attack's name"));
40         td.AddField("cost", FieldDescription(((char *)&i.cost) - ((char *)&i), numberId).SetDescription("amount of ikari points needed and deducted for use"));
41         td.AddField("targets", FieldDescription(((char *)&i.targetingMode) - ((char *)&i), targetsId).SetDescription("how target selection is to be performed"));
42         td.AddField("type", FieldDescription(((char *)&i.isPhysical) - ((char *)&i), boolId).SetDescription("if the attack is physical (true) or magical(false)"));
43 }
44
45 void Ikari::Construct(void *data) {
46         new (data) Ikari;
47 }
48
49 }