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:
Shauren
2011-08-12 13:22:53 +02:00
parent c055b630a0
commit f797f9f74d
+12 -34
View File
@@ -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);
} }