Core/StatsSystem: Resilience updates.
* No longer reduces mana draining effects. * No longer reduces crit chances. * No longer reduces hit chances.
This commit is contained in:
1 parent
80b1b6c494
commit
9b2d744847
5 files changed
+116
-200
No files matched your search
@@ -5886,7 +5886,10 @@ float Player::GetRatingMultiplier(CombatRating cr) const
|
||||
|
||||
float Player::GetRatingBonusValue(CombatRating cr) const
|
||||
{
|
||||
return float(GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr)) * GetRatingMultiplier(cr);
|
||||
float baseResult = float(GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr)) * GetRatingMultiplier(cr);
|
||||
if (cr != CR_RESILIENCE_PLAYER_DAMAGE_TAKEN)
|
||||
return baseResult;
|
||||
return float(1.0f - pow(0.99f, baseResult));
|
||||
}
|
||||
|
||||
float Player::GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const
|
||||
@@ -6010,15 +6013,12 @@ void Player::UpdateRating(CombatRating cr)
|
||||
if (affectStats)
|
||||
UpdateAllSpellCritChances();
|
||||
break;
|
||||
case CR_HIT_TAKEN_MELEE: // Implemented in Unit::MeleeMissChanceCalc
|
||||
case CR_HIT_TAKEN_RANGED:
|
||||
break;
|
||||
case CR_HIT_TAKEN_SPELL: // Implemented in Unit::MagicSpellHitResult
|
||||
break;
|
||||
case CR_CRIT_TAKEN_MELEE: // Implemented in Unit::RollMeleeOutcomeAgainst (only for chance to crit)
|
||||
case CR_CRIT_TAKEN_RANGED:
|
||||
break;
|
||||
case CR_CRIT_TAKEN_SPELL: // Implemented in Unit::SpellCriticalBonus (only for chance to crit)
|
||||
case CR_HIT_TAKEN_MELEE: // Deprecated since Cataclysm
|
||||
case CR_HIT_TAKEN_RANGED: // Deprecated since Cataclysm
|
||||
case CR_HIT_TAKEN_SPELL: // Deprecated since Cataclysm
|
||||
case CR_RESILIENCE_PLAYER_DAMAGE_TAKEN:
|
||||
case CR_RESILIENCE_CRIT_TAKEN:
|
||||
case CR_CRIT_TAKEN_SPELL: // Deprecated since Cataclysm
|
||||
break;
|
||||
case CR_HASTE_MELEE: // Implemented in Player::ApplyRatingMod
|
||||
case CR_HASTE_RANGED:
|
||||
@@ -8239,24 +8239,24 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
|
||||
case ITEM_MOD_CRIT_SPELL_RATING:
|
||||
ApplyRatingMod(CR_CRIT_SPELL, int32(val), apply);
|
||||
break;
|
||||
case ITEM_MOD_HIT_TAKEN_MELEE_RATING:
|
||||
ApplyRatingMod(CR_HIT_TAKEN_MELEE, int32(val), apply);
|
||||
break;
|
||||
case ITEM_MOD_HIT_TAKEN_RANGED_RATING:
|
||||
ApplyRatingMod(CR_HIT_TAKEN_RANGED, int32(val), apply);
|
||||
break;
|
||||
case ITEM_MOD_HIT_TAKEN_SPELL_RATING:
|
||||
ApplyRatingMod(CR_HIT_TAKEN_SPELL, int32(val), apply);
|
||||
break;
|
||||
case ITEM_MOD_CRIT_TAKEN_MELEE_RATING:
|
||||
ApplyRatingMod(CR_CRIT_TAKEN_MELEE, int32(val), apply);
|
||||
break;
|
||||
// case ITEM_MOD_HIT_TAKEN_MELEE_RATING:
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_MELEE, int32(val), apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HIT_TAKEN_RANGED_RATING:
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_RANGED, int32(val), apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HIT_TAKEN_SPELL_RATING:
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_SPELL, int32(val), apply);
|
||||
// break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_MELEE_RATING:
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_MELEE, int32(val), apply);
|
||||
// break;
|
||||
case ITEM_MOD_CRIT_TAKEN_RANGED_RATING:
|
||||
ApplyRatingMod(CR_CRIT_TAKEN_RANGED, int32(val), apply);
|
||||
break;
|
||||
case ITEM_MOD_CRIT_TAKEN_SPELL_RATING:
|
||||
ApplyRatingMod(CR_CRIT_TAKEN_SPELL, int32(val), apply);
|
||||
ApplyRatingMod(CR_RESILIENCE_PLAYER_DAMAGE_TAKEN, int32(val), apply);
|
||||
break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_SPELL_RATING:
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_SPELL, int32(val), apply);
|
||||
// break;
|
||||
case ITEM_MOD_HASTE_MELEE_RATING:
|
||||
ApplyRatingMod(CR_HASTE_MELEE, int32(val), apply);
|
||||
break;
|
||||
@@ -8276,20 +8276,18 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
|
||||
ApplyRatingMod(CR_CRIT_RANGED, int32(val), apply);
|
||||
ApplyRatingMod(CR_CRIT_SPELL, int32(val), apply);
|
||||
break;
|
||||
case ITEM_MOD_HIT_TAKEN_RATING:
|
||||
ApplyRatingMod(CR_HIT_TAKEN_MELEE, int32(val), apply);
|
||||
ApplyRatingMod(CR_HIT_TAKEN_RANGED, int32(val), apply);
|
||||
ApplyRatingMod(CR_HIT_TAKEN_SPELL, int32(val), apply);
|
||||
break;
|
||||
case ITEM_MOD_CRIT_TAKEN_RATING:
|
||||
ApplyRatingMod(CR_CRIT_TAKEN_MELEE, int32(val), apply);
|
||||
ApplyRatingMod(CR_CRIT_TAKEN_RANGED, int32(val), apply);
|
||||
ApplyRatingMod(CR_CRIT_TAKEN_SPELL, int32(val), apply);
|
||||
break;
|
||||
// case ITEM_MOD_HIT_TAKEN_RATING: // Unused since 3.3.5
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_MELEE, int32(val), apply);
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_RANGED, int32(val), apply);
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_SPELL, int32(val), apply);
|
||||
// break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_RATING: // Unused since 3.3.5
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_MELEE, int32(val), apply);
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_RANGED, int32(val), apply);
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_SPELL, int32(val), apply);
|
||||
// break;
|
||||
case ITEM_MOD_RESILIENCE_RATING:
|
||||
ApplyRatingMod(CR_CRIT_TAKEN_MELEE, int32(val), apply);
|
||||
ApplyRatingMod(CR_CRIT_TAKEN_RANGED, int32(val), apply);
|
||||
ApplyRatingMod(CR_CRIT_TAKEN_SPELL, int32(val), apply);
|
||||
ApplyRatingMod(CR_RESILIENCE_PLAYER_DAMAGE_TAKEN, int32(val), apply);
|
||||
break;
|
||||
case ITEM_MOD_HASTE_RATING:
|
||||
ApplyRatingMod(CR_HASTE_MELEE, int32(val), apply);
|
||||
@@ -14078,32 +14076,32 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
|
||||
ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply);
|
||||
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u SPELL_CRIT", enchant_amount);
|
||||
break;
|
||||
// Values from ITEM_STAT_MELEE_HA_RATING to ITEM_MOD_HASTE_RANGED_RATING are never used
|
||||
// in Enchantments
|
||||
// case ITEM_MOD_HIT_TAKEN_MELEE_RATING:
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HIT_TAKEN_RANGED_RATING:
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HIT_TAKEN_SPELL_RATING:
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_MELEE_RATING:
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_RANGED_RATING:
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_SPELL_RATING:
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HASTE_MELEE_RATING:
|
||||
// ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HASTE_RANGED_RATING:
|
||||
// ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply);
|
||||
// break;
|
||||
// Values from ITEM_STAT_MELEE_HA_RATING to ITEM_MOD_HASTE_RANGED_RATING are never used
|
||||
// in Enchantments
|
||||
// case ITEM_MOD_HIT_TAKEN_MELEE_RATING:
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HIT_TAKEN_RANGED_RATING:
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HIT_TAKEN_SPELL_RATING:
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_MELEE_RATING:
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_RANGED_RATING:
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_SPELL_RATING:
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HASTE_MELEE_RATING:
|
||||
// ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HASTE_RANGED_RATING:
|
||||
// ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply);
|
||||
// break;
|
||||
case ITEM_MOD_HASTE_SPELL_RATING:
|
||||
ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply);
|
||||
break;
|
||||
@@ -14119,21 +14117,18 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
|
||||
ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply);
|
||||
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u CRITICAL", enchant_amount);
|
||||
break;
|
||||
// Values ITEM_MOD_HIT_TAKEN_RATING and ITEM_MOD_CRIT_TAKEN_RATING are never used in Enchantment
|
||||
// case ITEM_MOD_HIT_TAKEN_RATING:
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_RATING:
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HIT_TAKEN_RATING: // Unused since 3.3.5
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_RATING: // Unused since 3.3.5
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// break;
|
||||
case ITEM_MOD_RESILIENCE_RATING:
|
||||
ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
ApplyRatingMod(CR_RESILIENCE_PLAYER_DAMAGE_TAKEN, enchant_amount, apply);
|
||||
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u RESILIENCE", enchant_amount);
|
||||
break;
|
||||
case ITEM_MOD_HASTE_RATING:
|
||||
@@ -19943,7 +19938,7 @@ void Player::_SaveStats(SQLTransaction& trans)
|
||||
stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_ATTACK_POWER));
|
||||
stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER));
|
||||
stmt->setUInt32(index++, GetBaseSpellPowerBonus());
|
||||
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_TAKEN_SPELL));
|
||||
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_RESILIENCE_PLAYER_DAMAGE_TAKEN));
|
||||
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
@@ -998,10 +998,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
|
||||
damage -= damageInfo->blocked;
|
||||
}
|
||||
|
||||
if (attackType != RANGED_ATTACK)
|
||||
ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_MELEE);
|
||||
else
|
||||
ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_RANGED);
|
||||
ApplyResilience(victim, &damage, crit);
|
||||
break;
|
||||
}
|
||||
// Magical Attacks
|
||||
@@ -1015,7 +1012,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
|
||||
damage = SpellCriticalDamageBonus(spellInfo, damage, victim);
|
||||
}
|
||||
|
||||
ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_SPELL);
|
||||
ApplyResilience(victim, &damage, crit);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -1227,10 +1224,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
|
||||
damageInfo->HitInfo |= HITINFO_AFFECTS_VICTIM;
|
||||
|
||||
int32 resilienceReduction = damageInfo->damage;
|
||||
if (attackType != RANGED_ATTACK)
|
||||
ApplyResilience(victim, NULL, &resilienceReduction, (damageInfo->hitOutCome == MELEE_HIT_CRIT), CR_CRIT_TAKEN_MELEE);
|
||||
else
|
||||
ApplyResilience(victim, NULL, &resilienceReduction, (damageInfo->hitOutCome == MELEE_HIT_CRIT), CR_CRIT_TAKEN_RANGED);
|
||||
ApplyResilience(victim, &resilienceReduction, (damageInfo->hitOutCome == MELEE_HIT_CRIT));
|
||||
resilienceReduction = damageInfo->damage - resilienceReduction;
|
||||
damageInfo->damage -= resilienceReduction;
|
||||
damageInfo->cleanDamage += resilienceReduction;
|
||||
@@ -2344,10 +2338,6 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spell)
|
||||
{
|
||||
// Chance hit from victim SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE auras
|
||||
modHitChance += victim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE, schoolMask);
|
||||
|
||||
// Decrease hit chance from victim rating bonus
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||
modHitChance -= int32(victim->ToPlayer()->GetRatingBonusValue(CR_HIT_TAKEN_SPELL));
|
||||
}
|
||||
|
||||
int32 HitChance = modHitChance * 100;
|
||||
@@ -2580,12 +2570,6 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit* victi
|
||||
|
||||
crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
|
||||
|
||||
// reduce crit chance from Rating for players
|
||||
if (attackType != RANGED_ATTACK)
|
||||
ApplyResilience(victim, &crit, NULL, false, CR_CRIT_TAKEN_MELEE);
|
||||
else
|
||||
ApplyResilience(victim, &crit, NULL, false, CR_CRIT_TAKEN_RANGED);
|
||||
|
||||
if (crit < 0.0f)
|
||||
crit = 0.0f;
|
||||
return crit;
|
||||
@@ -9769,7 +9753,6 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
|
||||
crit_chance += victim->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 += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
|
||||
ApplyResilience(victim, &crit_chance, NULL, false, CR_CRIT_TAKEN_SPELL);
|
||||
}
|
||||
// scripted (increase crit chance ... against ... target by x%
|
||||
AuraEffectList const& mOverrideClassScript = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
||||
@@ -15685,7 +15668,7 @@ void Unit::SendPlaySpellVisualKit(uint32 id, uint32 unkParam)
|
||||
SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
void Unit::ApplyResilience(Unit const* victim, float* crit, int32* damage, bool isCrit, CombatRating type) const
|
||||
void Unit::ApplyResilience(Unit const* victim, int32* damage, bool isCrit) const
|
||||
{
|
||||
// player mounted on multi-passenger mount is also classified as vehicle
|
||||
if (IsVehicle() || (victim->IsVehicle() && victim->GetTypeId() != TYPEID_PLAYER))
|
||||
@@ -15706,44 +15689,9 @@ void Unit::ApplyResilience(Unit const* victim, float* crit, int32* damage, bool
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case CR_CRIT_TAKEN_MELEE:
|
||||
// Crit chance reduction works against nonpets
|
||||
if (crit)
|
||||
*crit -= target->GetMeleeCritChanceReduction();
|
||||
if (source && damage)
|
||||
{
|
||||
if (isCrit)
|
||||
*damage -= target->GetMeleeCritDamageReduction(*damage);
|
||||
*damage -= target->GetMeleeDamageReduction(*damage);
|
||||
}
|
||||
break;
|
||||
case CR_CRIT_TAKEN_RANGED:
|
||||
// Crit chance reduction works against nonpets
|
||||
if (crit)
|
||||
*crit -= target->GetRangedCritChanceReduction();
|
||||
if (source && damage)
|
||||
{
|
||||
if (isCrit)
|
||||
*damage -= target->GetRangedCritDamageReduction(*damage);
|
||||
*damage -= target->GetRangedDamageReduction(*damage);
|
||||
}
|
||||
break;
|
||||
case CR_CRIT_TAKEN_SPELL:
|
||||
// Crit chance reduction works against nonpets
|
||||
if (crit)
|
||||
*crit -= target->GetSpellCritChanceReduction();
|
||||
if (source && damage)
|
||||
{
|
||||
if (isCrit)
|
||||
*damage -= target->GetSpellCritDamageReduction(*damage);
|
||||
*damage -= target->GetSpellDamageReduction(*damage);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (isCrit)
|
||||
*damage = target->GetCritDamageReduction(*damage);
|
||||
* damage = target->GetDamageReduction(*damage);
|
||||
}
|
||||
|
||||
// Melee based spells can be miss, parry or dodge on this step
|
||||
|
||||
@@ -538,32 +538,32 @@ enum WeaponAttackType
|
||||
|
||||
enum CombatRating
|
||||
{
|
||||
CR_WEAPON_SKILL = 0,
|
||||
CR_DEFENSE_SKILL = 1, // Removed in 4.0.1
|
||||
CR_DODGE = 2,
|
||||
CR_PARRY = 3,
|
||||
CR_BLOCK = 4,
|
||||
CR_HIT_MELEE = 5,
|
||||
CR_HIT_RANGED = 6,
|
||||
CR_HIT_SPELL = 7,
|
||||
CR_CRIT_MELEE = 8,
|
||||
CR_CRIT_RANGED = 9,
|
||||
CR_CRIT_SPELL = 10,
|
||||
CR_HIT_TAKEN_MELEE = 11,
|
||||
CR_HIT_TAKEN_RANGED = 12,
|
||||
CR_HIT_TAKEN_SPELL = 13,
|
||||
CR_CRIT_TAKEN_MELEE = 14,
|
||||
CR_CRIT_TAKEN_RANGED = 15,
|
||||
CR_CRIT_TAKEN_SPELL = 16,
|
||||
CR_HASTE_MELEE = 17,
|
||||
CR_HASTE_RANGED = 18,
|
||||
CR_HASTE_SPELL = 19,
|
||||
CR_WEAPON_SKILL_MAINHAND = 20,
|
||||
CR_WEAPON_SKILL_OFFHAND = 21,
|
||||
CR_WEAPON_SKILL_RANGED = 22,
|
||||
CR_EXPERTISE = 23,
|
||||
CR_ARMOR_PENETRATION = 24,
|
||||
CR_MASTERY = 25,
|
||||
CR_WEAPON_SKILL = 0,
|
||||
CR_DEFENSE_SKILL = 1, // Removed in 4.0.1
|
||||
CR_DODGE = 2,
|
||||
CR_PARRY = 3,
|
||||
CR_BLOCK = 4,
|
||||
CR_HIT_MELEE = 5,
|
||||
CR_HIT_RANGED = 6,
|
||||
CR_HIT_SPELL = 7,
|
||||
CR_CRIT_MELEE = 8,
|
||||
CR_CRIT_RANGED = 9,
|
||||
CR_CRIT_SPELL = 10,
|
||||
CR_HIT_TAKEN_MELEE = 11, // Deprecated since Cataclysm
|
||||
CR_HIT_TAKEN_RANGED = 12, // Deprecated since Cataclysm
|
||||
CR_HIT_TAKEN_SPELL = 13, // Deprecated since Cataclysm
|
||||
CR_RESILIENCE_CRIT_TAKEN = 14,
|
||||
CR_RESILIENCE_PLAYER_DAMAGE_TAKEN = 15,
|
||||
CR_CRIT_TAKEN_SPELL = 16, // Deprecated since Cataclysm
|
||||
CR_HASTE_MELEE = 17,
|
||||
CR_HASTE_RANGED = 18,
|
||||
CR_HASTE_SPELL = 19,
|
||||
CR_WEAPON_SKILL_MAINHAND = 20,
|
||||
CR_WEAPON_SKILL_OFFHAND = 21,
|
||||
CR_WEAPON_SKILL_RANGED = 22,
|
||||
CR_EXPERTISE = 23,
|
||||
CR_ARMOR_PENETRATION = 24,
|
||||
CR_MASTERY = 25,
|
||||
};
|
||||
|
||||
#define MAX_COMBAT_RATING 26
|
||||
@@ -1450,21 +1450,12 @@ class Unit : public WorldObject
|
||||
void DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss);
|
||||
|
||||
// player or player's pet resilience (-1%)
|
||||
float GetMeleeCritChanceReduction() const { return GetCombatRatingReduction(CR_CRIT_TAKEN_MELEE); }
|
||||
float GetRangedCritChanceReduction() const { return GetCombatRatingReduction(CR_CRIT_TAKEN_RANGED); }
|
||||
float GetSpellCritChanceReduction() const { return GetCombatRatingReduction(CR_CRIT_TAKEN_SPELL); }
|
||||
|
||||
// player or player's pet resilience (-1%)
|
||||
uint32 GetMeleeCritDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_MELEE, 2.2f, 33.0f, damage); }
|
||||
uint32 GetRangedCritDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_RANGED, 2.2f, 33.0f, damage); }
|
||||
uint32 GetSpellCritDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_SPELL, 2.2f, 33.0f, damage); }
|
||||
uint32 GetCritDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_RESILIENCE_CRIT_TAKEN, 2.2f, 33.0f, damage); }
|
||||
|
||||
// player or player's pet resilience (-1%), cap 100%
|
||||
uint32 GetMeleeDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_MELEE, 2.0f, 100.0f, damage); }
|
||||
uint32 GetRangedDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_RANGED, 2.0f, 100.0f, damage); }
|
||||
uint32 GetSpellDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_SPELL, 2.0f, 100.0f, damage); }
|
||||
uint32 GetDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_RESILIENCE_PLAYER_DAMAGE_TAKEN, 2.0f, 100.0f, damage); }
|
||||
|
||||
void ApplyResilience(const Unit* victim, float * crit, int32 * damage, bool isCrit, CombatRating type) const;
|
||||
void ApplyResilience(const Unit* victim, int32 * damage, bool isCrit) const;
|
||||
|
||||
float MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, uint32 spellId) const;
|
||||
SpellMissInfo MeleeSpellHitResult(Unit* victim, SpellInfo const* spell);
|
||||
|
||||
@@ -6148,7 +6148,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
|
||||
damage = caster->SpellCriticalDamageBonus(m_spellInfo, damage, target);
|
||||
|
||||
int32 dmg = damage;
|
||||
caster->ApplyResilience(target, NULL, &dmg, crit, CR_CRIT_TAKEN_SPELL);
|
||||
caster->ApplyResilience(target, &dmg, crit);
|
||||
damage = dmg;
|
||||
|
||||
caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo());
|
||||
@@ -6215,7 +6215,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
|
||||
}
|
||||
|
||||
int32 dmg = damage;
|
||||
caster->ApplyResilience(target, NULL, &dmg, crit, CR_CRIT_TAKEN_SPELL);
|
||||
caster->ApplyResilience(target, &dmg, crit);
|
||||
damage = dmg;
|
||||
|
||||
caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, m_spellInfo);
|
||||
@@ -6418,10 +6418,6 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
|
||||
sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u",
|
||||
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), drainAmount, GetId());
|
||||
|
||||
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
|
||||
if (powerType == POWER_MANA)
|
||||
drainAmount -= target->GetSpellCritDamageReduction(drainAmount);
|
||||
|
||||
int32 drainedAmount = -target->ModifyPower(powerType, -drainAmount);
|
||||
|
||||
float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
|
||||
@@ -6536,10 +6532,6 @@ void AuraEffect::HandlePeriodicPowerBurnAuraTick(Unit* target, Unit* caster) con
|
||||
// ignore negative values (can be result apply spellmods to aura damage
|
||||
int32 damage = std::max(m_amount, 0);
|
||||
|
||||
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
|
||||
if (powerType == POWER_MANA)
|
||||
damage -= target->GetSpellCritDamageReduction(damage);
|
||||
|
||||
uint32 gain = uint32(-target->ModifyPower(powerType, -damage));
|
||||
|
||||
float dmgMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster);
|
||||
|
||||
@@ -1232,16 +1232,11 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex)
|
||||
damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE);
|
||||
damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE);
|
||||
|
||||
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
|
||||
int32 power = damage;
|
||||
if (powerType == POWER_MANA)
|
||||
power -= unitTarget->GetSpellCritDamageReduction(power);
|
||||
|
||||
int32 newDamage = -(unitTarget->ModifyPower(powerType, -int32(power)));
|
||||
int32 newDamage = -(unitTarget->ModifyPower(powerType, -damage));
|
||||
|
||||
float gainMultiplier = 0.0f;
|
||||
|
||||
// Don`t restore from self drain
|
||||
// Don't restore from self drain
|
||||
if (m_caster != unitTarget)
|
||||
{
|
||||
gainMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(m_originalCaster, this);
|
||||
@@ -1315,12 +1310,7 @@ void Spell::EffectPowerBurn(SpellEffIndex effIndex)
|
||||
damage = std::min(damage, maxDamage);
|
||||
}
|
||||
|
||||
int32 power = damage;
|
||||
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
|
||||
if (powerType == POWER_MANA)
|
||||
power -= unitTarget->GetSpellCritDamageReduction(power);
|
||||
|
||||
int32 newDamage = -(unitTarget->ModifyPower(powerType, -power));
|
||||
int32 newDamage = -(unitTarget->ModifyPower(powerType, -damage));
|
||||
|
||||
// NO - Not a typo - EffectPowerBurn uses effect value multiplier - not effect damage multiplier
|
||||
float dmgMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(m_originalCaster, this);
|
||||
|
||||
Reference in new issue
Block a user