aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Unit/StatSystem.cpp127
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp155
-rw-r--r--src/server/game/Entities/Unit/Unit.h5
3 files changed, 144 insertions, 143 deletions
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index c48fbd73887..023bfa74dc2 100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -651,7 +651,7 @@ void Player::UpdateAllCritPercentages()
UpdateCritPercentage(RANGED_ATTACK);
}
-const float m_diminishing_k[MAX_CLASSES] =
+float const m_diminishing_k[MAX_CLASSES] =
{
0.9560f, // Warrior
0.9560f, // Paladin
@@ -666,53 +666,75 @@ const float m_diminishing_k[MAX_CLASSES] =
0.9720f // Druid
};
-float Player::GetMissPercentageFromDefense() const
+// helper function
+float CalculateDiminishingReturns(float const (&capArray)[MAX_CLASSES], uint8 playerClass, float nonDiminishValue, float diminishValue)
{
- float const miss_cap[MAX_CLASSES] =
- {
- 16.00f, // Warrior //correct
- 16.00f, // Paladin //correct
- 16.00f, // Hunter //?
- 16.00f, // Rogue //?
- 16.00f, // Priest //?
- 16.00f, // DK //correct
- 16.00f, // Shaman //?
- 16.00f, // Mage //?
- 16.00f, // Warlock //?
- 0.0f, // ??
- 16.00f // Druid //?
- };
+ // 1 1 k cx
+ // --- = --- + --- <=> x' = --------
+ // x' c x x + ck
+
+ // where:
+ // k is m_diminishing_k for that class
+ // c is capArray for that class
+ // x is chance before DR (diminishValue)
+ // x' is chance after DR (our result)
+
+ uint32 const classIdx = playerClass - 1;
+
+ float const k = m_diminishing_k[classIdx];
+ float const c = capArray[classIdx];
+
+ float result = c * diminishValue / (diminishValue + c * k);
+ result += nonDiminishValue;
+ return result;
+}
+
+float const miss_cap[MAX_CLASSES] =
+{
+ 16.00f, // Warrior //correct
+ 16.00f, // Paladin //correct
+ 16.00f, // Hunter //?
+ 16.00f, // Rogue //?
+ 16.00f, // Priest //?
+ 16.00f, // DK //correct
+ 16.00f, // Shaman //?
+ 16.00f, // Mage //?
+ 16.00f, // Warlock //?
+ 0.0f, // ??
+ 16.00f // Druid //?
+};
+float Player::GetMissPercentageFromDefense() const
+{
float diminishing = 0.0f, nondiminishing = 0.0f;
// Modify value from defense skill (only bonus from defense rating diminishes)
nondiminishing += (GetSkillValue(SKILL_DEFENSE) - GetMaxSkillValueForLevel()) * 0.04f;
diminishing += (int32(GetRatingBonusValue(CR_DEFENSE_SKILL))) * 0.04f;
// apply diminishing formula to diminishing miss chance
- uint32 pclass = getClass()-1;
- return nondiminishing + (diminishing * miss_cap[pclass] / (diminishing + miss_cap[pclass] * m_diminishing_k[pclass]));
+ return CalculateDiminishingReturns(miss_cap, getClass(), nondiminishing, diminishing);
}
-void Player::UpdateParryPercentage()
+float const parry_cap[MAX_CLASSES] =
{
- const float parry_cap[MAX_CLASSES] =
- {
- 47.003525f, // Warrior
- 47.003525f, // Paladin
- 145.560408f, // Hunter
- 145.560408f, // Rogue
- 0.0f, // Priest
- 47.003525f, // DK
- 145.560408f, // Shaman
- 0.0f, // Mage
- 0.0f, // Warlock
- 0.0f, // ??
- 0.0f // Druid
- };
+ 47.003525f, // Warrior
+ 47.003525f, // Paladin
+ 145.560408f, // Hunter
+ 145.560408f, // Rogue
+ 0.0f, // Priest
+ 47.003525f, // DK
+ 145.560408f, // Shaman
+ 0.0f, // Mage
+ 0.0f, // Warlock
+ 0.0f, // ??
+ 0.0f // Druid
+};
+void Player::UpdateParryPercentage()
+{
// No parry
float value = 0.0f;
- uint32 pclass = getClass()-1;
+ uint32 pclass = getClass() - 1;
if (CanParry() && parry_cap[pclass] > 0.0f)
{
float nondiminishing = 5.0f;
@@ -723,8 +745,9 @@ void Player::UpdateParryPercentage()
diminishing += (int32(GetRatingBonusValue(CR_DEFENSE_SKILL))) * 0.04f;
// Parry from SPELL_AURA_MOD_PARRY_PERCENT aura
nondiminishing += GetTotalAuraModifier(SPELL_AURA_MOD_PARRY_PERCENT);
+
// apply diminishing formula to diminishing parry chance
- value = nondiminishing + diminishing * parry_cap[pclass] / (diminishing + parry_cap[pclass] * m_diminishing_k[pclass]);
+ value = CalculateDiminishingReturns(parry_cap, getClass(), nondiminishing, diminishing);
if (sWorld->getBoolConfig(CONFIG_STATS_LIMITS_ENABLE))
value = value > sWorld->getFloatConfig(CONFIG_STATS_LIMITS_PARRY) ? sWorld->getFloatConfig(CONFIG_STATS_LIMITS_PARRY) : value;
@@ -734,23 +757,23 @@ void Player::UpdateParryPercentage()
SetStatFloatValue(PLAYER_PARRY_PERCENTAGE, value);
}
-void Player::UpdateDodgePercentage()
+float const dodge_cap[MAX_CLASSES] =
{
- const float dodge_cap[MAX_CLASSES] =
- {
- 88.129021f, // Warrior
- 88.129021f, // Paladin
- 145.560408f, // Hunter
- 145.560408f, // Rogue
- 150.375940f, // Priest
- 88.129021f, // DK
- 145.560408f, // Shaman
- 150.375940f, // Mage
- 150.375940f, // Warlock
- 0.0f, // ??
- 116.890707f // Druid
- };
+ 88.129021f, // Warrior
+ 88.129021f, // Paladin
+ 145.560408f, // Hunter
+ 145.560408f, // Rogue
+ 150.375940f, // Priest
+ 88.129021f, // DK
+ 145.560408f, // Shaman
+ 150.375940f, // Mage
+ 150.375940f, // Warlock
+ 0.0f, // ??
+ 116.890707f // Druid
+};
+void Player::UpdateDodgePercentage()
+{
float diminishing = 0.0f, nondiminishing = 0.0f;
GetDodgeFromAgility(diminishing, nondiminishing);
// Modify value from defense skill (only bonus from defense rating diminishes)
@@ -760,9 +783,9 @@ void Player::UpdateDodgePercentage()
nondiminishing += GetTotalAuraModifier(SPELL_AURA_MOD_DODGE_PERCENT);
// Dodge from rating
diminishing += GetRatingBonusValue(CR_DODGE);
+
// apply diminishing formula to diminishing dodge chance
- uint32 pclass = getClass()-1;
- float value = nondiminishing + (diminishing * dodge_cap[pclass] / (diminishing + dodge_cap[pclass] * m_diminishing_k[pclass]));
+ float value = CalculateDiminishingReturns(dodge_cap, getClass(), nondiminishing, diminishing);
if (sWorld->getBoolConfig(CONFIG_STATS_LIMITS_ENABLE))
value = value > sWorld->getFloatConfig(CONFIG_STATS_LIMITS_DODGE) ? sWorld->getFloatConfig(CONFIG_STATS_LIMITS_DODGE) : value;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 4d07634a97a..e6535c72509 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -1491,27 +1491,22 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
GetTypeId() != TYPEID_PLAYER && !ToCreature()->IsControlledByPlayer() && !victim->HasInArc(float(M_PI), this)
&& (victim->GetTypeId() == TYPEID_PLAYER || !victim->ToCreature()->isWorldBoss())&& !victim->IsVehicle())
{
- // -probability is between 0% and 40%
// 20% base chance
- float Probability = 20.0f;
+ float chance = 20.0f;
// there is a newbie protection, at level 10 just 7% base chance; assuming linear function
if (victim->getLevel() < 30)
- Probability = 0.65f * victim->getLevel() + 0.5f;
-
- uint32 VictimDefense=victim->GetDefenseSkillValue();
- uint32 AttackerMeleeSkill=GetUnitMeleeSkill();
-
- Probability *= AttackerMeleeSkill/(float)VictimDefense*0.16f;
+ chance = 0.65f * victim->getLevel() + 0.5f;
- if (Probability < 0)
- Probability = 0;
+ uint32 const victimDefense = victim->GetDefenseSkillValue();
+ uint32 const attackerMeleeSkill = GetMaxSkillValueForLevel();
- if (Probability > 40.0f)
- Probability = 40.0f;
+ chance *= attackerMeleeSkill / float(victimDefense) * 0.16f;
- if (roll_chance_f(Probability))
- CastSpell(victim, 1604, true);
+ // -probability is between 0% and 40%
+ RoundToInterval(chance, 0.0f, 40.0f);
+ if (roll_chance_f(chance))
+ CastSpell(victim, 1604 /*SPELL_DAZED*/, true);
}
if (GetTypeId() == TYPEID_PLAYER)
@@ -1688,29 +1683,28 @@ uint32 Unit::CalcSpellResistedDamage(Unit* victim, uint32 damage, SpellSchoolMas
return 0;
}
- float averageResist = Unit::GetEffectiveResistChance(this, schoolMask, victim, spellInfo);
-
- float discreteResistProbability[11];
- for (uint32 i = 0; i < 11; ++i)
- {
- discreteResistProbability[i] = 0.5f - 2.5f * std::fabs(0.1f * i - averageResist);
- if (discreteResistProbability[i] < 0.0f)
- discreteResistProbability[i] = 0.0f;
- }
+ float const averageResist = CalculateAverageResistReduction(schoolMask, victim, spellInfo);
+ float discreteResistProbability[11] = { };
if (averageResist <= 0.1f)
{
discreteResistProbability[0] = 1.0f - 7.5f * averageResist;
discreteResistProbability[1] = 5.0f * averageResist;
discreteResistProbability[2] = 2.5f * averageResist;
}
+ else
+ {
+ for (uint32 i = 0; i < 11; ++i)
+ discreteResistProbability[i] = std::max(0.5f - 2.5f * std::fabs(0.1f * i - averageResist), 0.0f);
+ }
- uint32 resistance = 0;
- float r = float(rand_norm());
- float probabilitySum = discreteResistProbability[0];
+ float roll = float(rand_norm());
+ float probabilitySum = 0.0f;
- while (r >= probabilitySum && resistance < 10)
- probabilitySum += discreteResistProbability[++resistance];
+ uint32 resistance = 0;
+ for (; resistance < 11; ++resistance)
+ if (roll < (probabilitySum += discreteResistProbability[resistance]))
+ break;
float damageResisted = damage * resistance / 10.f;
if (damageResisted > 0.0f) // if any damage was resisted
@@ -1732,31 +1726,31 @@ uint32 Unit::CalcSpellResistedDamage(Unit* victim, uint32 damage, SpellSchoolMas
if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC))
{
uint32 damageAfterArmor = CalcArmorReducedDamage(victim, damage, spellInfo, BASE_ATTACK);
- uint32 armorReduction = damage - damageAfterArmor;
- if (armorReduction < damageResisted) // pick the lower one, the weakest resistance counts
- damageResisted = armorReduction;
+ float armorReduction = damage - damageAfterArmor;
+
+ // pick the lower one, the weakest resistance counts
+ damageResisted = std::min(damageResisted, armorReduction);
}
}
- return damageResisted;
+ damageResisted = std::max(damageResisted, 0.f);
+ return uint32(damageResisted);
}
-float Unit::GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo)
+float Unit::CalculateAverageResistReduction(SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo) const
{
float victimResistance = float(victim->GetResistance(schoolMask));
- if (owner)
+
+ // pets inherit 100% of masters penetration
+ // excluding traps
+ Player const* player = GetSpellModOwner();
+ if (player && GetEntry() != WORLD_TRIGGER)
{
- // pets inherit 100% of masters penetration
- // excluding traps
- Player const* player = owner->GetSpellModOwner();
- if (player && owner->GetEntry() != WORLD_TRIGGER)
- {
- victimResistance += float(player->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
- victimResistance -= float(player->GetSpellPenetrationItemMod());
- }
- else
- victimResistance += float(owner->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
+ victimResistance += float(player->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
+ victimResistance -= float(player->GetSpellPenetrationItemMod());
}
+ else
+ victimResistance += float(GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
// holy resistance exists in pve and comes from level difference, ignore template values
if (schoolMask & SPELL_SCHOOL_MASK_HOLY)
@@ -1767,8 +1761,10 @@ float Unit::GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMa
victimResistance = 0.0f;
victimResistance = std::max(victimResistance, 0.0f);
- if (owner)
- victimResistance += std::max((float(victim->getLevelForTarget(owner)) - float(owner->getLevelForTarget(victim))) * 5.0f, 0.0f);
+
+ // level-based resistance does not apply to binary spells, and cannot be overcome by spell penetration
+ if (!spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL))
+ victimResistance += std::max((float(victim->getLevelForTarget(this)) - float(getLevelForTarget(victim))) * 5.0f, 0.0f);
static uint32 const BOSS_LEVEL = 83;
static float const BOSS_RESISTANCE_CONSTANT = 510.0f;
@@ -2180,8 +2176,14 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy
if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())
return MELEE_HIT_EVADE;
+ int32 const attackerMaxSkillValueForLevel = GetMaxSkillValueForLevel(victim);
+ int32 const victimMaxSkillValueForLevel = victim->GetMaxSkillValueForLevel(this);
+
+ int32 const attackerWeaponSkill = GetWeaponSkillValue(attType, victim);
+ int32 const victimDefenseSkill = victim->GetDefenseSkillValue(this);
+
// Miss chance based on melee
- int32 miss_chance = int32(MeleeSpellMissChance(victim, attType, int32(GetWeaponSkillValue(attType, victim)) - int32(GetMaxSkillValueForLevel(this)), 0) * 100.0f);
+ int32 miss_chance = int32(MeleeSpellMissChance(victim, attType, attackerWeaponSkill - victimMaxSkillValueForLevel, 0) * 100.0f);
// Critical hit chance
int32 crit_chance = int32(GetUnitCriticalChance(attType, victim) * 100.0f);
@@ -2195,12 +2197,6 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy
// 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8.
// MISS > DODGE > PARRY > GLANCING > BLOCK > CRIT > CRUSHING > HIT
- int32 attackerMaxSkillValueForLevel = GetMaxSkillValueForLevel(victim);
- int32 victimMaxSkillValueForLevel = victim->GetMaxSkillValueForLevel(this);
-
- int32 attackerWeaponSkill = GetWeaponSkillValue(attType, victim);
- int32 victimDefenseSkill = victim->GetDefenseSkillValue(this);
-
int32 sum = 0, tmp = 0;
int32 roll = urand(0, 9999);
@@ -2598,7 +2594,6 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo
return SPELL_MISS_NONE;
}
-/// @todo need use unit spell resistances in calculations
SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo) const
{
// Can`t miss on dead target (on skinning for example)
@@ -2646,12 +2641,11 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo
int32 tmp = 10000 - HitChance;
int32 rand = irand(0, 9999);
- if (rand < tmp)
+ if (tmp > 0 && rand < tmp)
return SPELL_MISS_MISS;
// Chance resist mechanic (select max value from every mechanic spell effect)
int32 resist_chance = victim->GetMechanicResistChance(spellInfo) * 100;
- tmp += resist_chance;
// Chance resist debuff
if (!spellInfo->IsPositive() && !spellInfo->HasAttribute(SPELL_ATTR4_IGNORE_RESISTANCES))
@@ -2667,27 +2661,22 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo
}
if (hasAura)
- {
- tmp += victim->GetMaxPositiveAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, static_cast<int32>(spellInfo->Dispel)) * 100;
- tmp += victim->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, static_cast<int32>(spellInfo->Dispel)) * 100;
- }
+ resist_chance += victim->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, static_cast<int32>(spellInfo->Dispel)) * 100;
- // resistance for binary spells
- if (spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL) == 0)
- if ((spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_HOLY) == 0 || victim->GetTypeId() == TYPEID_UNIT)
- tmp += int32(Unit::GetEffectiveResistChance(this, spellInfo->GetSchoolMask(), victim, spellInfo) * 10000.0f); // 100 for spell calculations, and 100 for return value percentage
+ // resistance chance for binary spells, equals to average damage reduction of non-binary spell
+ if (spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_MAGIC))
+ resist_chance += int32(CalculateAverageResistReduction(spellInfo->GetSchoolMask(), victim, spellInfo) * 10000.f); // 100 for spell calculations, and 100 for return value percentage
}
// Roll chance
- if (rand < tmp)
+ if (resist_chance > 0 && rand < (tmp += resist_chance))
return SPELL_MISS_RESIST;
// cast by caster in front of victim
if (!victim->HasUnitState(UNIT_STATE_CONTROLLED) && (victim->HasInArc(float(M_PI), this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)))
{
int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
- tmp += deflect_chance;
- if (rand < tmp)
+ if (deflect_chance > 0 && rand < (tmp += deflect_chance))
return SPELL_MISS_DEFLECT;
}
@@ -2766,11 +2755,6 @@ uint32 Unit::GetShieldBlockValue(uint32 soft_cap, uint32 hard_cap) const
return value;
}
-uint32 Unit::GetUnitMeleeSkill(Unit const* target) const
-{
- return (target ? getLevelForTarget(target) : getLevel()) * 5;
-}
-
uint32 Unit::GetDefenseSkillValue(Unit const* target) const
{
if (GetTypeId() == TYPEID_PLAYER)
@@ -2783,7 +2767,7 @@ uint32 Unit::GetDefenseSkillValue(Unit const* target) const
return value;
}
else
- return GetUnitMeleeSkill(target);
+ return GetMaxSkillValueForLevel(target);
}
float Unit::GetUnitDodgeChance(WeaponAttackType attType, Unit const* victim) const
@@ -2877,7 +2861,7 @@ float Unit::GetUnitParryChance(WeaponAttackType attType, Unit const* victim) con
float Unit::GetUnitMissChance(WeaponAttackType attType) const
{
- float miss_chance = 5.00f;
+ float miss_chance = 5.0f;
if (Player const* player = ToPlayer())
miss_chance += player->GetMissPercentageFromDefense();
@@ -3041,7 +3025,7 @@ uint32 Unit::GetWeaponSkillValue(WeaponAttackType attType, Unit const* target) c
}
}
else
- value = GetUnitMeleeSkill(target);
+ value = GetMaxSkillValueForLevel(target);
return value;
}
@@ -13035,13 +13019,14 @@ void Unit::ApplyResilience(Unit const* victim, float* crit, int32* damage, bool
// Melee based spells can be miss, parry or dodge on this step
// Crit or block - determined on damage calculation phase! (and can be both in some time)
-float Unit::MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
+float Unit::MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
{
//calculate miss chance
float missChance = victim->GetUnitMissChance(attType);
+ // melee attacks while dual wielding have +19% chance to miss
if (!spellId && haveOffhandWeapon())
- missChance += 19;
+ missChance += 19.0f;
// bonus from skills is 0.04%
//miss_chance -= skillDiff * 0.04f;
@@ -13051,17 +13036,14 @@ float Unit::MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, i
else
missChance += diff > 10 ? 1 + (diff - 10) * 0.4f : diff * 0.1f;
- // Calculate hit chance
- float hitChance = 100.0f;
-
// Spellmod from SPELLMOD_RESIST_MISS_CHANCE
+ float resistMissChance = 100.0f;
if (spellId)
{
if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod<SPELLMOD_RESIST_MISS_CHANCE>(spellId, hitChance);
+ modOwner->ApplySpellMod<SPELLMOD_RESIST_MISS_CHANCE>(spellId, resistMissChance);
}
-
- missChance += hitChance - 100.0f;
+ missChance -= resistMissChance - 100.0f;
if (attType == RANGED_ATTACK)
missChance -= m_modRangedHitChance;
@@ -13069,10 +13051,7 @@ float Unit::MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, i
missChance -= m_modMeleeHitChance;
// Limit miss chance from 0 to 60%
- if (missChance < 0.0f)
- return 0.0f;
- if (missChance > 60.0f)
- return 60.0f;
+ RoundToInterval(missChance, 0.f, 60.f);
return missChance;
}
@@ -14112,7 +14091,7 @@ void Unit::SendClearTarget()
uint32 Unit::GetResistance(SpellSchoolMask mask) const
{
int32 resist = -1;
- for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
+ for (int32 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
if (mask & (1 << i) && (resist < 0 || resist > int32(GetResistance(SpellSchools(i)))))
resist = int32(GetResistance(SpellSchools(i)));
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index c6f78865dc2..a5903aaf995 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1387,7 +1387,7 @@ class TC_GAME_API Unit : public WorldObject
uint32 GetResistance(SpellSchools school) const { return GetUInt32Value(UNIT_FIELD_RESISTANCES+school); }
uint32 GetResistance(SpellSchoolMask mask) const;
void SetResistance(SpellSchools school, int32 val) { SetStatInt32Value(UNIT_FIELD_RESISTANCES+school, val); }
- static float GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo = nullptr);
+ float CalculateAverageResistReduction(SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo = nullptr) const;
uint32 GetHealth() const { return GetUInt32Value(UNIT_FIELD_HEALTH); }
uint32 GetMaxHealth() const { return GetUInt32Value(UNIT_FIELD_MAXHEALTH); }
@@ -1461,7 +1461,7 @@ class TC_GAME_API Unit : public WorldObject
void Mount(uint32 mount, uint32 vehicleId = 0, uint32 creatureEntry = 0);
void Dismount();
- uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; }
+ uint32 GetMaxSkillValueForLevel(Unit const* target = nullptr) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; }
void DealDamageMods(Unit const* victim, uint32 &damage, uint32* absorb) const;
uint32 DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDamage = NULL, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = NULL, bool durabilityLoss = true);
void Kill(Unit* victim, bool durabilityLoss = true);
@@ -1522,7 +1522,6 @@ class TC_GAME_API Unit : public WorldObject
virtual uint32 GetShieldBlockValue() const = 0;
uint32 GetShieldBlockValue(uint32 soft_cap, uint32 hard_cap) const;
- uint32 GetUnitMeleeSkill(Unit const* target = nullptr) const;
uint32 GetDefenseSkillValue(Unit const* target = nullptr) const;
uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const* target = nullptr) const;
float GetWeaponProcChance() const;