[11023] Implement support for threat multiplier and AP based threat bonus for spells.

* Higher ranks are now automatically filled when not listed in spell_threat
* Added some loading checks to detect inconsistent data

Signed-off-by: Lynx3d <lynx3d@some-imaginary-isp.org>
This commit is contained in:
x3n 2011-01-17 11:54:13 +01:00 committed by Lynx3d
parent 77d8b41cc4
commit d35be7f4c1
12 changed files with 238 additions and 177 deletions

View file

@ -293,7 +293,7 @@ void Unit::Update( uint32 update_diff, uint32 p_time )
{
if(!IsInWorld())
return;
/*if(p_time > m_AurasCheck)
{
m_AurasCheck = 2000;
@ -953,10 +953,8 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
}
if (pVictim->GetTypeId() != TYPEID_PLAYER)
{
if(spellProto && IsDamageToThreatSpell(spellProto))
pVictim->AddThreat(this, float(damage*2), (cleanDamage && cleanDamage->hitOutCome == MELEE_HIT_CRIT), damageSchoolMask, spellProto);
else
pVictim->AddThreat(this, float(damage), (cleanDamage && cleanDamage->hitOutCome == MELEE_HIT_CRIT), damageSchoolMask, spellProto);
float threat = damage * sSpellMgr.GetSpellThreatMultiplier(spellProto);
pVictim->AddThreat(this, threat, (cleanDamage && cleanDamage->hitOutCome == MELEE_HIT_CRIT), damageSchoolMask, spellProto);
}
else // victim is a player
{
@ -7185,22 +7183,6 @@ bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex i
return false;
}
bool Unit::IsDamageToThreatSpell(SpellEntry const * spellInfo) const
{
if (!spellInfo)
return false;
uint32 family = spellInfo->SpellFamilyName;
uint64 flags = spellInfo->SpellFamilyFlags;
if ((family == 5 && flags == 256) || //Searing Pain
(family == 6 && flags == 8192) || //Mind Blast
(family == 11 && flags == 1048576)) //Earth Shock
return true;
return false;
}
/**
* Calculates caster part of melee damage bonuses,
* also includes different bonuses dependent from target auras