aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
authorOvah <dreadkiller@gmx.de>2022-10-01 17:21:07 +0200
committerShauren <shauren.trinity@gmail.com>2022-10-01 18:42:04 +0200
commit9f084718277b01936435c66696084fc049f8f8cf (patch)
treeacc4475a202c1a600c3ab2184bd7c111521bc4d0 /src/server/game/Spells/Spell.cpp
parentc7b6afc8eb5b544d43af568f568f4b351d3ab879 (diff)
Core/Spells: fixed up block mechanics (#28286)
* Ranged attacks can now be blocked * Implement SPELL_ATTR3_COMPLETELY_BLOCKED * Fixed a bug which was causing blocking to block entire spell effects regardless if the attribute was present or not * Fixed a logic mistake which was causing blocks to roll twice (once for effect negation and once on hit) * No longer send blocked miss conditions in spell_go packets when the spell is not completely blocked to match sniff data (cherry picked from commit b47ef3ce90f6192784f8ce903b6738d568631809)
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 2987aa544fd..17d8db166ef 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -2570,7 +2570,7 @@ void Spell::TargetInfo::PreprocessTarget(Spell* spell)
spell->m_healing = Healing;
_spellHitTarget = nullptr;
- if (MissCondition == SPELL_MISS_NONE)
+ if (MissCondition == SPELL_MISS_NONE || (MissCondition == SPELL_MISS_BLOCK && !spell->GetSpellInfo()->HasAttribute(SPELL_ATTR3_COMPLETELY_BLOCKED)))
_spellHitTarget = unit;
else if (MissCondition == SPELL_MISS_REFLECT && ReflectResult == SPELL_MISS_NONE)
_spellHitTarget = spell->m_caster->ToUnit();
@@ -2776,7 +2776,7 @@ void Spell::TargetInfo::DoDamageAndTriggers(Spell* spell)
caster->SetLastDamagedTargetGuid(spell->unitTarget->GetGUID());
// Add bonuses and fill damageInfo struct
- caster->CalculateSpellDamageTaken(&damageInfo, spell->m_damage, spell->m_spellInfo, spell->m_attackType, IsCrit, spell);
+ caster->CalculateSpellDamageTaken(&damageInfo, spell->m_damage, spell->m_spellInfo, spell->m_attackType, IsCrit, MissCondition == SPELL_MISS_BLOCK, spell);
Unit::DealDamageMods(damageInfo.attacker, damageInfo.target, damageInfo.damage, &damageInfo.absorb);
hitMask |= createProcHitMask(&damageInfo, MissCondition);
@@ -4754,7 +4754,7 @@ void Spell::UpdateSpellCastDataTargets(WorldPackets::Spells::SpellCastData& data
// possibly SPELL_MISS_IMMUNE2 for this??
targetInfo.MissCondition = SPELL_MISS_IMMUNE2;
- if (targetInfo.MissCondition == SPELL_MISS_NONE) // hits
+ if (targetInfo.MissCondition == SPELL_MISS_NONE || (targetInfo.MissCondition == SPELL_MISS_BLOCK && !m_spellInfo->HasAttribute(SPELL_ATTR3_COMPLETELY_BLOCKED))) // Add only hits and partial blocked
{
data.HitTargets.push_back(targetInfo.TargetGUID);
data.HitStatus.emplace_back(SPELL_MISS_NONE);
@@ -8206,7 +8206,7 @@ void Spell::DoEffectOnLaunchTarget(TargetInfo& targetInfo, float multiplier, Spe
{
Unit* unit = nullptr;
// In case spell hit target, do all effect on that target
- if (targetInfo.MissCondition == SPELL_MISS_NONE)
+ if (targetInfo.MissCondition == SPELL_MISS_NONE || (targetInfo.MissCondition == SPELL_MISS_BLOCK && !m_spellInfo->HasAttribute(SPELL_ATTR3_COMPLETELY_BLOCKED)))
unit = m_caster->GetGUID() == targetInfo.TargetGUID ? m_caster->ToUnit() : ObjectAccessor::GetUnit(*m_caster, targetInfo.TargetGUID);
// In case spell reflect from target, do all effect on caster (if hit)
else if (targetInfo.MissCondition == SPELL_MISS_REFLECT && targetInfo.ReflectResult == SPELL_MISS_NONE)