Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: negative absorb percent #3228

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading