mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[8658] Threat calculation fixes and improvements.
* Add single arg version Unit::AddThreat for just adding to threat list. * Req. provide schollmask and crit flag for any real threat value for proper threats mod apply. * Send crit flag in DealDamage as MELEE_HIT_CRIT for spell damage for later send to threat call. * For not affected by modifiers threat values use SPELL_SCHOOL_MASK_NONE. * Implement aura SPELL_AURA_MOD_CRITICAL_THREAT (used only in itemset 529 effect).
This commit is contained in:
parent
ba62cdbe8f
commit
b258a17ba4
15 changed files with 50 additions and 32 deletions
|
|
@ -761,9 +761,9 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
if (pVictim->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
if(spellProto && IsDamageToThreatSpell(spellProto))
|
||||
pVictim->AddThreat(this, damage*2, damageSchoolMask, spellProto);
|
||||
pVictim->AddThreat(this, damage*2, (cleanDamage && cleanDamage->hitOutCome == MELEE_HIT_CRIT), damageSchoolMask, spellProto);
|
||||
else
|
||||
pVictim->AddThreat(this, damage, damageSchoolMask, spellProto);
|
||||
pVictim->AddThreat(this, damage, (cleanDamage && cleanDamage->hitOutCome == MELEE_HIT_CRIT), damageSchoolMask, spellProto);
|
||||
}
|
||||
else // victim is a player
|
||||
{
|
||||
|
|
@ -1125,7 +1125,7 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage *damageInfo, int32 damage, S
|
|||
|
||||
void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
|
||||
{
|
||||
if (damageInfo==0)
|
||||
if (!damageInfo)
|
||||
return;
|
||||
|
||||
Unit *pVictim = damageInfo->target;
|
||||
|
|
@ -1152,8 +1152,8 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
|
|||
return;
|
||||
}
|
||||
|
||||
// Call default DealDamage
|
||||
CleanDamage cleanDamage(damageInfo->cleanDamage, BASE_ATTACK, MELEE_HIT_NORMAL);
|
||||
// Call default DealDamage (send critical in hit info for threat calculation)
|
||||
CleanDamage cleanDamage(damageInfo->cleanDamage, BASE_ATTACK, damageInfo->HitInfo & SPELL_HIT_TYPE_CRIT ? MELEE_HIT_CRIT : MELEE_HIT_NORMAL);
|
||||
DealDamage(pVictim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, SpellSchoolMask(damageInfo->schoolMask), spellProto, durabilityLoss);
|
||||
}
|
||||
|
||||
|
|
@ -10196,7 +10196,10 @@ bool Unit::CanHaveThreatList() const
|
|||
|
||||
float Unit::ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask)
|
||||
{
|
||||
if(!HasAuraType(SPELL_AURA_MOD_THREAT))
|
||||
if (!HasAuraType(SPELL_AURA_MOD_THREAT))
|
||||
return threat;
|
||||
|
||||
if (schoolMask == SPELL_SCHOOL_MASK_NONE)
|
||||
return threat;
|
||||
|
||||
SpellSchools school = GetFirstSchoolInMask(schoolMask);
|
||||
|
|
@ -10206,11 +10209,11 @@ float Unit::ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask)
|
|||
|
||||
//======================================================================
|
||||
|
||||
void Unit::AddThreat(Unit* pVictim, float threat, SpellSchoolMask schoolMask, SpellEntry const *threatSpell)
|
||||
void Unit::AddThreat(Unit* pVictim, float threat, bool crit, SpellSchoolMask schoolMask, SpellEntry const *threatSpell /*= NULL*/)
|
||||
{
|
||||
// Only mobs can manage threat lists
|
||||
if(CanHaveThreatList())
|
||||
m_ThreatManager.addThreat(pVictim, threat, schoolMask, threatSpell);
|
||||
m_ThreatManager.addThreat(pVictim, threat, crit, schoolMask, threatSpell);
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue