Skip to content

Commit

Permalink
NWN2: Set the situated object's defenses
Browse files Browse the repository at this point in the history
  • Loading branch information
rjshae authored and DrMcCoy committed Feb 18, 2019
1 parent 7ce06bd commit 66df1fa
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/engines/nwn2/situated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ namespace NWN2 {
Situated::Situated(ObjectType type) : Object(type), _appearanceID(Aurora::kFieldIDInvalid),
_soundAppType(Aurora::kFieldIDInvalid), _locked(false),
_lockable(false), _keyRequired(false), _autoRemove(false),
_openLockDC(18), _closeLockDC(0),
_openLockDC(18), _closeLockDC(0), _currentHP(15), _baseHP(16),
_hardness(5), _fortSave(16), _refSave(0), _willSave(0),
_lastOpenedBy(0), _lastClosedBy(0), _lastUsedBy(0) {

for (int i = 0; i < 3; i++)
Expand Down Expand Up @@ -178,6 +179,14 @@ void Situated::setLockKeyTag(const Common::UString &keyTag) {
_keyTag = keyTag;
}

int32 Situated::getCurrentHP() const {
return _currentHP;
}

int32 Situated::getMaxHP() const {
return _baseHP;
}

Object *Situated::getLastOpenedBy() const {
return _lastOpenedBy;
}
Expand Down Expand Up @@ -285,6 +294,14 @@ void Situated::loadProperties(const Aurora::GFF3Struct &gff) {
_keyTag = gff.getString("KeyName", _keyTag);
_keyFeedback = gff.getString("KeyReqFeedback", _keyFeedback);

// Defenses
_currentHP = gff.getUint("CurrentHP", _currentHP);
_baseHP = gff.getUint("HP", _baseHP);
_hardness = gff.getUint("Hardness", _hardness);
_fortSave = gff.getSint("Fort", _fortSave);
_refSave = gff.getSint("Ref", _refSave);
_willSave = gff.getSint("Will", _willSave);

// Tint
readTint(gff, _tint);

Expand Down
12 changes: 12 additions & 0 deletions src/engines/nwn2/situated.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ class Situated : public Object {
/** Set the tag of the key to unlock the situated object. */
virtual void setLockKeyTag(const Common::UString &keyTag);

/** Return the current HP this situated object has. */
int32 getCurrentHP() const;
/** Return the max HP this situated object can have. */
int32 getMaxHP() const;

/** Return the object that last opened this situated object. */
Object *getLastOpenedBy() const;
/** Return the object that last closed this situated object. */
Expand Down Expand Up @@ -99,6 +104,13 @@ class Situated : public Object {
uint8 _openLockDC; ///< DC to open the lock.
uint8 _closeLockDC; ///< DC to close the lock.

uint32 _currentHP; ///< Remaining hit points.
uint32 _baseHP; ///< Maximum hit points.
uint32 _hardness; ///< Resistance to damage.
int32 _fortSave; ///< Fortitude saving throw modifier.
int32 _refSave; ///< Reflex saving throw modifier.
int32 _willSave; ///< Willpower saving throw modifier.

Common::UString _keyTag; ///< Tag of the key that unlocks the situated object.
Common::UString _keyFeedback; ///< Feedback message on attempt to open without key.

Expand Down

0 comments on commit 66df1fa

Please sign in to comment.