Beispiel #1
0
void ClientObjectType::calculateAndInitStrength() {
  auto isNPC = classTag() == 'n';
  if (isNPC) return;
  if (_strength.item == nullptr || _strength.quantity == 0)
    maxHealth(1);
  else
    maxHealth(_strength.item->strength() * _strength.quantity);
}
Beispiel #2
0
void PlayerObject::setHealth(uint h) {
  if (h < 0) {
    m_health = 0;
  } else if (h > maxHealth()) {
    m_health = maxHealth();
  } else {
    m_health = h;
  }
  emit healthChanged();
}