[0146] Cleanup deprecated item mods and combat ratings

Signed-off-by: Yaki Khadafi <ElSolDolLo@gmail.com>
This commit is contained in:
Yaki Khadafi 2012-08-21 14:55:58 +03:00 committed by Antz
parent 826c15da12
commit 3153bd2129
9 changed files with 149 additions and 279 deletions

View file

@ -1605,10 +1605,7 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage* damageInfo, int32 damage, S
damage = SpellCriticalDamageBonus(spellInfo, damage, pVictim);
// Resilience - reduce crit damage
uint32 reduction_affected_damage = CalcNotIgnoreDamageReduction(damage, damageSchoolMask);
if (attackType != RANGED_ATTACK)
damage -= pVictim->GetMeleeCritDamageReduction(reduction_affected_damage);
else
damage -= pVictim->GetRangedCritDamageReduction(reduction_affected_damage);
damage -= pVictim->GetCritDamageReduction(reduction_affected_damage);
}
}
break;
@ -1627,7 +1624,7 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage* damageInfo, int32 damage, S
damage = SpellCriticalDamageBonus(spellInfo, damage, pVictim);
// Resilience - reduce crit damage
uint32 reduction_affected_damage = CalcNotIgnoreDamageReduction(damage, damageSchoolMask);
damage -= pVictim->GetSpellCritDamageReduction(reduction_affected_damage);
damage -= pVictim->GetCritDamageReduction(reduction_affected_damage);
}
}
break;
@ -1637,7 +1634,7 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage* damageInfo, int32 damage, S
if (GetTypeId() == TYPEID_PLAYER)
{
uint32 reduction_affected_damage = CalcNotIgnoreDamageReduction(damage, damageSchoolMask);
damage -= pVictim->GetSpellDamageReduction(reduction_affected_damage);
damage -= pVictim->GetDamageReduction(reduction_affected_damage);
}
// damage mitigation
@ -1814,11 +1811,7 @@ void Unit::CalculateMeleeDamage(Unit* pVictim, uint32 damage, CalcDamageInfo* da
// Resilience - reduce crit damage
uint32 reduction_affected_damage = CalcNotIgnoreDamageReduction(damageInfo->damage, damageInfo->damageSchoolMask);
uint32 resilienceReduction;
if (attackType != RANGED_ATTACK)
resilienceReduction = pVictim->GetMeleeCritDamageReduction(reduction_affected_damage);
else
resilienceReduction = pVictim->GetRangedCritDamageReduction(reduction_affected_damage);
uint32 resilienceReduction = pVictim->GetCritDamageReduction(reduction_affected_damage);
damageInfo->damage -= resilienceReduction;
damageInfo->cleanDamage += resilienceReduction;
@ -1933,11 +1926,7 @@ void Unit::CalculateMeleeDamage(Unit* pVictim, uint32 damage, CalcDamageInfo* da
if (GetTypeId() == TYPEID_PLAYER)
{
uint32 reduction_affected_damage = CalcNotIgnoreDamageReduction(damageInfo->damage, damageInfo->damageSchoolMask);
uint32 resilienceReduction;
if (attackType != RANGED_ATTACK)
resilienceReduction = pVictim->GetMeleeDamageReduction(reduction_affected_damage);
else
resilienceReduction = pVictim->GetRangedDamageReduction(reduction_affected_damage);
uint32 resilienceReduction = pVictim->GetDamageReduction(reduction_affected_damage);
damageInfo->damage -= resilienceReduction;
damageInfo->cleanDamage += resilienceReduction;
}
@ -3442,9 +3431,6 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* pVictim, SpellEntry const* spell)
// Increase hit chance from attacker SPELL_AURA_MOD_SPELL_HIT_CHANCE and attacker ratings
HitChance += int32(m_modSpellHitChance * 100.0f);
// Decrease hit chance from victim rating bonus
if (pVictim->GetTypeId() == TYPEID_PLAYER)
HitChance -= int32(((Player*)pVictim)->GetRatingBonusValue(CR_HIT_TAKEN_SPELL) * 100.0f);
if (HitChance < 100) HitChance = 100;
if (HitChance > 10000) HitChance = 10000;
@ -3572,15 +3558,6 @@ float Unit::MeleeMissChanceCalc(const Unit* pVictim, WeaponAttackType attType) c
else
missChance -= m_modMeleeHitChance;
// Hit chance for victim based on ratings
if (pVictim->GetTypeId() == TYPEID_PLAYER)
{
if (attType == RANGED_ATTACK)
missChance += ((Player*)pVictim)->GetRatingBonusValue(CR_HIT_TAKEN_RANGED);
else
missChance += ((Player*)pVictim)->GetRatingBonusValue(CR_HIT_TAKEN_MELEE);
}
// Modify miss chance by victim auras
if (attType == RANGED_ATTACK)
missChance -= pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE);
@ -3729,11 +3706,6 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit* pVict
crit += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
// reduce crit chance from Rating for players
if (attackType != RANGED_ATTACK)
crit -= pVictim->GetMeleeCritChanceReduction();
else
crit -= pVictim->GetRangedCritChanceReduction();
// Apply crit chance from defence skill
crit += (int32(GetMaxSkillValueForLevel(pVictim)) - int32(pVictim->GetDefenseSkillValue(this))) * 0.04f;
@ -3766,12 +3738,6 @@ uint32 Unit::GetWeaponSkillValue(WeaponAttackType attType, Unit const* target) c
: ((Player*)this)->GetSkillValue(skill);
// Modify value from ratings
value += uint32(((Player*)this)->GetRatingBonusValue(CR_WEAPON_SKILL));
switch (attType)
{
case BASE_ATTACK: value += uint32(((Player*)this)->GetRatingBonusValue(CR_WEAPON_SKILL_MAINHAND)); break;
case OFF_ATTACK: value += uint32(((Player*)this)->GetRatingBonusValue(CR_WEAPON_SKILL_OFFHAND)); break;
case RANGED_ATTACK: value += uint32(((Player*)this)->GetRatingBonusValue(CR_WEAPON_SKILL_RANGED)); break;
}
}
else
value = GetUnitMeleeSkill(target);
@ -6953,11 +6919,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* pCaster, SpellEntry const* spellProto,
if (GetTypeId() != TYPEID_PLAYER)
continue;
float mod = ((Player*)this)->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f);
if (mod < float((*i)->GetModifier()->m_amount))
mod = float((*i)->GetModifier()->m_amount);
TakenTotalMod *= (mod + 100.0f) / 100.0f;
TakenTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f;
}
break;
case 20911: // Blessing of Sanctuary
@ -7094,8 +7056,6 @@ bool Unit::IsSpellCrit(Unit* pVictim, SpellEntry const* spellProto, SpellSchoolM
crit_chance += pVictim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, schoolMask);
// Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
crit_chance += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
// Modify by player victim resilience
crit_chance -= pVictim->GetSpellCritChanceReduction();
}
// scripted (increase crit chance ... against ... target by x%)
@ -7968,11 +7928,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* pCaster, uint32 pdamage, WeaponAttackTy
if (GetTypeId() != TYPEID_PLAYER)
continue;
float mod = ((Player*)this)->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f);
if (mod < float((*i)->GetModifier()->m_amount))
mod = float((*i)->GetModifier()->m_amount);
TakenPercent *= (mod + 100.0f) / 100.0f;
TakenPercent *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f;
}
break;
case 20911: // Blessing of Sanctuary