mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 08:17:56 +00:00
fix(Core/Unit): improve resistance calculation (#24377)
Co-authored-by: sudlud <sudlud@users.noreply.github.com>
This commit is contained in:
@@ -2148,7 +2148,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit const* attacker, Unit const* victim, co
|
|||||||
|
|
||||||
float Unit::GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMask, Unit const* victim)
|
float Unit::GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMask, Unit const* victim)
|
||||||
{
|
{
|
||||||
float victimResistance = float(victim->GetResistance(schoolMask));
|
float victimResistance = static_cast<float>(victim->GetResistance(schoolMask));
|
||||||
if (owner)
|
if (owner)
|
||||||
{
|
{
|
||||||
// Xinef: pets inherit 100% of masters penetration
|
// Xinef: pets inherit 100% of masters penetration
|
||||||
@@ -2156,28 +2156,28 @@ float Unit::GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMa
|
|||||||
Player const* player = owner->GetSpellModOwner();
|
Player const* player = owner->GetSpellModOwner();
|
||||||
if (player && owner->GetEntry() != WORLD_TRIGGER)
|
if (player && owner->GetEntry() != WORLD_TRIGGER)
|
||||||
{
|
{
|
||||||
victimResistance += float(player->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
|
victimResistance += static_cast<float>(player->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
|
||||||
victimResistance -= float(player->GetSpellPenetrationItemMod());
|
victimResistance -= static_cast<float>(player->GetSpellPenetrationItemMod());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
victimResistance += float(owner->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
|
victimResistance += static_cast<float>(owner->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
|
||||||
}
|
}
|
||||||
|
|
||||||
victimResistance = std::max(victimResistance, 0.0f);
|
victimResistance = std::max(victimResistance, 0.0f);
|
||||||
if (owner)
|
if (owner)
|
||||||
victimResistance += std::max((float(victim->GetLevel()) - float(owner->GetLevel())) * 5.0f, 0.0f);
|
victimResistance += std::max(static_cast<float>(victim->GetLevel() - owner->GetLevel()) * 5.0f, 0.0f);
|
||||||
|
|
||||||
static uint32 const BOSS_LEVEL = 83;
|
float level = static_cast<float>(victim->GetLevel());
|
||||||
static float const BOSS_RESISTANCE_CONSTANT = 510.0f;
|
|
||||||
uint32 level = victim->GetLevel();
|
|
||||||
float resistanceConstant = 0.0f;
|
float resistanceConstant = 0.0f;
|
||||||
|
|
||||||
if (level == BOSS_LEVEL)
|
if (level > 60.0f)
|
||||||
resistanceConstant = BOSS_RESISTANCE_CONSTANT;
|
resistanceConstant = 150.0f + (level - 60.0f) * (level - 67.5f);
|
||||||
|
else if (level > 20.0f)
|
||||||
|
resistanceConstant = 50.0f + (level - 20.0f) * 2.5f;
|
||||||
else
|
else
|
||||||
resistanceConstant = level * 5.0f;
|
resistanceConstant = 50.0f;
|
||||||
|
|
||||||
return victimResistance / (victimResistance + resistanceConstant);
|
return std::min(victimResistance / (victimResistance + resistanceConstant), 0.75f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::CalcAbsorbResist(DamageInfo& dmgInfo, bool Splited)
|
void Unit::CalcAbsorbResist(DamageInfo& dmgInfo, bool Splited)
|
||||||
|
|||||||
Reference in New Issue
Block a user