*Calculate Damage Done only when needed.
--HG-- branch : trunk
This commit is contained in:
+9
-8
@@ -277,6 +277,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
|
||||
ASSERT( info == sSpellStore.LookupEntry( info->Id ) && "`info` must be pointer to sSpellStore element");
|
||||
|
||||
m_spellInfo = info;
|
||||
m_customAttr = spellmgr.GetSpellCustomAttr(m_spellInfo->Id);
|
||||
m_caster = Caster;
|
||||
m_selfContainer = NULL;
|
||||
m_triggeringContainer = triggeringContainer;
|
||||
@@ -1091,7 +1092,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
||||
{
|
||||
m_caster->CombatStart(unit);
|
||||
}
|
||||
else if(spellmgr.GetSpellCustomAttr(m_spellInfo->Id) & SPELL_ATTR_CU_AURA_CC)
|
||||
else if(m_customAttr & SPELL_ATTR_CU_AURA_CC)
|
||||
{
|
||||
if(!unit->IsStandState())
|
||||
unit->SetStandState(PLAYER_STATE_NONE);
|
||||
@@ -1134,7 +1135,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
|
||||
}
|
||||
|
||||
unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL);
|
||||
if(spellmgr.GetSpellCustomAttr(m_spellInfo->Id) & SPELL_ATTR_CU_AURA_CC)
|
||||
if(m_customAttr & SPELL_ATTR_CU_AURA_CC)
|
||||
unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CC);
|
||||
}
|
||||
else
|
||||
@@ -1205,12 +1206,11 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
|
||||
}
|
||||
|
||||
//This is not needed with procflag patch
|
||||
/*if(spellmgr.GetSpellCustomAttr(m_spellInfo->Id) && m_originalCaster)
|
||||
/*if(m_originalCaster)
|
||||
{
|
||||
uint32 flag = spellmgr.GetSpellCustomAttr(m_spellInfo->Id);
|
||||
if(flag & SPELL_ATTR_CU_EFFECT_HEAL)
|
||||
if(m_customAttr & SPELL_ATTR_CU_EFFECT_HEAL)
|
||||
m_originalCaster->ProcDamageAndSpell(unit, PROC_FLAG_HEAL, PROC_FLAG_NONE, 0, GetSpellSchoolMask(m_spellInfo), m_spellInfo);
|
||||
if(m_originalCaster != unit && (flag & SPELL_ATTR_CU_EFFECT_DAMAGE))
|
||||
if(m_originalCaster != unit && (m_customAttr & SPELL_ATTR_CU_EFFECT_DAMAGE))
|
||||
m_originalCaster->ProcDamageAndSpell(unit, PROC_FLAG_HIT_SPELL, PROC_FLAG_STRUCK_SPELL, 0, GetSpellSchoolMask(m_spellInfo), m_spellInfo);
|
||||
}*/
|
||||
}
|
||||
@@ -1662,9 +1662,9 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
|
||||
|
||||
case TARGET_IN_FRONT_OF_CASTER:
|
||||
case TARGET_UNIT_CONE_ENEMY_UNKNOWN:
|
||||
if(spellmgr.GetSpellCustomAttr(m_spellInfo->Id) & SPELL_ATTR_CU_CONE_BACK)
|
||||
if(m_customAttr & SPELL_ATTR_CU_CONE_BACK)
|
||||
SearchAreaTarget(TagUnitMap, radius, PUSH_IN_BACK, SPELL_TARGETS_AOE_DAMAGE);
|
||||
else if(spellmgr.GetSpellCustomAttr(m_spellInfo->Id) & SPELL_ATTR_CU_CONE_LINE)
|
||||
else if(m_customAttr & SPELL_ATTR_CU_CONE_LINE)
|
||||
SearchAreaTarget(TagUnitMap, radius, PUSH_IN_LINE, SPELL_TARGETS_AOE_DAMAGE);
|
||||
else
|
||||
SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_AOE_DAMAGE);
|
||||
@@ -2218,6 +2218,7 @@ void Spell::cast(bool skipCheck)
|
||||
|
||||
FillTargetMap();
|
||||
|
||||
if(m_customAttr & SPELL_ATTR_CU_DIRECT_DAMAGE)
|
||||
CalculateDamageDoneForAllTargets();
|
||||
|
||||
// traded items have trade slot instead of guid in m_itemTargetGUID
|
||||
|
||||
@@ -567,6 +567,8 @@ class Spell
|
||||
// we can't store original aura link to prevent access to deleted auras
|
||||
// and in same time need aura data and after aura deleting.
|
||||
SpellEntry const* m_triggeredByAuraSpell;
|
||||
|
||||
uint32 m_customAttr;
|
||||
};
|
||||
|
||||
namespace Trinity
|
||||
|
||||
@@ -319,7 +319,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
|
||||
}
|
||||
|
||||
// Meteor like spells (divided damage to targets)
|
||||
if(spellmgr.GetSpellCustomAttr(m_spellInfo->Id) & SPELL_ATTR_CU_SHARE_DAMAGE)
|
||||
if(m_customAttr & SPELL_ATTR_CU_SHARE_DAMAGE)
|
||||
{
|
||||
uint32 count = 0;
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
|
||||
@@ -2121,6 +2121,17 @@ void SpellMgr::LoadSpellCustomAttr()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch(spellInfo->Effect[j])
|
||||
{
|
||||
case SPELL_EFFECT_SCHOOL_DAMAGE:
|
||||
case SPELL_EFFECT_WEAPON_DAMAGE:
|
||||
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
|
||||
case SPELL_EFFECT_NORMALIZED_WEAPON_DMG:
|
||||
case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE:
|
||||
case SPELL_EFFECT_HEAL:
|
||||
mSpellCustomAttr[i] |= SPELL_ATTR_CU_DIRECT_DAMAGE;
|
||||
}
|
||||
}
|
||||
|
||||
if(spellInfo->SpellVisual == 3879)
|
||||
|
||||
@@ -690,6 +690,7 @@ inline bool IsProfessionSkill(uint32 skill)
|
||||
#define SPELL_ATTR_CU_AURA_DOT 0x00000020
|
||||
#define SPELL_ATTR_CU_AURA_CC 0x00000040
|
||||
#define SPELL_ATTR_CU_AURA_SPELL 0x00000080
|
||||
#define SPELL_ATTR_CU_DIRECT_DAMAGE 0x00000100
|
||||
|
||||
typedef std::vector<uint32> SpellCustomAttribute;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user