summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorRoderic Morris <roderic@ccs.neu.edu>2008-10-25 01:40:36 +0000
committerRoderic Morris <roderic@ccs.neu.edu>2008-10-25 01:40:36 +0000
commit796c2addfb17b57992d304667248873ee26088dc (patch)
tree8d3aaab2dd6abbc304eb9f8b70551b210894a7e2 /src/resources
parentf8f3e17f72d1216bacd5aaa975789b0b790068f6 (diff)
downloadMana-796c2addfb17b57992d304667248873ee26088dc.tar.gz
Mana-796c2addfb17b57992d304667248873ee26088dc.tar.bz2
Mana-796c2addfb17b57992d304667248873ee26088dc.tar.xz
Mana-796c2addfb17b57992d304667248873ee26088dc.zip
attack range fixes, highlight monsters in range (by Chuck Miller)
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/itemdb.cpp2
-rw-r--r--src/resources/iteminfo.h37
2 files changed, 39 insertions, 0 deletions
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 0f89f444..306c0e5a 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -135,6 +135,7 @@ void ItemDB::load()
std::string image = XML::getProperty(node, "image", "");
std::string description = XML::getProperty(node, "description", "");
int weaponType = weaponTypeFromString(XML::getProperty(node, "weapon-type", ""));
+ int attackRange = XML::getProperty(node, "attack-range", 0);
ItemInfo *itemInfo = new ItemInfo;
itemInfo->setImageName(image);
@@ -144,6 +145,7 @@ void ItemDB::load()
itemInfo->setView(view);
itemInfo->setWeight(weight);
itemInfo->setWeaponType(weaponType);
+ itemInfo->setAttackRange(attackRange);
std::string effect;
for (int i = 0; i < int(sizeof(fields) / sizeof(fields[0])); ++i)
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 43047094..a8e9f2e4 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -38,6 +38,36 @@ enum EquipmentSoundEvent
EQUIP_EVENT_HIT
};
+enum EquipmentSlot
+{
+ // Equipment rules:
+ // 1 Brest equipment
+ EQUIP_TORSO_SLOT = 0,
+ // 1 arms equipment
+ EQUIP_ARMS_SLOT = 1,
+ // 1 head equipment
+ EQUIP_HEAD_SLOT = 2,
+ // 1 legs equipment
+ EQUIP_LEGS_SLOT = 3,
+ // 1 feet equipment
+ EQUIP_FEET_SLOT = 4,
+ // 2 rings
+ EQUIP_RING1_SLOT = 5,
+ EQUIP_RING2_SLOT = 6,
+ // 1 necklace
+ EQUIP_NECKLACE_SLOT = 7,
+ // Fight:
+ // 2 one-handed weapons
+ // or 1 two-handed weapon
+ // or 1 one-handed weapon + 1 shield.
+ EQUIP_FIGHT1_SLOT = 8,
+ EQUIP_FIGHT2_SLOT = 9,
+ // Projectile:
+ // this item does not amount to one, it only indicates the chosen projectile.
+ EQUIP_PROJECTILE_SLOT = 10,
+};
+
+
/**
* Enumeration of available Item types.
*/
@@ -143,6 +173,12 @@ class ItemInfo
SpriteAction getAttackType() const
{ return mAttackType; }
+ int getAttackRange() const
+ { return mAttackRange; }
+
+ void setAttackRange(int r)
+ { mAttackRange = r; }
+
void addSound(EquipmentSoundEvent event, const std::string &filename);
const std::string& getSound(EquipmentSoundEvent event) const;
@@ -158,6 +194,7 @@ class ItemInfo
// Equipment related members
SpriteAction mAttackType; /**< Attack type, in case of weapon. */
+ int mAttackRange; /**< Attack range, will be zero if non weapon. */
/** Maps gender to sprite filenames. */
std::map<int, std::string> mAnimationFiles;