Core/Spells: Failed triggered spell casts will no longer cause the proc aura that triggered them to be removed (this behavior should only apply to channeled spells), also corrected UNIT_FIELD_CHANNEL_OBJECT setting
This commit is contained in:
@@ -2935,11 +2935,12 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
|
|||||||
SpellCastResult result = CheckCast(true);
|
SpellCastResult result = CheckCast(true);
|
||||||
if (result != SPELL_CAST_OK && !IsAutoRepeat()) //always cast autorepeat dummy for triggering
|
if (result != SPELL_CAST_OK && !IsAutoRepeat()) //always cast autorepeat dummy for triggering
|
||||||
{
|
{
|
||||||
if (triggeredByAura && !triggeredByAura->GetBase()->IsPassive())
|
if (triggeredByAura && triggeredByAura->GetSpellInfo()->IsChanneled())
|
||||||
{
|
{
|
||||||
SendChannelUpdate(0);
|
SendChannelUpdate(0);
|
||||||
triggeredByAura->GetBase()->SetDuration(0);
|
triggeredByAura->GetBase()->SetDuration(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendCastResult(result);
|
SendCastResult(result);
|
||||||
|
|
||||||
finish(false);
|
finish(false);
|
||||||
@@ -4193,37 +4194,13 @@ void Spell::SendChannelUpdate(uint32 time)
|
|||||||
|
|
||||||
void Spell::SendChannelStart(uint32 duration)
|
void Spell::SendChannelStart(uint32 duration)
|
||||||
{
|
{
|
||||||
WorldObject* target = NULL;
|
uint64 channelTarget = 0;
|
||||||
|
if (m_targets.GetUnitTargetGUID())
|
||||||
// select first not resisted target from target list for first available effect
|
channelTarget = m_targets.GetUnitTargetGUID();
|
||||||
if (!m_UniqueTargetInfo.empty())
|
else if (m_targets.GetGOTargetGUID())
|
||||||
{
|
channelTarget = m_targets.GetGOTargetGUID();
|
||||||
for (std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr)
|
else if (m_targets.GetCorpseTargetGUID())
|
||||||
{
|
channelTarget = m_targets.GetCorpseTargetGUID();
|
||||||
for (uint8 effIndex = EFFECT_0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
|
|
||||||
{
|
|
||||||
if ((itr->effectMask & (1 << effIndex)) && itr->reflectResult == SPELL_MISS_NONE && itr->targetGUID != m_caster->GetGUID())
|
|
||||||
{
|
|
||||||
target = ObjectAccessor::GetUnit(*m_caster, itr->targetGUID);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!m_UniqueGOTargetInfo.empty())
|
|
||||||
{
|
|
||||||
for (std::list<GOTargetInfo>::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr)
|
|
||||||
{
|
|
||||||
for (uint8 effIndex = EFFECT_0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
|
|
||||||
{
|
|
||||||
if (itr->effectMask & (1 << effIndex))
|
|
||||||
{
|
|
||||||
target = m_caster->GetMap()->GetGameObject(itr->targetGUID);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WorldPacket data(MSG_CHANNEL_START, (8+4+4));
|
WorldPacket data(MSG_CHANNEL_START, (8+4+4));
|
||||||
data.append(m_caster->GetPackGUID());
|
data.append(m_caster->GetPackGUID());
|
||||||
@@ -4233,8 +4210,9 @@ void Spell::SendChannelStart(uint32 duration)
|
|||||||
m_caster->SendMessageToSet(&data, true);
|
m_caster->SendMessageToSet(&data, true);
|
||||||
|
|
||||||
m_timer = duration;
|
m_timer = duration;
|
||||||
if (target)
|
if (channelTarget)
|
||||||
m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, target->GetGUID());
|
m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, channelTarget);
|
||||||
|
|
||||||
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id);
|
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5307,7 +5285,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
return SPELL_FAILED_BAD_TARGETS;
|
return SPELL_FAILED_BAD_TARGETS;
|
||||||
|
|
||||||
Player* playerCaster = m_caster->ToPlayer();
|
Player* playerCaster = m_caster->ToPlayer();
|
||||||
//
|
//
|
||||||
if(!(playerCaster->GetSelection()))
|
if(!(playerCaster->GetSelection()))
|
||||||
return SPELL_FAILED_BAD_TARGETS;
|
return SPELL_FAILED_BAD_TARGETS;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user