Permalink
Browse files

XEEN: Comments for the Character class methods

  • Loading branch information...
dreammaster committed Dec 30, 2017
1 parent 8f81662 commit 27c3e44551870339cd9709f06d8200933d4406f5
Showing with 91 additions and 4 deletions.
  1. +1 −1 engines/xeen/character.cpp
  2. +89 −2 engines/xeen/character.h
  3. +1 −1 engines/xeen/dialogs_party.cpp
@@ -1818,7 +1818,7 @@ void Character::subtractHitPoints(int amount) {
}
}
bool Character::hasSpecialItem() const {
bool Character::hasSlayerSword() const {
for (uint idx = 0; idx < INV_ITEMS_TOTAL; ++idx) {
if (_weapons[idx]._id == 34)
// Character has Xeen Slayer sword
View
@@ -104,14 +104,29 @@ class XeenItem {
public:
XeenItem();
/**
* Clear the data for the item
*/
void clear();
/**
* Returns true if no item is set
*/
bool empty() const { return _id != 0; }
/**
* Synchronizes the data for the item
*/
void synchronize(Common::Serializer &s);
/**
* Gets the elemental category for the item
*/
ElementalCategory getElementalCategory() const;
/**
* Gets the attribute category for the item
*/
AttributeCategory getAttributeCategory() const;
};
@@ -130,6 +145,9 @@ class InventoryItems : public Common::Array<XeenItem> {
InventoryItems(Character *character, ItemCategory category);
virtual ~InventoryItems() {}
/**
* Clears the set of items
*/
void clear();
/**
@@ -144,13 +162,19 @@ class InventoryItems : public Common::Array<XeenItem> {
virtual Common::String getFullDescription(int itemIndex, int displayNum = 15) = 0;
/**
* Returns the identified details for an item
*/
Common::String getIdentifiedDetails(int itemIndex);
/**
* Discard an item from the inventory
*/
bool discardItem(int itemIndex);
/**
* Equips an item
*/
virtual void equipItem(int itemIndex) {}
/**
@@ -163,6 +187,9 @@ class InventoryItems : public Common::Array<XeenItem> {
*/
void sort();
/**
* Enchants an item
*/
virtual void enchantItem(int itemIndex, int amount);
/**
@@ -189,6 +216,9 @@ class WeaponItems: public InventoryItems {
*/
virtual Common::String getFullDescription(int itemIndex, int displayNum);
/**
* Enchants a weapon
*/
virtual void enchantItem(int itemIndex, int amount);
};
@@ -210,6 +240,9 @@ class ArmorItems : public InventoryItems {
*/
virtual Common::String getFullDescription(int itemIndex, int displayNum);
/**
* Enchants an armor
*/
virtual void enchantItem(int itemIndex, int amount);
};
@@ -328,8 +361,14 @@ class Character {
public:
Character();
/**
* Clears the data for a character
*/
void clear();
/**
* Synchronizes data for the character
*/
void synchronize(Common::Serializer &s);
/**
@@ -357,8 +396,14 @@ class Character {
*/
int getAge(bool ignoreTemp = false) const;
/**
* Gets the maximum hit points for a character
*/
int getMaxHP() const;
/**
* Gets the maximum spell points for a character
*/
int getMaxSP() const;
/**
@@ -372,10 +417,19 @@ class Character {
*/
static int statColor(int amount, int threshold);
/**
* Returns the bonus the character gets for stats
*/
int statBonus(uint statValue) const;
/**
* Returns true if the character passes a saving throw for a given attack type
*/
bool charSavingThrow(DamageType attackType) const;
/**
* Returns true if the character is unable to perform any action
*/
bool noActions();
/**
@@ -388,6 +442,9 @@ class Character {
*/
bool hasAward(int awardId) const;
/**
* Returns the character's armor class
*/
int getArmorClass(bool baseOnly = false) const;
/**
@@ -397,16 +454,34 @@ class Character {
uint getCurrentLevel() const;
/**
* Scans the character's inventory for the given item
*/
int itemScan(int itemId) const;
/**
* Sets various attributes of a character
*/
void setValue(int id, uint value);
/**
* Returns true if the character is a member of the current town's guild
*/
bool guildMember() const;
/**
* Returns the experience required to reach the next level
*/
uint experienceToNextLevel() const;
/**
* Returns the next level the character will reach
*/
uint nextExperienceLevel() const;
/**
* Returns the character's current experience
*/
uint getCurrentExperience() const;
/**
@@ -419,6 +494,9 @@ class Character {
*/
int getNumAwards() const;
/**
* Creates an item and adds it to the inventory
*/
int makeItem(int p1, int itemIndex, int p3);
/**
@@ -427,14 +505,23 @@ class Character {
void addHitPoints(int amount);
/**
* Remove hit points fromo the character
* Remove hit points from the character
*/
void subtractHitPoints(int amount);
bool hasSpecialItem() const;
/**
* Returns true if the character has the Xeen Slayer Sword
*/
bool hasSlayerSword() const;
/**
* Returns true if the character has a missile weapon, such as a bow
*/
bool hasMissileWeapon() const;
/**
* Returns a category index for a character, used such for indexing into spell data
*/
int getClassCategory() const;
};
@@ -222,7 +222,7 @@ void PartyDialog::execute() {
if (charButtonValue != 0) {
int charIndex = charButtonValue - Common::KEYCODE_1 + startingChar;
Character &c = party._roster[_charList[charIndex]];
if (c.hasSpecialItem()) {
if (c.hasSlayerSword()) {
ErrorScroll::show(_vm, Res.HAS_SLAYER_SWORD);
} else {
Common::String msg = Common::String::format(Res.SURE_TO_DELETE_CHAR,

0 comments on commit 27c3e44

Please sign in to comment.