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