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
@@ -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;
@@ -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);
@@ -9938,9 +9938,7 @@ void Player::onFollowCreatureDisappear(bool isLogout) {
}
}

// container
// container

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

Unchanged files with check annotations Beta

uint64_t totalPrice = price * amount;
uint64_t totalFee = totalPrice * 0.02;
uint64_t maxFee = std::min<uint64_t>(1000000, totalFee);

Check warning on line 9058 in src/game/game.cpp

GitHub Actions / ubuntu-22.04-linux-debug

unused variable ‘maxFee’ [-Wunused-variable]

Check warning on line 9058 in src/game/game.cpp

GitHub Actions / ubuntu-24.04-linux-debug

unused variable ‘maxFee’ [-Wunused-variable]
uint64_t fee = std::max<uint64_t>(20, totalFee);
if (type == MARKETACTION_SELL) {
&& centerPos.x - specPos.x <= maxRangeX
&& centerPos.y - specPos.y <= maxRangeY
&& (multifloor || specPos.z == centerPos.z)
&& ((onlyPlayers && creature->getPlayer())

Check warning on line 66 in src/map/spectators.cpp

GitHub Actions / ubuntu-22.04-linux-debug

suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

Check warning on line 66 in src/map/spectators.cpp

GitHub Actions / ubuntu-24.04-linux-debug

suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
|| (onlyMonsters && creature->getMonster())
|| (onlyNpcs && creature->getNpc()))
|| (!onlyPlayers && !onlyMonsters && !onlyNpcs))) {
specs.creatures.reserve(creatures.size());
for (const auto &c : creatures) {
if ((c->getMonster() != nullptr && !c->getMaster() || !c->getMaster()->getPlayer())) {

Check warning on line 260 in src/map/spectators.cpp

GitHub Actions / ubuntu-22.04-linux-debug

suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

Check warning on line 260 in src/map/spectators.cpp

GitHub Actions / ubuntu-24.04-linux-debug

suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
specs.insert(c);
}
}