mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
Core/Spells: Partial revert of b0fe236265 , thx A-Metaphysical-Drama for tip
Closes #2266 Closes #2442 Closes #2454 Closes #2455 Closes #2502
This commit is contained in:
@@ -5778,12 +5778,26 @@ bool Spell::CanAutoCast(Unit* target)
|
||||
return false; //target invalid
|
||||
}
|
||||
|
||||
SpellCastResult Spell::CheckRange(bool /*strict*/)
|
||||
SpellCastResult Spell::CheckRange(bool strict)
|
||||
{
|
||||
// Don't check for instant cast spells
|
||||
if (!strict && m_casttime == 0)
|
||||
return SPELL_CAST_OK;
|
||||
|
||||
uint32 range_type = 0;
|
||||
|
||||
if (m_spellInfo->RangeEntry)
|
||||
{
|
||||
// self cast doesn't need range checking -- also for Starshards fix
|
||||
if (m_spellInfo->RangeEntry->ID == 1)
|
||||
return SPELL_CAST_OK;
|
||||
|
||||
range_type = m_spellInfo->RangeEntry->type;
|
||||
}
|
||||
|
||||
Unit* target = m_targets.GetUnitTarget();
|
||||
float max_range = m_caster->GetSpellMaxRangeForTarget(target, m_spellInfo);
|
||||
float min_range = m_caster->GetSpellMinRangeForTarget(target, m_spellInfo);
|
||||
uint32 range_type = m_spellInfo->RangeEntry ? m_spellInfo->RangeEntry->type : 0;
|
||||
|
||||
if (Player* modOwner = m_caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, max_range, this);
|
||||
|
||||
Reference in New Issue
Block a user