diff options
Diffstat (limited to 'engines/xeen/character.cpp')
-rw-r--r-- | engines/xeen/character.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp index 4e4a4da697..fb1447d84c 100644 --- a/engines/xeen/character.cpp +++ b/engines/xeen/character.cpp @@ -1757,5 +1757,33 @@ int Character::makeItem(int p1, int itemIndex, int p3) { return category; } +void Character::subtractHitPoints(int amount) { + SoundManager &sound = *Party::_vm->_sound; + _currentHp -= amount; + bool flag = _currentHp <= 10; + + if (_currentHp < 1) { + int v = getMaxHP() + _currentHp; + if (v >= 1) { + _conditions[UNCONSCIOUS] = 1; + sound.playFX(38);; + } else { + _conditions[DEAD] = 1; + flag = true; + if (_currentHp > 0) + _currentHp = 0; + } + + if (flag) { + // Check for breaking equipped armor + for (int idx = 0; idx < INV_ITEMS_TOTAL; ++idx) { + XeenItem &item = _armor[idx]; + if (item._id && item._frame) + item._bonusFlags |= ITEMFLAG_BROKEN; + } + } + } +} + } // End of namespace Xeen |