mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +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:
@@ -400,7 +400,7 @@ const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = {
|
||||
#define SPELL_ATTR_EX4_UNK4 0x00000010 // 4 This will no longer cause guards to attack on use??
|
||||
#define SPELL_ATTR_EX4_UNK5 0x00000020 // 5
|
||||
#define SPELL_ATTR_EX4_NOT_STEALABLE 0x00000040 // 6 although such auras might be dispellable, they cannot be stolen
|
||||
#define SPELL_ATTR_EX4_UNK7 0x00000080 // 7
|
||||
#define SPELL_ATTR_EX4_TRIGGERED 0x00000080 // 7 spells forced to be triggered
|
||||
#define SPELL_ATTR_EX4_FIXED_DAMAGE 0x00000100 // 8 decimate, share damage?
|
||||
#define SPELL_ATTR_EX4_UNK9 0x00000200 // 9
|
||||
#define SPELL_ATTR_EX4_SPELL_VS_EXTEND_COST 0x00000400 // 10 Rogue Shiv have this flag
|
||||
|
||||
@@ -760,7 +760,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
|
||||
|
||||
caster->clearUnitState(UNIT_STAT_FOLLOW);
|
||||
|
||||
Spell *spell = new Spell(caster, spellInfo, false); // water elemental can cast freeze as triggered
|
||||
Spell *spell = new Spell(caster, spellInfo, false);
|
||||
spell->m_cast_count = castCount; // probably pending spell cast
|
||||
spell->m_targets = targets;
|
||||
|
||||
|
||||
@@ -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