XEEN: Comments for the Character class methods

This commit is contained in:
Paul Gilbert 2017-12-29 21:36:24 -05:00
parent 8f8166236c
commit 27c3e44551
3 changed files with 91 additions and 4 deletions

View File

@ -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 File

@ -104,14 +104,29 @@ public:
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 @@ public:
InventoryItems(Character *character, ItemCategory category);
virtual ~InventoryItems() {}
/**
* Clears the set of items
*/
void clear();
/**
@ -144,6 +162,9 @@ public:
virtual Common::String getFullDescription(int itemIndex, int displayNum = 15) = 0;
/**
* Returns the identified details for an item
*/
Common::String getIdentifiedDetails(int itemIndex);
/**
@ -151,6 +172,9 @@ public:
*/
bool discardItem(int itemIndex);
/**
* Equips an item
*/
virtual void equipItem(int itemIndex) {}
/**
@ -163,6 +187,9 @@ public:
*/
void sort();
/**
* Enchants an item
*/
virtual void enchantItem(int itemIndex, int amount);
/**
@ -189,6 +216,9 @@ public:
*/
virtual Common::String getFullDescription(int itemIndex, int displayNum);
/**
* Enchants a weapon
*/
virtual void enchantItem(int itemIndex, int amount);
};
@ -210,6 +240,9 @@ public:
*/
virtual Common::String getFullDescription(int itemIndex, int displayNum);
/**
* Enchants an armor
*/
virtual void enchantItem(int itemIndex, int amount);
};
@ -328,8 +361,14 @@ public:
public:
Character();
/**
* Clears the data for a character
*/
void clear();
/**
* Synchronizes data for the character
*/
void synchronize(Common::Serializer &s);
/**
@ -357,8 +396,14 @@ public:
*/
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 @@ public:
*/
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 @@ public:
*/
bool hasAward(int awardId) const;
/**
* Returns the character's armor class
*/
int getArmorClass(bool baseOnly = false) const;
/**
@ -397,16 +454,34 @@ public:
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 @@ public:
*/
int getNumAwards() const;
/**
* Creates an item and adds it to the inventory
*/
int makeItem(int p1, int itemIndex, int p3);
/**
@ -427,14 +505,23 @@ public:
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;
};

View File

@ -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,