Skip to content

Commit

Permalink
missing file changes
Browse files Browse the repository at this point in the history
  • Loading branch information
luan committed Jan 1, 2024
1 parent d58aafd commit ce5ecd4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/creatures/combat/condition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,9 @@ bool ConditionDamage::getNextDamage(int32_t &damage) {
}

bool ConditionDamage::doDamage(std::shared_ptr<Creature> creature, int32_t healthChange) {
if (creature->isSuppress(getType())) {
auto attacker = g_game().getPlayerByGUID(owner) ? g_game().getPlayerByGUID(owner)->getCreature() : g_game().getCreatureByID(owner);
bool isPlayer = attacker && attacker->getPlayer();
if (creature->isSuppress(getType(), isPlayer)) {
return true;
}

Expand All @@ -1653,7 +1655,6 @@ bool ConditionDamage::doDamage(std::shared_ptr<Creature> creature, int32_t healt
damage.primary.value = healthChange;
damage.primary.type = Combat::ConditionToDamageType(conditionType);

std::shared_ptr<Creature> attacker = g_game().getCreatureByID(owner);
if (field && creature->getPlayer() && attacker && attacker->getPlayer()) {
damage.primary.value = static_cast<int32_t>(std::round(damage.primary.value / 2.));
}
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ void Creature::executeConditions(uint32_t interval) {

bool Creature::hasCondition(ConditionType_t type, uint32_t subId /* = 0*/) const {
metrics::method_latency measure(__METHOD_NAME__);
if (isSuppress(type)) {
if (isSuppress(type, false)) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/creatures/creature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ class Creature : virtual public Thing, public SharedObject {
virtual bool isImmune(ConditionType_t type) const {
return false;
}
virtual bool isSuppress(ConditionType_t type) const {
virtual bool isSuppress(ConditionType_t type, bool attackerPlayer) const {
return false;
};

Expand Down
2 changes: 1 addition & 1 deletion src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ float Player::getDefenseFactor() const {
uint32_t Player::getClientIcons() {
uint32_t icons = 0;
for (const auto &condition : conditions) {
if (!isSuppress(condition->getType())) {
if (!isSuppress(condition->getType(), false)) {
icons |= condition->getIcons();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/players/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2920,7 +2920,7 @@ class Player final : public Creature, public Cylinder, public Bankable {
return skillLoss ? static_cast<uint64_t>(experience * getLostPercent()) : 0;
}

bool isSuppress(ConditionType_t conditionType) const override;
bool isSuppress(ConditionType_t conditionType, bool attackerPlayer) const override;
void addConditionSuppression(const std::array<ConditionType_t, ConditionType_t::CONDITION_COUNT> &addConditions);

uint16_t getLookCorpse() const override;
Expand Down

0 comments on commit ce5ecd4

Please sign in to comment.