Core/Spells: prevent creatures to focus channeled spells without SPELL_ATTR1_CHANNEL_TRACK_TARGET

- Creatures stuck here wouldn't try attacking because of this
- Remove one workaround in halion script, now it's unneeded

Ref #11311
This commit is contained in:
ariel-
2018-02-15 17:48:25 -03:00
parent 637dda815c
commit 29f7258dc8
4 changed files with 11 additions and 8 deletions

View File

@@ -3027,6 +3027,10 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
if (m_focusSpell)
return;
// some spells shouldn't track targets
if (focusSpell->IsFocusDisabled())
return;
SpellInfo const* spellInfo = focusSpell->GetSpellInfo();
// don't use spell focus for vehicle spells

View File

@@ -2999,7 +2999,7 @@ void Spell::prepare(SpellCastTargets const& targets, AuraEffect const* triggered
// focus if not controlled creature
if (m_caster->GetTypeId() == TYPEID_UNIT && !m_caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
{
if (!(m_spellInfo->IsNextMeleeSwingSpell() || IsAutoRepeat() || (_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING)))
if (!(m_spellInfo->IsNextMeleeSwingSpell() || IsAutoRepeat()))
{
if (m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget())
m_caster->ToCreature()->FocusTarget(this, m_targets.GetObjectTarget());
@@ -7024,6 +7024,11 @@ bool Spell::IsIgnoringCooldowns() const
return (_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD) != 0;
}
bool Spell::IsFocusDisabled() const
{
return ((_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING) || (m_spellInfo->IsChanneled() && !m_spellInfo->HasAttribute(SPELL_ATTR1_CHANNEL_TRACK_TARGET)));
}
bool Spell::IsProcDisabled() const
{
return (_triggeredCastFlags & TRIGGERED_DISALLOW_PROC_EVENTS) != 0;

View File

@@ -516,6 +516,7 @@ class TC_GAME_API Spell
void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; }
bool IsTriggered() const;
bool IsIgnoringCooldowns() const;
bool IsFocusDisabled() const;
bool IsProcDisabled() const;
bool IsChannelActive() const;
bool IsAutoActionResetSpell() const;

View File

@@ -924,13 +924,6 @@ class npc_orb_carrier : public CreatureScript
me->CastSpell(nullptr, SPELL_TRACK_ROTATION, false);
scheduler.Update(diff);
/// Workaround: This is here because even though the above spell has SPELL_ATTR1_CHANNEL_TRACK_TARGET,
/// we are having two creatures involded here. This attribute is handled clientside, meaning the client
/// sends orientation update itself. Here, no packet is sent, and the creature does not rotate. By
/// forcing the carrier to always be facing the rotation focus, we ensure everything works as it should.
if (Creature* rotationFocus = _instance->GetCreature(DATA_ORB_ROTATION_FOCUS))
me->SetFacingToObject(rotationFocus); // setInFront
}
void DoAction(int32 action) override