[11697] fix damage and duration of reflected spells

This commit is contained in:
Laise 2011-06-28 18:56:30 +03:00
parent b3b1257625
commit 178654bbba
5 changed files with 13 additions and 9 deletions

View file

@ -1003,7 +1003,10 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
else if (missInfo == SPELL_MISS_REFLECT) // In case spell reflect from target, do all effect on caster (if hit)
{
if (target->reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him
DoSpellHitOnUnit(m_caster, mask);
{
DoSpellHitOnUnit(m_caster, mask, true);
unitTarget = m_caster;
}
}
else if(missInfo == SPELL_MISS_MISS || missInfo == SPELL_MISS_RESIST)
{
@ -1144,7 +1147,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo);
}
void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask)
void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask, bool isReflected)
{
if (!unit || !effectMask)
return;
@ -1295,7 +1298,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask)
if (duration > 0)
{
int32 limitduration = GetDiminishingReturnsLimitDuration(m_diminishGroup, m_spellInfo);
unit->ApplyDiminishingToDuration(m_diminishGroup, duration, m_caster, m_diminishLevel, limitduration);
unit->ApplyDiminishingToDuration(m_diminishGroup, duration, m_caster, m_diminishLevel, limitduration, isReflected);
// Fully diminished
if (duration == 0)
@ -1384,7 +1387,8 @@ void Spell::HandleDelayedSpellLaunch(TargetInfo *target)
// Fill base damage struct (unitTarget - is real spell target)
SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask);
if (missInfo == SPELL_MISS_NONE)
// keep damage amount for reflected spells
if (missInfo == SPELL_MISS_NONE || missInfo == SPELL_MISS_REFLECT)
{
for (int32 effectNumber = 0; effectNumber < MAX_EFFECT_INDEX; ++effectNumber)
{