mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 21:56:22 +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 victimResistance = float(victim->GetResistance(schoolMask));
|
||||
float victimResistance = static_cast<float>(victim->GetResistance(schoolMask));
|
||||
if (owner)
|
||||
{
|
||||
// Xinef: pets inherit 100% of masters penetration
|
||||
@@ -2156,28 +2156,28 @@ float Unit::GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMa
|
||||
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());
|
||||
victimResistance += static_cast<float>(player->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
|
||||
victimResistance -= static_cast<float>(player->GetSpellPenetrationItemMod());
|
||||
}
|
||||
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);
|
||||
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;
|
||||
static float const BOSS_RESISTANCE_CONSTANT = 510.0f;
|
||||
uint32 level = victim->GetLevel();
|
||||
float level = static_cast<float>(victim->GetLevel());
|
||||
float resistanceConstant = 0.0f;
|
||||
|
||||
if (level == BOSS_LEVEL)
|
||||
resistanceConstant = BOSS_RESISTANCE_CONSTANT;
|
||||
if (level > 60.0f)
|
||||
resistanceConstant = 150.0f + (level - 60.0f) * (level - 67.5f);
|
||||
else if (level > 20.0f)
|
||||
resistanceConstant = 50.0f + (level - 20.0f) * 2.5f;
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user