Skip to content

Commit

Permalink
fix: negative absorb percent (#3228)
Browse files Browse the repository at this point in the history
Fixes #3218
  • Loading branch information
murilo09 authored Jan 9, 2025
1 parent 7c10e50 commit 15c60e2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3371,7 +3371,7 @@ BlockType_t Player::blockHit(const std::shared_ptr<Creature> &attacker, const Co
}
}

//
// Absorb Percent
const ItemType &it = Item::items[item->getID()];
if (it.abilities) {
int totalAbsorbPercent = 0;
Expand All @@ -3387,7 +3387,7 @@ BlockType_t Player::blockHit(const std::shared_ptr<Creature> &attacker, const Co
}
}

if (totalAbsorbPercent > 0) {
if (totalAbsorbPercent != 0) {
damage -= std::round(damage * (totalAbsorbPercent / 100.0));

const auto charges = item->getAttribute<uint16_t>(ItemAttribute_t::CHARGES);
Expand Down Expand Up @@ -9938,9 +9938,7 @@ void Player::onFollowCreatureDisappear(bool isLogout) {
}
}

// container
// container

// Container
void Player::onAddContainerItem(const std::shared_ptr<Item> &item) {
checkTradeState(item);
}
Expand Down

0 comments on commit 15c60e2

Please sign in to comment.