[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:
VladimirMangos 2009-10-17 10:47:44 +04:00
parent ba62cdbe8f
commit b258a17ba4
15 changed files with 50 additions and 32 deletions

View file

@ -233,7 +233,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleNoImmediateEffect, //180 SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS implemented in Unit::SpellDamageBonus
&Aura::HandleUnused, //181 unused (3.0.8a) old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS
&Aura::HandleAuraModResistenceOfStatPercent, //182 SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT
&Aura::HandleNULL, //183 SPELL_AURA_MOD_CRITICAL_THREAT only used in 28746
&Aura::HandleNoImmediateEffect, //183 SPELL_AURA_MOD_CRITICAL_THREAT only used in 28746, implemented in ThreatCalcHelper::calcThreat
&Aura::HandleNoImmediateEffect, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
&Aura::HandleNoImmediateEffect, //185 SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
&Aura::HandleNoImmediateEffect, //186 SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE implemented in Unit::MagicSpellHitResult
@ -2195,7 +2195,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
case 1515: // Tame beast
// FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
if( caster && m_target->CanHaveThreatList())
m_target->AddThreat(caster, 10.0f);
m_target->AddThreat(caster, 10.0f, false, GetSpellSchoolMask(GetSpellProto()), GetSpellProto());
return;
case 13139: // net-o-matic
// root to self part of (root_target->charge->root_self sequence
@ -4039,7 +4039,7 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real)
float threatMod = apply ? float(m_modifier.m_amount) : float(-m_modifier.m_amount);
m_target->getHostileRefManager().threatAssist(caster, threatMod);
m_target->getHostileRefManager().threatAssist(caster, threatMod, GetSpellProto());
}
void Aura::HandleModTaunt(bool apply, bool Real)
@ -6311,6 +6311,10 @@ void Aura::PeriodicTick()
// This method can modify pdamage
bool isCrit = IsCritFromAbilityAura(pCaster, pdamage);
// send critical in hit info for threat calculation
if (isCrit)
cleanDamage.hitOutCome = MELEE_HIT_CRIT;
pCaster->CalcAbsorbResist(m_target, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist);
sLog.outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
@ -6556,7 +6560,7 @@ void Aura::PeriodicTick()
if(gain_amount)
{
int32 gain = pCaster->ModifyPower(power, gain_amount);
m_target->AddThreat(pCaster, float(gain) * 0.5f, GetSpellSchoolMask(GetSpellProto()), GetSpellProto());
m_target->AddThreat(pCaster, float(gain) * 0.5f, pInfo.critical, GetSpellSchoolMask(GetSpellProto()), GetSpellProto());
}
break;
}