diff options
| author | ForesterDev <11771800+ForesterDev@users.noreply.github.com> | 2019-08-23 21:24:56 +0400 |
|---|---|---|
| committer | Giacomo Pozzoni <giacomopoz@gmail.com> | 2019-08-23 19:24:56 +0200 |
| commit | 448facc5e794bde5068533825ebfd55435effb57 (patch) | |
| tree | 9df1c5ea6f2cb7f9b2e49d00fbaf0d66fc48cfc2 /src/server/game/Spells/Spell.cpp | |
| parent | 10f6e3818578410246750c6fce53d189ad05bee4 (diff) | |
Core/Spells: Fixed warlock's Banish cancel if target was already banished (#23697)
* Core/Spells: Add SpellMissInfo argument to BeforeHit hooks and call them also when the spell doesn't hit. (#17613)
(cherry picked from commit 8ff5b35be1256d03b85438b130dcec7cd4cae6e1)
# Conflicts:
# src/server/game/Spells/Spell.cpp
# src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
# src/server/scripts/Spells/spell_warlock.cpp
* Core/Spells: Fixed warlock's Banish cancel if target was already banished (#17614)
(cherry picked from commit 4587b5d88082d2c6416fafaa2f5b9f5f15038520)
# Conflicts:
# src/server/scripts/Spells/spell_warlock.cpp
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 5e05fd2f911..740f7afdfab 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2284,6 +2284,8 @@ void Spell::TargetInfo::PreprocessTarget(Spell* spell) if ((MissCondition == SPELL_MISS_IMMUNE || MissCondition == SPELL_MISS_IMMUNE2) && spell->m_caster->GetTypeId() == TYPEID_PLAYER && unit->GetTypeId() == TYPEID_PLAYER && spell->m_caster->IsValidAttackTarget(unit, spell->GetSpellInfo())) unit->SetInCombatWith(spell->m_caster->ToPlayer()); + spell->CallScriptBeforeHitHandlers(MissCondition); + _enablePVP = false; // need to check PvP state before spell effects, but act on it afterwards if (_spellHitTarget) { @@ -2592,7 +2594,7 @@ void Spell::GOTargetInfo::DoTargetSpellHit(Spell* spell, uint8 effIndex) if (!go) return; - spell->CallScriptBeforeHitHandlers(); + spell->CallScriptBeforeHitHandlers(SPELL_MISS_NONE); spell->HandleEffects(nullptr, nullptr, go, effIndex, SPELL_EFFECT_HANDLE_HIT_TARGET); @@ -2616,7 +2618,7 @@ void Spell::GOTargetInfo::DoTargetSpellHit(Spell* spell, uint8 effIndex) void Spell::ItemTargetInfo::DoTargetSpellHit(Spell* spell, uint8 effIndex) { - spell->CallScriptBeforeHitHandlers(); + spell->CallScriptBeforeHitHandlers(SPELL_MISS_NONE); spell->HandleEffects(nullptr, TargetItem, nullptr, effIndex, SPELL_EFFECT_HANDLE_HIT_TARGET); @@ -2638,8 +2640,6 @@ SpellMissInfo Spell::PreprocessSpellHit(Unit* unit, bool scaleAura, TargetInfo& if (m_spellInfo->Speed && unit->IsImmunedToSpell(m_spellInfo, m_caster)) return SPELL_MISS_IMMUNE; - CallScriptBeforeHitHandlers(); - if (Player* player = unit->ToPlayer()) { player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, m_spellInfo->Id); @@ -7826,7 +7826,7 @@ void Spell::CallScriptSuccessfulDispel(SpellEffIndex effIndex) } } -void Spell::CallScriptBeforeHitHandlers() +void Spell::CallScriptBeforeHitHandlers(SpellMissInfo missInfo) { for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { @@ -7834,7 +7834,7 @@ void Spell::CallScriptBeforeHitHandlers() (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_HIT); auto hookItrEnd = (*scritr)->BeforeHit.end(), hookItr = (*scritr)->BeforeHit.begin(); for (; hookItr != hookItrEnd; ++hookItr) - (*hookItr).Call(*scritr); + (*hookItr).Call(*scritr, missInfo); (*scritr)->_FinishScriptCall(); } |
