fix(Core/Spells): Improvements to Far Sight spell: (#11683)

* fix(Core/Spells): Improvements to Far Sight spell:

Far Sight should not interrupt while casting another spell.
Corrected setting Far Sight object as an active object.
Fixed grid activation range for active dynamic objects.
When Far Sight is over, the camera be reset to player.
Enable swapping camera between Far Sight and Sentry Totem.
Fixes #6368

* Update.

* Update.
This commit is contained in:
UltraNix
2022-05-23 09:26:51 +02:00
committed by GitHub
parent 0c209dae75
commit 99f1cd84e2
12 changed files with 127 additions and 39 deletions

View File

@@ -3604,8 +3604,10 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
if (pSpell == m_currentSpells[CSpellType]) // avoid breaking self
return;
bool bySelf = m_currentSpells[CSpellType] && m_currentSpells[CSpellType]->m_spellInfo->Id == pSpell->m_spellInfo->Id;
// break same type spell if it is not delayed
InterruptSpell(CSpellType, false);
InterruptSpell(CSpellType, false, true, bySelf);
// special breakage effects:
switch (CSpellType)
@@ -3634,7 +3636,7 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
{
// channel spells always break generic non-delayed and any channeled spells
InterruptSpell(CURRENT_GENERIC_SPELL, false);
InterruptSpell(CURRENT_CHANNELED_SPELL);
InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, bySelf);
// it also does break autorepeat if not Auto Shot
if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] &&
@@ -5728,10 +5730,12 @@ DynamicObject* Unit::GetDynObject(uint32 spellId)
return nullptr;
}
void Unit::RemoveDynObject(uint32 spellId)
bool Unit::RemoveDynObject(uint32 spellId)
{
if (m_dynObj.empty())
return;
return false;
bool result = false;
for (DynObjectList::iterator i = m_dynObj.begin(); i != m_dynObj.end();)
{
DynamicObject* dynObj = *i;
@@ -5739,10 +5743,13 @@ void Unit::RemoveDynObject(uint32 spellId)
{
dynObj->Remove();
i = m_dynObj.begin();
result = true;
}
else
++i;
}
return result;
}
void Unit::RemoveAllDynObjects()
@@ -9922,7 +9929,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
}
// switch target
InterruptSpell(CURRENT_MELEE_SPELL);
InterruptSpell(CURRENT_MELEE_SPELL, true, true, true);
if (!meleeAttack)
ClearUnitState(UNIT_STATE_MELEE_ATTACKING);
}