mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-06 08:59:11 +01:00
Core/Spells: Now you can cast the Water Elemental's Freeze without cancelling its Waterbolt.
Author: dr.tenma Fixes issue #4215 --HG-- branch : trunk
This commit is contained in:
@@ -484,7 +484,7 @@ m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo))
|
||||
|
||||
m_spellState = SPELL_STATE_NULL;
|
||||
|
||||
m_IsTriggeredSpell = triggered;
|
||||
m_IsTriggeredSpell = bool(triggered || (info->AttributesEx4 & SPELL_ATTR_EX4_TRIGGERED));
|
||||
m_CastItem = NULL;
|
||||
|
||||
unitTarget = NULL;
|
||||
@@ -2952,7 +2952,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
|
||||
m_caster->m_Events.AddEvent(Event, m_caster->m_Events.CalculateTime(1));
|
||||
|
||||
//Prevent casting at cast another spell (ServerSide check)
|
||||
if (m_caster->IsNonMeleeSpellCasted(false, true, true) && m_cast_count)
|
||||
if (!m_IsTriggeredSpell && m_caster->IsNonMeleeSpellCasted(false, true, true) && m_cast_count)
|
||||
{
|
||||
SendCastResult(SPELL_FAILED_SPELL_IN_PROGRESS);
|
||||
finish(false);
|
||||
@@ -5024,20 +5024,24 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
return SPELL_FAILED_NOT_MOUNTED;
|
||||
}
|
||||
|
||||
SpellCastResult castResult = SPELL_CAST_OK;
|
||||
|
||||
// always (except passive spells) check items (focus object can be required for any type casts)
|
||||
if (!IsPassiveSpell(m_spellInfo->Id))
|
||||
{
|
||||
SpellCastResult castResult = CheckItems();
|
||||
castResult = CheckItems();
|
||||
if (castResult != SPELL_CAST_OK)
|
||||
return castResult;
|
||||
}
|
||||
|
||||
// Triggered spells also have range check
|
||||
// TODO: determine if there is some flag to enable/disable the check
|
||||
castResult = CheckRange(strict);
|
||||
if (castResult != SPELL_CAST_OK)
|
||||
return castResult;
|
||||
|
||||
if (!m_IsTriggeredSpell)
|
||||
{
|
||||
SpellCastResult castResult = CheckRange(strict);
|
||||
if (castResult != SPELL_CAST_OK)
|
||||
return castResult;
|
||||
|
||||
castResult = CheckPower();
|
||||
if (castResult != SPELL_CAST_OK)
|
||||
return castResult;
|
||||
@@ -5830,22 +5834,22 @@ SpellCastResult Spell::CheckRange(bool strict)
|
||||
{
|
||||
// Because of lag, we can not check too strictly here.
|
||||
if (!m_caster->IsWithinMeleeRange(target, max_range))
|
||||
return SPELL_FAILED_OUT_OF_RANGE;
|
||||
return !m_IsTriggeredSpell ? SPELL_FAILED_OUT_OF_RANGE : SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
else if (!m_caster->IsWithinCombatRange(target, max_range))
|
||||
return SPELL_FAILED_OUT_OF_RANGE; //0x5A;
|
||||
return !m_IsTriggeredSpell ? SPELL_FAILED_OUT_OF_RANGE : SPELL_FAILED_DONT_REPORT; //0x5A;
|
||||
|
||||
if (range_type == SPELL_RANGE_RANGED)
|
||||
{
|
||||
if (m_caster->IsWithinMeleeRange(target))
|
||||
return SPELL_FAILED_TOO_CLOSE;
|
||||
return !m_IsTriggeredSpell ? SPELL_FAILED_TOO_CLOSE : SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
else if (min_range && m_caster->IsWithinCombatRange(target, min_range)) // skip this check if min_range = 0
|
||||
return SPELL_FAILED_TOO_CLOSE;
|
||||
return !m_IsTriggeredSpell ? SPELL_FAILED_TOO_CLOSE : SPELL_FAILED_DONT_REPORT;
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER &&
|
||||
(m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(static_cast<float>(M_PI), target))
|
||||
return SPELL_FAILED_UNIT_NOT_INFRONT;
|
||||
return !m_IsTriggeredSpell ? SPELL_FAILED_UNIT_NOT_INFRONT : SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
|
||||
if (m_targets.HasDst() && !m_targets.HasTraj())
|
||||
|
||||
Reference in New Issue
Block a user