aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen
diff options
context:
space:
mode:
authorPaul Gilbert2015-02-07 11:45:20 -0500
committerPaul Gilbert2015-02-07 11:45:20 -0500
commit5ffbe2de873e6ac789ce9eff298a4ab21d02196b (patch)
treeeca479a45523191e7fb0d1643a357bedcefd76ef /engines/xeen
parentd40c62532abfeb0d7fdbc005a16698ce19afe43b (diff)
downloadscummvm-rg350-5ffbe2de873e6ac789ce9eff298a4ab21d02196b.tar.gz
scummvm-rg350-5ffbe2de873e6ac789ce9eff298a4ab21d02196b.tar.bz2
scummvm-rg350-5ffbe2de873e6ac789ce9eff298a4ab21d02196b.zip
XEEN: Implemented getIdentifiedDetails and getAttributes
Diffstat (limited to 'engines/xeen')
-rw-r--r--engines/xeen/character.cpp165
-rw-r--r--engines/xeen/character.h27
-rw-r--r--engines/xeen/dialogs_items.cpp86
-rw-r--r--engines/xeen/dialogs_items.h2
-rw-r--r--engines/xeen/party.h2
-rw-r--r--engines/xeen/resources.cpp86
-rw-r--r--engines/xeen/resources.h28
-rw-r--r--engines/xeen/spells.h28
8 files changed, 386 insertions, 38 deletions
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index 3489783983..cde244b051 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -44,21 +44,21 @@ void XeenItem::synchronize(Common::Serializer &s) {
s.syncAsByte(_frame);
}
-int XeenItem::getElementalCategory() const {
+ElementalCategory XeenItem::getElementalCategory() const {
int idx;
for (idx = 0; ELEMENTAL_CATEGORIES[idx] < _material; ++idx)
;
- return idx;
+ return (ElementalCategory)idx;
}
-int XeenItem::getAttributeCategory() const {
+AttributeCategory XeenItem::getAttributeCategory() const {
int m = _material - 59;
int idx;
for (idx = 0; ATTRIBUTE_CATEGORIES[idx] < m; ++idx)
;
- return idx;
+ return (AttributeCategory)idx;
}
/*------------------------------------------------------------------------*/
@@ -125,6 +125,24 @@ Common::String InventoryItems::getName(int itemIndex) {
return _names[id];
}
+Common::String InventoryItems::getIdentifiedDetails(int itemIndex) {
+ XeenItem &item = operator[](itemIndex);
+
+ Common::String classes;
+ for (int charClass = CLASS_KNIGHT; charClass <= CLASS_RANGER; ++charClass) {
+ if (passRestrictions(charClass, true)) {
+ const char *const name = CLASS_NAMES[charClass];
+ classes += name[0];
+ classes += name[1];
+ classes += " ";
+ }
+ }
+ if (classes.size() == 30)
+ classes = ALL;
+
+ return getAttributes(item, classes);
+}
+
/**
* Discard an item from the inventory
*/
@@ -301,6 +319,53 @@ void WeaponItems::enchantItem(int itemIndex, int amount) {
}
}
+/*
+ * Returns a text string listing all the stats/attributes of a given item
+ */
+Common::String WeaponItems::getAttributes(XeenItem &item, const Common::String &classes) {
+ Common::String attrBonus, elemDamage, physDamage, toHit, specialPower;
+ attrBonus = elemDamage = physDamage = toHit = specialPower = FIELD_NONE;
+
+ // First calculate physical damage
+ int minVal = WEAPON_DAMAGE_BASE[item._id];
+ int maxVal = minVal * WEAPON_DAMAGE_MULTIPLIER[item._id];
+
+ if (item._material >= 37 && item._material <= 58) {
+ minVal += METAL_DAMAGE[item._material - 37];
+ maxVal += METAL_DAMAGE[item._material - 37];
+ toHit = Common::String::format("%+d", METAL_DAMAGE_PERCENT[item._material - 37]);
+ }
+
+ physDamage = Common::String::format(DAMAGE_X_TO_Y, minVal, maxVal);
+
+ // Next handle elemental/attribute damage
+ if (item._material < 37) {
+ int damage = ELEMENTAL_DAMAGE[item._material];
+ if (damage > 0) {
+ ElementalCategory elemCategory = item.getElementalCategory();
+ elemDamage = Common::String::format(ELEMENTAL_XY_DAMAGE,
+ damage, ELEMENTAL_NAMES[elemCategory]);
+ }
+ } else if (item._material >= 59) {
+ int bonus = ATTRIBUTE_BONUSES[item._material - 59];
+ AttributeCategory attrCategory = item.getAttributeCategory();
+ attrBonus = Common::String::format(ATTR_XY_BONUS, bonus,
+ ATTRIBUTE_NAMES[attrCategory]);
+ }
+
+ // Handle weapon effective against
+ int effective = item._bonusFlags & ITEMFLAG_BONUS_MASK;
+ if (effective) {
+ specialPower = Common::String::format(EFFECTIVE_AGAINST,
+ EFFECTIVENESS_NAMES[effective]);
+ }
+
+ return Common::String::format(ITEM_DETAILS, classes.c_str(),
+ toHit.c_str(), physDamage.c_str(), elemDamage.c_str(),
+ FIELD_NONE, FIELD_NONE, attrBonus.c_str(), specialPower.c_str()
+ );
+}
+
/*------------------------------------------------------------------------*/
/**
@@ -419,6 +484,41 @@ void ArmorItems::enchantItem(int itemIndex, int amount) {
}
}
+/*
+* Returns a text string listing all the stats/attributes of a given item
+*/
+Common::String ArmorItems::getAttributes(XeenItem &item, const Common::String &classes) {
+ Common::String elemResist, attrBonus, acBonus;
+ elemResist = attrBonus = acBonus = FIELD_NONE;
+
+ if (item._material < 36) {
+ int resistence = ELEMENTAL_RESISTENCES[item._material];
+ if (resistence > 0) {
+ int eCategory = ELEM_FIRE;
+ while (eCategory < ELEM_MAGIC && ELEMENTAL_CATEGORIES[eCategory] < item._material)
+ ++eCategory;
+
+ elemResist = Common::String::format(ATTR_XY_BONUS, resistence,
+ ELEMENTAL_NAMES[eCategory]);
+ }
+ } else if (item._material >= 59) {
+ int bonus = ATTRIBUTE_BONUSES[item._material - 59];
+ AttributeCategory aCategory = item.getAttributeCategory();
+ attrBonus = Common::String::format(ATTR_XY_BONUS, bonus,
+ ATTRIBUTE_NAMES[aCategory]);
+ }
+
+ int strength = ARMOR_STRENGTHS[item._id];
+ if (item._material >= 37 && item._material <= 58) {
+ strength += METAL_LAC[item._material - 37];
+ }
+ acBonus = Common::String::format("%+d", strength);
+
+ return Common::String::format(ITEM_DETAILS, classes.c_str(),
+ FIELD_NONE, FIELD_NONE, FIELD_NONE,
+ elemResist.c_str(), acBonus.c_str(), attrBonus.c_str(), FIELD_NONE);
+}
+
/*------------------------------------------------------------------------*/
/**
@@ -490,6 +590,35 @@ Common::String AccessoryItems::getFullDescription(int itemIndex, int displayNum)
);
}
+/*
+* Returns a text string listing all the stats/attributes of a given item
+*/
+Common::String AccessoryItems::getAttributes(XeenItem &item, const Common::String &classes) {
+ Common::String elemResist, attrBonus;
+ elemResist = attrBonus = FIELD_NONE;
+
+ if (item._material < 36) {
+ int resistence = ELEMENTAL_RESISTENCES[item._material];
+ if (resistence > 0) {
+ int eCategory = ELEM_FIRE;
+ while (eCategory < ELEM_MAGIC && ELEMENTAL_CATEGORIES[eCategory] < item._material)
+ ++eCategory;
+
+ elemResist = Common::String::format(ATTR_XY_BONUS, resistence,
+ ELEMENTAL_NAMES[eCategory]);
+ }
+ } else if (item._material >= 59) {
+ int bonus = ATTRIBUTE_BONUSES[item._material - 59];
+ AttributeCategory aCategory = item.getAttributeCategory();
+ attrBonus = Common::String::format(ATTR_XY_BONUS, bonus,
+ ATTRIBUTE_NAMES[aCategory]);
+ }
+
+ return Common::String::format(ITEM_DETAILS, classes.c_str(),
+ FIELD_NONE, FIELD_NONE, FIELD_NONE,
+ elemResist.c_str(), FIELD_NONE, attrBonus.c_str(), FIELD_NONE);
+}
+
/*------------------------------------------------------------------------*/
/**
@@ -510,6 +639,22 @@ Common::String MiscItems::getFullDescription(int itemIndex, int displayNum) {
);
}
+
+/*
+* Returns a text string listing all the stats/attributes of a given item
+*/
+Common::String MiscItems::getAttributes(XeenItem &item, const Common::String &classes) {
+ Common::String specialPower = FIELD_NONE;
+ Spells &spells = *vm()->_spells;
+
+ if (item._id) {
+ specialPower = spells._spellNames[MISC_SPELL_INDEX[item._id]];
+ }
+
+ return Common::String::format(ITEM_DETAILS, classes.c_str(),
+ FIELD_NONE, FIELD_NONE, FIELD_NONE, FIELD_NONE, FIELD_NONE,
+ FIELD_NONE, specialPower.c_str());
+}
/*------------------------------------------------------------------------*/
InventoryItemsGroup::InventoryItemsGroup(InventoryItems &weapons, InventoryItems &armor,
@@ -975,8 +1120,8 @@ int Character::itemScan(int itemId) const {
if (item._frame && !(item._bonusFlags & 0xC0) && itemId < 11
&& itemId != 3 && item._material >= 59 && item._material <= 130) {
- int mIndex = item.getAttributeCategory();
- if (mIndex > 2)
+ int mIndex = (int)item.getAttributeCategory();
+ if (mIndex > PERSONALITY)
++mIndex;
if (mIndex == itemId)
@@ -991,8 +1136,8 @@ int Character::itemScan(int itemId) const {
if (item._frame && !(item._bonusFlags & 0xC0)) {
if (itemId < 11 && itemId != 3 && item._material >= 59 && item._material <= 130) {
- int mIndex = item.getAttributeCategory();
- if (mIndex > 2)
+ int mIndex = (int)item.getAttributeCategory();
+ if (mIndex > PERSONALITY)
++mIndex;
if (mIndex == itemId)
@@ -1023,8 +1168,8 @@ int Character::itemScan(int itemId) const {
if (item._frame && !(item._bonusFlags & 0xC0) && itemId < 11 && itemId != 3) {
if (item._material >= 59 && item._material <= 130) {
- int mIndex = item.getAttributeCategory();
- if (mIndex > 2)
+ int mIndex = (int)item.getAttributeCategory();
+ if (mIndex > PERSONALITY)
++mIndex;
if (mIndex == itemId) {
diff --git a/engines/xeen/character.h b/engines/xeen/character.h
index af9f7c69e9..6e6a77210e 100644
--- a/engines/xeen/character.h
+++ b/engines/xeen/character.h
@@ -73,6 +73,17 @@ enum Condition {
NO_CONDITION = 16
};
+enum ElementalCategory {
+ ELEM_FIRE = 0, ELEM_ELECTRICITY = 1, ELEM_COLD = 2,
+ ELEM_ACID_POISON = 3, ELEM_ENERGY = 4, ELEM_MAGIC = 5
+};
+
+enum AttributeCategory {
+ ATTR_MIGHT = 0, ATTR_INTELLECT = 1, ATTR_PERSONALITY = 2, ATTR_SPEED = 3,
+ ATTR_ACCURACY = 4, ATTR_LUCK = 5, ATTR_HIT_POINTS = 6, ATTR_SPELL_POINTS = 7,
+ ATTR_ARMOR_CLASS = 8, ATTR_THIEVERY = 9
+};
+
class XeenEngine;
class Character;
@@ -89,9 +100,9 @@ public:
void synchronize(Common::Serializer &s);
- int getElementalCategory() const;
+ ElementalCategory getElementalCategory() const;
- int getAttributeCategory() const;
+ AttributeCategory getAttributeCategory() const;
};
class InventoryItems : public Common::Array<XeenItem> {
@@ -103,6 +114,8 @@ protected:
XeenEngine *vm();
void equipError(int itemIndex1, ItemCategory category1, int itemIndex2,
ItemCategory category2);
+
+ virtual Common::String getAttributes(XeenItem &item, const Common::String &classes) = 0;
public:
InventoryItems(Character *character, ItemCategory category);
@@ -114,6 +127,8 @@ public:
virtual Common::String getFullDescription(int itemIndex, int displayNum = 15) = 0;
+ Common::String getIdentifiedDetails(int itemIndex);
+
bool discardItem(int itemIndex);
virtual void equipItem(int itemIndex) {}
@@ -126,6 +141,8 @@ public:
};
class WeaponItems: public InventoryItems {
+protected:
+ virtual Common::String getAttributes(XeenItem &item, const Common::String &classes);
public:
WeaponItems(Character *character) : InventoryItems(character, CATEGORY_WEAPON) {}
@@ -137,6 +154,8 @@ public:
};
class ArmorItems : public InventoryItems {
+protected:
+ virtual Common::String getAttributes(XeenItem &item, const Common::String &classes);
public:
ArmorItems(Character *character) : InventoryItems(character, CATEGORY_ARMOR) {}
@@ -148,6 +167,8 @@ public:
};
class AccessoryItems : public InventoryItems {
+protected:
+ virtual Common::String getAttributes(XeenItem &item, const Common::String &classes);
public:
AccessoryItems(Character *character) : InventoryItems(character, CATEGORY_ACCESSORY) {}
@@ -157,6 +178,8 @@ public:
};
class MiscItems : public InventoryItems {
+protected:
+ virtual Common::String getAttributes(XeenItem &item, const Common::String &classes);
public:
MiscItems(Character *character) : InventoryItems(character, CATEGORY_MISC) {}
diff --git a/engines/xeen/dialogs_items.cpp b/engines/xeen/dialogs_items.cpp
index 46f07d4812..8466097691 100644
--- a/engines/xeen/dialogs_items.cpp
+++ b/engines/xeen/dialogs_items.cpp
@@ -117,10 +117,10 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
case ITEMMODE_BLACKSMITH:
_iconSprites.draw(screen, 11, Common::Point(182, 109));
break;
- case ITEMMODE_9:
+ case ITEMMODE_REPAIR:
_iconSprites.draw(screen, 15, Common::Point(250, 109));
break;
- case ITEMMODE_10:
+ case ITEMMODE_IDENTIFY:
_iconSprites.draw(screen, 13, Common::Point(216, 109));
break;
default:
@@ -230,8 +230,8 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
case ITEMMODE_2:
case ITEMMODE_RECHARGE:
case ITEMMODE_ENCHANT:
- case ITEMMODE_9:
- case ITEMMODE_10:
+ case ITEMMODE_REPAIR:
+ case ITEMMODE_IDENTIFY:
case ITEMMODE_TO_GOLD:
screen._windows[30].writeString(Common::String::format(X_FOR_Y,
CATEGORY_NAMES[category], startingChar->_name.c_str(),
@@ -269,10 +269,10 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
case ITEMMODE_2:
actionIndex = 1;
break;
- case ITEMMODE_9:
+ case ITEMMODE_REPAIR:
actionIndex = 3;
break;
- case ITEMMODE_10:
+ case ITEMMODE_IDENTIFY:
actionIndex = 2;
break;
default:
@@ -448,10 +448,10 @@ int ItemsDialog::calcItemCost(Character *c, int itemIndex, ItemsMode mode,
case ITEMMODE_TO_GOLD:
level = level == 0 ? 1 : 0;
break;
- case ITEMMODE_10:
+ case ITEMMODE_IDENTIFY:
level = 2;
break;
- case ITEMMODE_9:
+ case ITEMMODE_REPAIR:
level = 3;
break;
default:
@@ -496,8 +496,8 @@ int ItemsDialog::calcItemCost(Character *c, int itemIndex, ItemsMode mode,
switch (mode) {
case ITEMMODE_BLACKSMITH:
case ITEMMODE_2:
- case ITEMMODE_9:
- case ITEMMODE_10:
+ case ITEMMODE_REPAIR:
+ case ITEMMODE_IDENTIFY:
case ITEMMODE_TO_GOLD:
result = (amount1 + amount2 + amount3 + amount4) / ITEM_SKILL_DIVISORS[level];
if (!result)
@@ -518,8 +518,8 @@ int ItemsDialog::calcItemCost(Character *c, int itemIndex, ItemsMode mode,
switch (mode) {
case ITEMMODE_BLACKSMITH:
case ITEMMODE_2:
- case ITEMMODE_9:
- case ITEMMODE_10:
+ case ITEMMODE_REPAIR:
+ case ITEMMODE_IDENTIFY:
case ITEMMODE_TO_GOLD:
result = (amount1 + amount2 + amount3 + amount4) / ITEM_SKILL_DIVISORS[level];
if (!result)
@@ -603,6 +603,8 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite
}
if (itemIndex != -1) {
+ XeenItem &item = c._items[category][itemIndex];
+
switch (mode) {
case ITEMMODE_CHAR_INFO:
case ITEMMODE_8:
@@ -695,7 +697,6 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite
}
case ITEMMODE_2: {
- XeenItem &item = c._items[category][itemIndex];
bool noNeed;
switch (category) {
case CATEGORY_WEAPON:
@@ -742,20 +743,57 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite
return 2;
case ITEMMODE_ENCHANT: {
- Character *ps = &_itemsCharacter;
- ps->clear();
- int charges = _vm->getRandomNumber(1, _oldCharacter->getCurrentLevel() / 5 + 1);
- charges = MIN(charges, 5);
-
- switch (category) {
- case CATEGORY_WEAPON:
+ int amount = _vm->getRandomNumber(1, _oldCharacter->getCurrentLevel() / 5 + 1);
+ amount = MIN(amount, 5);
+ _oldCharacter->_items[category].enchantItem(itemIndex, amount);
+ break;
+ }
- default:
- break;
+ case ITEMMODE_REPAIR:
+ if (!(item._bonusFlags & ITEMFLAG_BROKEN)) {
+ ErrorScroll::show(_vm, ITEM_NOT_BROKEN);
+ } else {
+ int cost = calcItemCost(&c, itemIndex, mode, actionIndex, category);
+ Common::String msg = Common::String::format(FIX_IDENTIFY_GOLD,
+ FIX_IDENTIFY[0],
+ c._items[category].getFullDescription(itemIndex),
+ cost);
+
+ if (Confirm::show(_vm, msg) && party.subtract(0, cost, 0)) {
+ item._bonusFlags &= ~ITEMFLAG_BROKEN;
+ }
}
+ break;
- // TODO
- return 2;
+ case ITEMMODE_IDENTIFY: {
+ int cost = calcItemCost(&c, itemIndex, mode, actionIndex, category);
+ Common::String msg = Common::String::format(FIX_IDENTIFY_GOLD,
+ FIX_IDENTIFY[1],
+ c._items[category].getFullDescription(itemIndex),
+ cost);
+
+ if (Confirm::show(_vm, msg) && party.subtract(0, cost, 0)) {
+ Common::String details = c._items[category].getIdentifiedDetails(itemIndex);
+ Common::String desc = c._items[category].getFullDescription(itemIndex);
+ Common::String msg = Common::String::format(IDENTIFY_ITEM_MSG,
+ desc.c_str(), details.c_str());
+
+ Window &w = screen._windows[14];
+ w.open();
+ w.writeString(msg);
+ w.update();
+
+ saveButtons();
+ clearButtons();
+
+ while (!_vm->shouldQuit() && !events.isKeyMousePressed())
+ events.pollEventsAndWait();
+ events.clearEvents();
+
+ restoreButtons();
+ w.close();
+ }
+ break;
}
default:
diff --git a/engines/xeen/dialogs_items.h b/engines/xeen/dialogs_items.h
index dab26e6f82..42fe0158dc 100644
--- a/engines/xeen/dialogs_items.h
+++ b/engines/xeen/dialogs_items.h
@@ -32,7 +32,7 @@ namespace Xeen {
enum ItemsMode {
ITEMMODE_CHAR_INFO = 0, ITEMMODE_BLACKSMITH = 1, ITEMMODE_2 = 2, ITEMMODE_3 = 3,
ITEMMODE_RECHARGE = 4, ITEMMODE_5 = 5, ITEMMODE_ENCHANT = 6, ITEMMODE_COMBAT = 7, ITEMMODE_8 = 8,
- ITEMMODE_9 = 9, ITEMMODE_10 = 10, ITEMMODE_TO_GOLD = 11
+ ITEMMODE_REPAIR = 9, ITEMMODE_IDENTIFY = 10, ITEMMODE_TO_GOLD = 11
};
class ItemsDialog : public ButtonContainer {
diff --git a/engines/xeen/party.h b/engines/xeen/party.h
index 8da1163a5f..ec7a8b99e1 100644
--- a/engines/xeen/party.h
+++ b/engines/xeen/party.h
@@ -142,7 +142,7 @@ public:
void handleLight();
- int subtract(int mode, uint amount, int whereId, ErrorWaitType wait);
+ int subtract(int mode, uint amount, int whereId, ErrorWaitType wait = WT_FREEZE_WAIT);
void notEnough(int consumableId, int whereId, bool mode, ErrorWaitType wait);
};
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index 23eac4f1a2..55060c8743 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -592,6 +592,28 @@ const int ELEMENTAL_DAMAGE[37] = {
2, 4, 8, 16, 32, 2, 3, 4, 5, 10, 15, 20, 30, 5, 10, 25
};
+const int WEAPON_DAMAGE_BASE[35] = {
+ 0, 3, 2, 3, 2, 2, 4, 1, 2, 4, 2, 3,
+ 2, 2, 1, 1, 1, 1, 4, 4, 3, 2, 4, 2,
+ 2, 2, 5, 3, 3, 3, 3, 5, 4, 2, 6
+};
+
+const int WEAPON_DAMAGE_MULTIPLIER[35] = {
+ 0, 3, 3, 4, 5, 4, 2, 3, 3, 3, 3, 3,
+ 2, 4, 10, 6, 8, 9, 4, 3, 6, 8, 5, 6,
+ 4, 5, 3, 5, 6, 7, 2, 2, 2, 2, 4
+};
+
+const int METAL_DAMAGE[22] = {
+ -3, -6, -4, -2, 2, 4, 6, 8, 10, 0, 1,
+ 1, 2, 2, 3, 4, 5, 12, 15, 20, 30, 50
+};
+
+const int METAL_DAMAGE_PERCENT[22] = {
+ 253, 252, 3, 2, 1, 2, 3, 4, 6, 0, 1,
+ 1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10
+};
+
const int METAL_LAC[9] = { -3, 0, -2, -1, 1, 2, 4, 6, 8 };
const int ARMOR_STRENGTHS[14] = { 0, 2, 4, 5, 6, 7, 8, 10, 4, 2, 1, 1, 1, 1 };
@@ -791,6 +813,28 @@ const char *const GUILD_OPTIONS =
"\x03l\x09""000\x0B""090Gold"
"\x03r\x09""000%s\x02\x03""c\x0B""122\x09""040ESC\x01";
+const int MISC_SPELL_INDEX[74] = {
+ NO_SPELL, MS_Light, MS_Awaken, MS_MagicArrow,
+ MS_FirstAid, MS_FlyingFist, MS_EnergyBlast, MS_Sleep,
+ MS_Revitalize, MS_CureWounds, MS_Sparks, MS_Shrapmetal,
+ MS_InsectSpray, MS_ToxicCloud, MS_ProtFromElements, MS_Pain,
+ MS_Jump, MS_BeastMaster, MS_Clairvoyance, MS_TurnUndead,
+ MS_Levitate, MS_WizardEye, MS_Bless, MS_IdentifyMonster,
+ MS_LightningBolt, MS_HolyBonus, MS_PowerCure, MS_NaturesCure,
+ MS_LloydsBeacon, MS_PowerShield, MS_Heroism, MS_Hynotize,
+ MS_WalkOnWater, MS_FrostBite, MS_DetectMonster, MS_FireBall,
+ MS_ColdRay, MS_CurePoison, MS_AcidSpray, MS_TimeDistortion,
+ MS_DragonSleep, MS_CureDisease, MS_Teleport, MS_FingerOfDeath,
+ MS_CureParalysis, MS_GolemStopper, MS_PoisonVolley, MS_DeadlySwarm,
+ MS_SuperShelter, MS_DayOfProtection, MS_DayOfSorcery, MS_CreateFood,
+ MS_FieryFlail, MS_RechargeItem, MS_FantasticFreeze, MS_TownPortal,
+ MS_StoneToFlesh, MS_RaiseDead, MS_Etheralize, MS_DancingSword,
+ MS_MoonRay, MS_MassDistortion, MS_PrismaticLight, MS_EnchantItem,
+ MS_Incinerate, MS_HolyWord, MS_Resurrection, MS_ElementalStorm,
+ MS_MegaVolts, MS_Inferno, MS_SunRay, MS_Implosion,
+ MS_StarBurst, MS_DivineIntervention
+};
+
const int SPELL_COSTS[77] = {
8, 1, 5, -2, 5, -2, 20, 10, 12, 8, 3,
- 3, 75, 40, 12, 6, 200, 10, 100, 30, -1, 30,
@@ -1087,6 +1131,19 @@ const char *const MISC_NAMES[22] = {
"bogus", "bogus", "bogus", "bogus"
};
+const char *const ELEMENTAL_NAMES[6] = {
+ "Fire", "Elec", "Cold", "Acid/Poison", "Energy", "Magic"
+};
+
+const char *const ATTRIBUTE_NAMES[10] = {
+ "might", "Intellect", "Personality", "Speed", "accuracy", "Luck",
+ "Hit Points", "Spell Points", "Armor Class", "Thievery"
+};
+
+const char *const EFFECTIVENESS_NAMES[7] = {
+ nullptr, "Dragons", "Undead", "Golems", "Bugs", "Monsters", "Beasts"
+};
+
const int WEAPON_BASE_COSTS[35] = {
0, 50, 15, 100, 80, 40, 60, 1, 10, 150, 30, 60, 8, 50,
100, 15, 30, 15, 200, 80, 250, 150, 400, 100, 40, 120,
@@ -1195,4 +1252,33 @@ const char *const NOT_ENCHANTABLE = "\v012\t000\x03cNot Enchantable. %s";
const char *const SPELL_FAILED = "Spell Failed!";
+const char *const ITEM_NOT_BROKEN = "\fdThat item is not broken!";
+
+const char *const FIX_IDENTIFY[2] = { "Fix", "Identify" };
+
+const char *const FIX_IDENTIFY_GOLD = "\x3l\v000\t000%s %s\fd for %lu gold?";
+
+const char *const IDENTIFY_ITEM_MSG = "\fd\v000\t000\x3""cIdentify Item\x3l\n"
+ "\n"
+ "\v012%s\fd\n"
+ "\n"
+ "%s";
+
+const char *const ITEM_DETAILS =
+ "Proficient Classes\t132:\t140%s\n"
+ "to Hit Modifier\t132:\t140%s\n"
+ "Physical Damage\t132:\t140%s\n"
+ "Elemental Damage\t132:\t140%s\n"
+ "Elemental Resistance\t132:\t140%s\n"
+ "Armor Class Bonus\t132:\t140%s\n"
+ "Attribute Bonus\t132:\t140%s\n"
+ "Special Power\t132:\t140%s";
+
+const char *const ALL = "All";
+const char *const FIELD_NONE = "None";
+const char *const DAMAGE_X_TO_Y = "%d to %d";
+const char *const ELEMENTAL_XY_DAMAGE = "%+d %s Damage";
+const char *const ATTR_XY_BONUS = "%+d %s";
+const char *const EFFECTIVE_AGAINST = "x3 vs %s";
+
} // End of namespace Xeen
diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h
index 6e757bc00c..cab2af7c43 100644
--- a/engines/xeen/resources.h
+++ b/engines/xeen/resources.h
@@ -26,6 +26,7 @@
#include "common/scummsys.h"
#include "common/str-array.h"
#include "gui/debugger.h"
+#include "xeen/spells.h"
namespace Xeen {
@@ -172,6 +173,11 @@ extern const int ELEMENTAL_RESISTENCES[37];
extern const int ELEMENTAL_DAMAGE[37];
+extern const int WEAPON_DAMAGE_BASE[35];
+extern const int WEAPON_DAMAGE_MULTIPLIER[35];
+extern const int METAL_DAMAGE[22];
+extern const int METAL_DAMAGE_PERCENT[22];
+
extern const int METAL_LAC[9];
extern const int ARMOR_STRENGTHS[14];
@@ -250,6 +256,8 @@ extern const char *const BUY_SPELLS;
extern const char *const GUILD_OPTIONS;
+extern const int MISC_SPELL_INDEX[74];
+
extern const int SPELL_COSTS[77];
extern const int CLOUDS_SPELL_OFFSETS[5][20];
@@ -376,6 +384,9 @@ extern const char *const WEAPON_NAMES[35];
extern const char *const ARMOR_NAMES[14];
extern const char *const ACCESSORY_NAMES[11];
extern const char *const MISC_NAMES[22];
+extern const char *const ELEMENTAL_NAMES[6];
+extern const char *const ATTRIBUTE_NAMES[10];
+extern const char *const EFFECTIVENESS_NAMES[7];
extern const int WEAPON_BASE_COSTS[35];
extern const int ARMOR_BASE_COSTS[25];
@@ -444,6 +455,23 @@ extern const char *const SPELL_FAILED;
extern const char *const NOT_ENCHANTABLE;
+extern const char *const ITEM_NOT_BROKEN;
+
+extern const char *const FIX_IDENTIFY[2];
+
+extern const char *const FIX_IDENTIFY_GOLD;
+
+extern const char *const IDENTIFY_ITEM_MSG;
+
+extern const char *const ITEM_DETAILS;
+
+extern const char *const ALL;
+extern const char *const FIELD_NONE;
+extern const char *const DAMAGE_X_TO_Y;
+extern const char *const ELEMENTAL_XY_DAMAGE;
+extern const char *const ATTR_XY_BONUS;
+extern const char *const EFFECTIVE_AGAINST;
+
} // End of namespace Xeen
#endif /* XEEN_RESOURCES_H */
diff --git a/engines/xeen/spells.h b/engines/xeen/spells.h
index c2f9737c80..15389be599 100644
--- a/engines/xeen/spells.h
+++ b/engines/xeen/spells.h
@@ -32,6 +32,34 @@ class XeenEngine;
#define MAX_SPELLS_PER_CLASS 40
+enum MagicSpell {
+ MS_AcidSpray = 0, MS_Awaken = 1, MS_BeastMaster = 2, MS_Bless = 3,
+ MS_Clairvoyance = 4, MS_ColdRay = 5, MS_CreateFood = 6,
+ MS_CureDisease = 7, MS_CureParalysis = 8, MS_CurePoison = 9,
+ MS_CureWounds = 10, MS_DancingSword = 11, MS_DayOfProtection = 12,
+ MS_DayOfSorcery = 13, MS_DeadlySwarm = 14, MS_DetectMonster = 15,
+ MS_DivineIntervention = 16, MS_DragonSleep = 17, MS_ElementalStorm = 18,
+ MS_EnchantItem = 19, MS_EnergyBlast = 20, MS_Etheralize = 21,
+ MS_FantasticFreeze = 22, MS_FieryFlail = 23, MS_FingerOfDeath = 24,
+ MS_FireBall = 25, MS_FirstAid = 26, MS_FlyingFist = 27,
+ MS_FrostBite = 28, MS_GolemStopper = 29, MS_Heroism = 30,
+ MS_HolyBonus = 31, MS_HolyWord = 32, MS_Hynotize = 33,
+ MS_IdentifyMonster = 34, MS_Implosion = 35, MS_Incinerate = 36,
+ MS_Inferno = 37, MS_InsectSpray = 38, MS_ItemToGold = 39,
+ MS_Jump = 40, MS_Levitate = 41, MS_Light = 42, MS_LightningBolt = 43,
+ MS_LloydsBeacon = 44, MS_MagicArrow = 45, MS_MassDistortion = 46,
+ MS_MegaVolts = 47, MS_MoonRay = 48, MS_NaturesCure = 49, MS_Pain = 50,
+ MS_PoisonVolley = 51, MS_PowerCure = 52, MS_PowerShield = 53,
+ MS_PrismaticLight = 54, MS_ProtFromElements = 55, MS_RaiseDead = 56,
+ MS_RechargeItem = 57, MS_Resurrection = 58, MS_Revitalize = 59,
+ MS_Shrapmetal = 60, MS_Sleep = 61, MS_Sparks = 62, MS_StarBurst = 63,
+ MS_StoneToFlesh = 64, MS_SunRay = 65, MS_SuperShelter = 66,
+ MS_SuppressDisease = 67, MS_SuppressPoison = 68, MS_Teleport = 69,
+ MS_TimeDistortion = 70, MS_TownPortal = 71, MS_ToxicCloud = 72,
+ MS_TurnUndead = 73, MS_WalkOnWater = 74, MS_WizardEye = 75,
+ NO_SPELL = 76
+};
+
class Spells {
private:
XeenEngine *_vm;