]> git.localhorst.tv Git - l2e.git/blob - src/common/Item.h
added forwarding headers
[l2e.git] / src / common / Item.h
1 /*
2  * Item.h
3  *
4  *  Created on: Aug 9, 2012
5  *      Author: holy
6  */
7
8 #ifndef COMMON_ITEM_H_
9 #define COMMON_ITEM_H_
10
11 #include "fwd.h"
12 #include "HeroGroup.h"
13 #include "TargetingMode.h"
14 #include "../graphics/fwd.h"
15
16 #include <SDL.h>
17
18 namespace common {
19
20 class Item {
21
22 public:
23         Item();
24
25 public:
26         const char *Name() const { return name; }
27
28         bool IsMostUseful() const { return mostUseful; }
29         bool IsEquipable() const { return equipable; }
30         bool IsCursed() const { return cursed; }
31         bool IsFruit() const { return fruit; }
32         bool IsScenario() const { return scenario; }
33         bool CanSell() const { return !IsScenario(); }
34         bool CanDrop() const { return !IsScenario(); }
35         bool CanUseOnStatusScreen() const { return status; }
36         bool CanUseInBattle() const { return battle; }
37
38         TargetingMode &GetTargetingMode() { return targettingMode; }
39         const TargetingMode &GetTargetingMode() const { return targettingMode; }
40
41         bool HasMenuIcon() const { return menuIcon; }
42         const graphics::Sprite *MenuIcon() const { return menuIcon; }
43         bool HasChestIcon() const { return chestIcon; }
44         const graphics::Sprite *ChestIcon() const { return chestIcon; }
45
46         bool HasIkari() const { return ikari; }
47         const Ikari *GetIkari() const { return ikari; }
48
49         graphics::Animation *AttackAnimation() { return attackAnimation; }
50         const graphics::Animation *AttackAnimation() const { return attackAnimation; }
51
52         Uint16 Value() const { return value; }
53
54         bool CanEquipWeapon() const { return equipability & EQUIPPABLE_WEAPON; }
55         bool CanEquipArmor() const { return equipability & EQUIPPABLE_ARMOR; }
56         bool CanEquipShield() const { return equipability & EQUIPPABLE_SHIELD; }
57         bool CanEquipHelmet() const { return equipability & EQUIPPABLE_HELMET; }
58         bool CanEquipRing() const { return equipability & EQUIPPABLE_RING; }
59         bool CanEquipJewel() const { return equipability & EQUIPPABLE_JEWEL; }
60
61         HeroGroup &EquipableBy() { return equipableBy; }
62         const HeroGroup &EquipableBy() const { return equipableBy; }
63
64         bool HasEffectOnStatusScreen() const { return properties & PROPERTY_HAS_EFFECT_STATUS; }
65         bool HasEffectInBattle() const { return properties & PROPERTY_HAS_EFFECT_BATTLE; }
66         bool HasWeaponEffect() const { return properties & PROPERTY_HAS_WEAPON_EFFECT; }
67         bool HasArmorEffect() const { return properties & PROPERTY_HAS_ARMOR_EFFECT; }
68         bool IncreasesATP() const { return properties & PROPERTY_INCREASE_ATP; }
69         bool IncreasesDFP() const { return properties & PROPERTY_INCREASE_DFP; }
70         bool IncreasesSTR() const { return properties & PROPERTY_INCREASE_STR; }
71         bool IncreasesAGL() const { return properties & PROPERTY_INCREASE_AGL; }
72         bool IncreasesINT() const { return properties & PROPERTY_INCREASE_INT; }
73         bool IncreasesGUT() const { return properties & PROPERTY_INCREASE_GUT; }
74         bool IncreasesMGR() const { return properties & PROPERTY_INCREASE_MGR; }
75         bool HasBattleAnimation() const { return properties & PROPERTY_HAS_BATTLE_ANIMATION; }
76         bool HasIkariEffect() const { return properties & PROPERTY_HAS_IKARI_EFFECT; }
77
78 // temporary setters
79 public:
80         void SetName(const char *n) { name = n; }
81         void SetMenuIcon(const graphics::Sprite *icon) { menuIcon = icon; }
82         void SetUsableInBattle() { battle = true; }
83         void SetIkari(const Ikari *i) { ikari = i; }
84         void SetAttackAnimation(graphics::Animation *a) { attackAnimation = a; }
85
86         static void CreateTypeDescription();
87         static void Construct(void *);
88
89 private:
90         enum Equipable {
91                 EQUIPPABLE_NONE = 0,
92                 EQUIPPABLE_WEAPON = 1,
93                 EQUIPPABLE_ARMOR = 2,
94                 EQUIPPABLE_SHIELD = 4,
95                 EQUIPPABLE_HELMET = 8,
96                 EQUIPPABLE_RING = 16,
97                 EQUIPPABLE_JEWEL = 32,
98         };
99         enum Property {
100                 PROPERTY_HAS_EFFECT_STATUS = 1,
101                 PROPERTY_HAS_EFFECT_BATTLE = 2,
102                 PROPERTY_HAS_WEAPON_EFFECT = 4,
103                 PROPERTY_HAS_ARMOR_EFFECT = 8,
104                 PROPERTY_INCREASE_ATP = 16,
105                 PROPERTY_INCREASE_DFP = 32,
106                 PROPERTY_INCREASE_STR = 64,
107                 PROPERTY_INCREASE_AGL = 128,
108                 PROPERTY_INCREASE_INT = 256,
109                 PROPERTY_INCREASE_GUT = 512,
110                 PROPERTY_INCREASE_MGR = 1024,
111                 // PROPERTY_UNUSED = 2048,
112                 // PROPERTY_UNUSED = 4096,
113                 PROPERTY_HAS_BATTLE_ANIMATION = 8192,
114                 // PROPERTY_UNKNOWN = 16384,
115                 PROPERTY_HAS_IKARI_EFFECT = 32768,
116         };
117
118 private:
119         const char *name;
120         const graphics::Sprite *menuIcon;
121         const graphics::Sprite *chestIcon;
122         const Ikari *ikari;
123         graphics::Animation *attackAnimation;
124
125         Uint16 value;
126         Uint16 properties;
127
128         TargetingMode targettingMode;
129         Uint8 equipability;
130         HeroGroup equipableBy;
131
132         // TODO: turn these back into bits as soon as fields are implemented in the loader
133         bool mostUseful;
134         bool equipable;
135         bool cursed;
136         bool fruit;
137         bool scenario;
138         bool status;
139         bool battle;
140
141 };
142
143 }
144
145 #endif /* COMMON_ITEM_H_ */