--- /dev/null
+/*
+ * Item.h
+ *
+ * Created on: Aug 9, 2012
+ * Author: holy
+ */
+
+#ifndef COMMON_ITEM_H_
+#define COMMON_ITEM_H_
+
+#include <SDL.h>
+
+namespace graphics { class Sprite; }
+
+namespace common {
+
+class Item {
+
+public:
+ Item();
+
+public:
+ bool IsMostUseful() const { return usability & USABILITY_MOST_USEFUL; }
+ bool IsEquipable() const { return usability & USABILITY_EQUIPABLE; }
+ bool IsCursed() const { return usability & USABILITY_CURSED; }
+ bool IsFruit() const { return usability & USABILITY_FRUIT; }
+ bool IsScenario() const { return usability & USABILITY_SCENARIO; }
+ bool CanSell() const { return !IsScenario(); }
+ bool CanDrop() const { return !IsScenario(); }
+ bool CanUseOnStatusScreen() const { return usability & USABILITY_STATUS; }
+ bool CanUseInBattle() const { return usability & USABILITY_BATTLE; }
+
+ bool TargetEnemy() const { return targettingMode & TARGETTING_MODE_ENEMY; }
+ bool TargetAlly() const { return !TargetEnemy(); }
+ bool TargetAll() const { return (targettingMode & TARGETTING_MODE_COUNT_MASK) == TARGETTING_MODE_ALL; }
+ bool TargetMultiple() const { return (targettingMode & TARGETTING_MODE_COUNT_MASK) == TARGETTING_MODE_MULTIPLE; }
+ bool TargetOne() const { return (targettingMode & TARGETTING_MODE_COUNT_MASK) == TARGETTING_MODE_ONE; }
+
+ bool HasMenuIcon() const { return menuIcon; }
+ const graphics::Sprite *MenuIcon() const { return menuIcon; }
+ bool HasChestIcon() const { return chestIcon; }
+ const graphics::Sprite *ChestIcon() const { return chestIcon; }
+
+ Uint16 Value() const { return value; }
+
+ bool CanEquipWeapon() const { return equipable & EQUIPPABLE_WEAPON; }
+ bool CanEquipArmor() const { return equipable & EQUIPPABLE_ARMOR; }
+ bool CanEquipShield() const { return equipable & EQUIPPABLE_SHIELD; }
+ bool CanEquipHelmet() const { return equipable & EQUIPPABLE_HELMET; }
+ bool CanEquipRing() const { return equipable & EQUIPPABLE_RING; }
+ bool CanEquipJewel() const { return equipable & EQUIPPABLE_JEWEL; }
+
+ bool EquipableByMaxim() const { return equipableBy & EQUIPABLE_BY_MAXIM; }
+ bool EquipableBySelan() const { return equipableBy & EQUIPABLE_BY_SELAN; }
+ bool EquipableByGuy() const { return equipableBy & EQUIPABLE_BY_GUY; }
+ bool EquipableByArtea() const { return equipableBy & EQUIPABLE_BY_ARTEA; }
+ bool EquipableByTia() const { return equipableBy & EQUIPABLE_BY_TIA; }
+ bool EquipableByDekar() const { return equipableBy & EQUIPABLE_BY_DEKAR; }
+ bool EquipableByLexis() const { return equipableBy & EQUIPABLE_BY_LEXIS; }
+
+ bool HasItemEffectOnStatusScreen() const { return properties & PROPERTY_HAS_ITEM_EFFECT_STATUS; }
+ bool HasItemEffectInBattle() const { return properties & PROPERTY_HAS_ITEM_EFFECT_BATTLE; }
+ bool HasWeaponEffect() const { return properties & PROPERTY_HAS_WEAPON_EFFECT; }
+ bool HasArmorEffect() const { return properties & PROPERTY_HAS_ARMOR_EFFECT; }
+ bool IncreasesATP() const { return properties & PROPERTY_INCREASE_ATP; }
+ bool IncreasesDFP() const { return properties & PROPERTY_INCREASE_DFP; }
+ bool IncreasesSTR() const { return properties & PROPERTY_INCREASE_STR; }
+ bool IncreasesAGL() const { return properties & PROPERTY_INCREASE_AGL; }
+ bool IncreasesINT() const { return properties & PROPERTY_INCREASE_INT; }
+ bool IncreasesGUT() const { return properties & PROPERTY_INCREASE_GUT; }
+ bool IncreasesMGR() const { return properties & PROPERTY_INCREASE_MGR; }
+ bool HasBattleAnimation() const { return properties & PROPERTY_HAS_BATTLE_ANIMATION; }
+ bool HasIkariEffect() const { return properties & PROPERTY_HAS_IKARI_EFFECT; }
+
+private:
+ enum Usability {
+ USABILITY_MOST_USEFUL = 1,
+ USABILITY_EQUIPABLE = 2,
+ // USABILITY_UNUSED = 4,
+ USABILITY_CURSED = 8,
+ USABILITY_FRUIT = 16,
+ USABILITY_SCENARIO = 32,
+ USABILITY_STATUS = 64,
+ USABILITY_BATTLE = 128,
+ };
+ enum TargettingMode {
+ TARGETTING_MODE_ALL = 0,
+ TARGETTING_MODE_ALLY = 0,
+ TARGETTING_MODE_MULTIPLE = 1,
+ TARGETTING_MODE_ONE = 2,
+ TARGETTING_MODE_COUNT_MASK = 127,
+ TARGETTING_MODE_ENEMY = 128,
+ TARGETTING_MODE_FACTION_MASK = 128,
+ };
+ enum Equipable {
+ EQUIPPABLE_NONE = 0,
+ EQUIPPABLE_WEAPON = 1,
+ EQUIPPABLE_ARMOR = 2,
+ EQUIPPABLE_SHIELD = 4,
+ EQUIPPABLE_HELMET = 8,
+ EQUIPPABLE_RING = 16,
+ EQUIPPABLE_JEWEL = 32,
+ };
+ enum EquipableBy {
+ EQUIPABLE_BY_NOBODY = 0,
+ EQUIPABLE_BY_MAXIM = 1,
+ EQUIPABLE_BY_SELAN = 2,
+ EQUIPABLE_BY_GUY = 4,
+ EQUIPABLE_BY_ARTEA = 8,
+ EQUIPABLE_BY_TIA = 16,
+ EQUIPABLE_BY_DEKAR = 32,
+ EQUIPABLE_BY_LEXIS = 64,
+ };
+ enum Property {
+ PROPERTY_HAS_ITEM_EFFECT_STATUS = 1,
+ PROPERTY_HAS_ITEM_EFFECT_BATTLE = 2,
+ PROPERTY_HAS_WEAPON_EFFECT = 4,
+ PROPERTY_HAS_ARMOR_EFFECT = 8,
+ PROPERTY_INCREASE_ATP = 16,
+ PROPERTY_INCREASE_DFP = 32,
+ PROPERTY_INCREASE_STR = 64,
+ PROPERTY_INCREASE_AGL = 128,
+ PROPERTY_INCREASE_INT = 256,
+ PROPERTY_INCREASE_GUT = 512,
+ PROPERTY_INCREASE_MGR = 1024,
+ // PROPERTY_UNUSED = 2048,
+ // PROPERTY_UNUSED = 4096,
+ PROPERTY_HAS_BATTLE_ANIMATION = 8192,
+ // PROPERTY_UNKNOWN = 16384,
+ PROPERTY_HAS_IKARI_EFFECT = 32768,
+ };
+
+private:
+ graphics::Sprite *menuIcon;
+ graphics::Sprite *chestIcon;
+
+ Uint16 value;
+ Uint16 properties;
+
+ Uint8 usability;
+ Uint8 targettingMode;
+ Uint8 equipable;
+ Uint8 equipableBy;
+
+};
+
+}
+
+#endif /* COMMON_ITEM_H_ */