diff options
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 45b53f6f93b..ceca13fdfdf 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2382,6 +2382,7 @@ void Spell::TargetInfo::PreprocessTarget(Spell* spell) if (missInfo != SPELL_MISS_MISS) spell->m_caster->ToUnit()->SendSpellMiss(unit, spell->m_spellInfo->Id, missInfo); spell->m_damage = 0; + spell->m_healing = 0; _spellHitTarget = nullptr; } } @@ -2645,6 +2646,20 @@ void Spell::TargetInfo::DoDamageAndTriggers(Spell* spell) else if (spell->m_caster->GetTypeId() == TYPEID_GAMEOBJECT && spell->m_caster->ToGameObject()->AI()) spell->m_caster->ToGameObject()->AI()->SpellHitTarget(_spellHitTarget, spell->m_spellInfo); + if (spell->_spellAura) + { + if (AuraApplication* aurApp = spell->_spellAura->GetApplicationOfTarget(_spellHitTarget->GetGUID())) + { + // only apply unapplied effects (for reapply case) + uint32 effMask = EffectMask & aurApp->GetEffectsToApply(); + for (uint8 i = 0; i < spell->m_spellInfo->GetEffects().size(); ++i) + if ((effMask & (1 << i)) && aurApp->HasEffect(i)) + effMask &= ~(1 << i); + + _spellHitTarget->_ApplyAura(aurApp, effMask); + } + } + // Needs to be called after dealing damage/healing to not remove breaking on damage auras spell->DoTriggersOnSpellHit(_spellHitTarget, EffectMask); @@ -2733,7 +2748,7 @@ SpellMissInfo Spell::PreprocessSpellHit(Unit* unit, TargetInfo& hitInfo) else if (m_caster->IsFriendlyTo(unit)) { // for delayed spells ignore negative spells (after duel end) for friendly targets - if (m_spellInfo->HasHitDelay() && unit->GetTypeId() == TYPEID_PLAYER && !IsPositive() && !m_caster->IsValidSpellAttackTarget(unit, m_spellInfo)) + if (m_spellInfo->HasHitDelay() && unit->GetTypeId() == TYPEID_PLAYER && !IsPositive() && !m_caster->IsValidAssistTarget(unit, m_spellInfo)) return SPELL_MISS_EVADE; // assisting case, healing and resurrection @@ -8170,13 +8185,13 @@ bool WorldObjectSpellTargetCheck::operator()(WorldObject* target) const case TARGET_CHECK_ENEMY: if (unitTarget->IsTotem()) return false; - if (!_caster->IsValidAttackTarget(unitTarget, _spellInfo, false)) + if (!_caster->IsValidAttackTarget(unitTarget, _spellInfo)) return false; break; case TARGET_CHECK_ALLY: if (unitTarget->IsTotem()) return false; - if (!_caster->IsValidAssistTarget(unitTarget, _spellInfo, false)) + if (!_caster->IsValidAssistTarget(unitTarget, _spellInfo)) return false; break; case TARGET_CHECK_PARTY: @@ -8184,7 +8199,7 @@ bool WorldObjectSpellTargetCheck::operator()(WorldObject* target) const return false; if (unitTarget->IsTotem()) return false; - if (!_caster->IsValidAssistTarget(unitTarget, _spellInfo, false)) + if (!_caster->IsValidAssistTarget(unitTarget, _spellInfo)) return false; if (!refUnit->IsInPartyWith(unitTarget)) return false; @@ -8200,7 +8215,7 @@ bool WorldObjectSpellTargetCheck::operator()(WorldObject* target) const return false; if (unitTarget->IsTotem()) return false; - if (!_caster->IsValidAssistTarget(unitTarget, _spellInfo, false)) + if (!_caster->IsValidAssistTarget(unitTarget, _spellInfo)) return false; if (!refUnit->IsInRaidWith(unitTarget)) return false; @@ -8235,19 +8250,6 @@ bool WorldObjectSpellTargetCheck::operator()(WorldObject* target) const default: break; } - - // then check actual spell positivity to determine if the target is valid - // (negative spells may be targeted on allies) - if (_spellInfo->IsPositive()) - { - if (!_caster->IsValidSpellAssistTarget(unitTarget, _spellInfo)) - return false; - } - else - { - if (!_caster->IsValidSpellAttackTarget(unitTarget, _spellInfo)) - return false; - } } if (!_condSrcInfo) |
