diff options
author | Warpten <vertozor@gmail.com> | 2012-12-21 19:37:50 +0100 |
---|---|---|
committer | Warpten <vertozor@gmail.com> | 2012-12-21 19:37:50 +0100 |
commit | cf99043c1ef446fc6394a295d8bb6dbb1a0566f3 (patch) | |
tree | 421190b21d487140b712ba1041f7d3838e3408ab | |
parent | a06a57a6c1f911d642dbbf499e70aa58990ba22c (diff) |
Core/StatsSystem: Fixed resilience being considered in non-PvP situations.
Also fixed build.
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 14c0040ec9e..222fa6c1c74 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -13800,9 +13800,7 @@ void Player::ApplyReforgeEnchantment(Item* item, bool apply) ApplyRatingMod(CR_CRIT_SPELL, int32(addValue), apply); break; case ITEM_MOD_RESILIENCE_RATING: - ApplyRatingMod(CR_CRIT_TAKEN_MELEE, int32(addValue), apply); - ApplyRatingMod(CR_CRIT_TAKEN_RANGED, int32(addValue), apply); - ApplyRatingMod(CR_CRIT_TAKEN_SPELL, int32(addValue), apply); + ApplyRatingMod(CR_RESILIENCE_PLAYER_DAMAGE_TAKEN, int32(addValue), apply); break; case ITEM_MOD_HASTE_RATING: ApplyRatingMod(CR_HASTE_MELEE, int32(addValue), apply); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 58566def5a9..4d2934f5842 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1224,7 +1224,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam damageInfo->HitInfo |= HITINFO_AFFECTS_VICTIM; int32 resilienceReduction = damageInfo->damage; - ApplyResilience(victim, &resilienceReduction, (damageInfo->hitOutCome == MELEE_HIT_CRIT)); + ApplyResilience(victim, &resilienceReduction, damageInfo->hitOutCome == MELEE_HIT_CRIT); resilienceReduction = damageInfo->damage - resilienceReduction; damageInfo->damage -= resilienceReduction; damageInfo->cleanDamage += resilienceReduction; @@ -15674,11 +15674,13 @@ void Unit::ApplyResilience(Unit const* victim, int32* damage, bool isCrit) const if (IsVehicle() || (victim->IsVehicle() && victim->GetTypeId() != TYPEID_PLAYER)) return; - Unit const* source = NULL; - if (GetTypeId() == TYPEID_PLAYER) - source = this; - else if (GetTypeId() == TYPEID_UNIT && GetOwner() && GetOwner()->GetTypeId() == TYPEID_PLAYER) - source = GetOwner(); + // Don't consider resilience if not in PvP - player or pet + bool isAllowedSource = (GetTypeId() == TYPEID_PLAYER); + if (!isAllowedSource && GetTypeId() == TYPEID_UNIT && GetOwner() && GetOwner()->GetTypeId() == TYPEID_PLAYER) + isAllowedSource = true; + + if (!isAllowedSource) + return; Unit const* target = NULL; if (victim->GetTypeId() == TYPEID_PLAYER) @@ -15691,7 +15693,7 @@ void Unit::ApplyResilience(Unit const* victim, int32* damage, bool isCrit) const if (isCrit) *damage = target->GetCritDamageReduction(*damage); - * damage = target->GetDamageReduction(*damage); + *damage = target->GetDamageReduction(*damage); } // Melee based spells can be miss, parry or dodge on this step |