[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)
{

View file

@ -617,7 +617,7 @@ class Spell
void HandleDelayedSpellLaunch(TargetInfo *target);
void InitializeDamageMultipliers();
void ResetEffectDamageAndHeal();
void DoSpellHitOnUnit(Unit *unit, uint32 effectMask);
void DoSpellHitOnUnit(Unit *unit, uint32 effectMask, bool isReflected = false);
void DoAllEffectOnTarget(GOTargetInfo *target);
void DoAllEffectOnTarget(ItemTargetInfo *target);
bool IsAliveUnitPresentInTargetList();

View file

@ -8909,9 +8909,9 @@ void Unit::IncrDiminishing(DiminishingGroup group)
m_Diminishing.push_back(DiminishingReturn(group,WorldTimer::getMSTime(),DIMINISHING_LEVEL_2));
}
void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster,DiminishingLevels Level, int32 limitduration)
void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster,DiminishingLevels Level, int32 limitduration, bool isReflected)
{
if(duration == -1 || group == DIMINISHING_NONE || caster->IsFriendlyTo(this) )
if(duration == -1 || group == DIMINISHING_NONE || (!isReflected && caster->IsFriendlyTo(this)) )
return;
// Duration of crowd control abilities on pvp target is limited by 10 sec. (2.2.0)

View file

@ -1149,7 +1149,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
DiminishingLevels GetDiminishing(DiminishingGroup group);
void IncrDiminishing(DiminishingGroup group);
void ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster, DiminishingLevels Level, int32 limitduration);
void ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster, DiminishingLevels Level, int32 limitduration, bool isReflected);
void ApplyDiminishingAura(DiminishingGroup group, bool apply);
void ClearDiminishings() { m_Diminishing.clear(); }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11696"
#define REVISION_NR "11697"
#endif // __REVISION_NR_H__