diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 31 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 2 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 14 |
4 files changed, 25 insertions, 26 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 73bd1e4697c..7ca7718fe39 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -360,7 +360,7 @@ Unit::Unit(bool isWorldObject) : m_modMeleeHitChance = 0.0f; m_modRangedHitChance = 0.0f; m_modSpellHitChance = 0.0f; - m_baseSpellCritChance = 5; + m_baseSpellCritChance = 5.0f; m_speed_rate.fill(1.0f); @@ -6914,15 +6914,29 @@ float Unit::SpellCritChanceDone(Spell* spell, AuraEffect const* aurEff, SpellSch float crit_chance = 0.0f; switch (spellInfo->DmgClass) { + case SPELL_DAMAGE_CLASS_NONE: case SPELL_DAMAGE_CLASS_MAGIC: { - if (schoolMask & SPELL_SCHOOL_MASK_NORMAL) - crit_chance = 0.0f; - // For other schools - else if (Player const* thisPlayer = ToPlayer()) - crit_chance = thisPlayer->m_activePlayerData->SpellCritPercentage; - else - crit_chance = (float)m_baseSpellCritChance; + auto getMagicCritChance = [&] + { + if (Player const* thisPlayer = ToPlayer()) + return *thisPlayer->m_activePlayerData->SpellCritPercentage; + + return m_baseSpellCritChance; + }; + + switch (schoolMask & SPELL_SCHOOL_MASK_NORMAL) + { + case SPELL_SCHOOL_MASK_NORMAL: // physical only + crit_chance = GetUnitCriticalChanceDone(attackType); + break; + case 0: // spell only + crit_chance = getMagicCritChance(); + break; + default: // mix of physical and magic + crit_chance = std::max(getMagicCritChance(), GetUnitCriticalChanceDone(attackType)); + break; + } break; } case SPELL_DAMAGE_CLASS_MELEE: @@ -6931,7 +6945,6 @@ float Unit::SpellCritChanceDone(Spell* spell, AuraEffect const* aurEff, SpellSch crit_chance += GetUnitCriticalChanceDone(attackType); break; } - case SPELL_DAMAGE_CLASS_NONE: default: return 0.0f; } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 2bd5dad9b24..7e177193a9b 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1456,7 +1456,7 @@ class TC_GAME_API Unit : public WorldObject float m_modMeleeHitChance; float m_modRangedHitChance; float m_modSpellHitChance; - int32 m_baseSpellCritChance; + float m_baseSpellCritChance; std::array<uint32, MAX_ATTACK> m_baseAttackSpeed; std::array<float, MAX_ATTACK> m_modAttackSpeedPct; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index fad5900f433..e86637c6780 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -4226,7 +4226,7 @@ void AuraEffect::HandleModSpellCritChance(AuraApplication const* aurApp, uint8 m if (target->GetTypeId() == TYPEID_PLAYER) target->ToPlayer()->UpdateSpellCritChance(); else - target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount(); + target->m_baseSpellCritChance += apply ? GetAmount() : -GetAmount(); } void AuraEffect::HandleAuraModCritPct(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -4238,7 +4238,7 @@ void AuraEffect::HandleAuraModCritPct(AuraApplication const* aurApp, uint8 mode, if (target->GetTypeId() != TYPEID_PLAYER) { - target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount(); + target->m_baseSpellCritChance += apply ? GetAmount() : -GetAmount(); return; } diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 621a13e8124..16b010ba2eb 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3481,20 +3481,6 @@ void SpellMgr::LoadSpellInfoCorrections() }); } - // Allows those to crit - ApplySpellFix({ - 379, // Earth Shield - 71607, // Item - Bauble of True Blood 10m - 71646, // Item - Bauble of True Blood 25m - 71610, // Item - Althor's Abacus trigger 10m - 71641, // Item - Althor's Abacus trigger 25m - 373462 // Crystalline Reflection HEAL - }, [](SpellInfo* spellInfo) - { - // We need more spells to find a general way (if there is any) - spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; - }); - ApplySpellFix({ 63026, // Summon Aspirant Test NPC (HACK: Target shouldn't be changed) 63137 // Summon Valiant Test (HACK: Target shouldn't be changed; summon position should be untied from spell destination) |