[Core/Threat] SpellThreat-Calculation revamped

short:
  - Threat is now distributed blizzlike (almost)

long:
  - Percent- and AP-Modifieres got add
  - Threat is now propperly distributed through multiple enemies
  - Most spells will cause initial threat in an amount equal to their SpellLevel
  - Energize-Effects will now be treated like healing (threat-wise)
  - Tanks got their missing +43% passive threat tacked on
  - Paladins are still missing 'Salvation' and will not only cause half threat with healing (essentially 25% of the amount healed)
This commit is contained in:
sarjuuk
2011-09-03 17:42:44 +02:00
committed by QAston
parent dc01541111
commit b40bf69319
9 changed files with 245 additions and 59 deletions
+3 -4
View File
@@ -40,10 +40,9 @@ void HostileRefManager::threatAssist(Unit* victim, float baseThreat, SpellInfo c
threat /= getSize();
while (ref)
{
if (victim == getOwner())
ref->addThreat(threat); // It is faster to modify the threat durectly if possible
else
ref->getSource()->addThreat(victim, threat);
if (ThreatCalcHelper::isValidProcess(victim, ref->getSource()->getOwner(), threatSpell))
ref->getSource()->doAddThreat(victim, threat);
ref = ref->next();
}
}
+13 -3
View File
@@ -36,8 +36,14 @@ float ThreatCalcHelper::calcThreat(Unit* hatedUnit, Unit* /*hatingUnit*/, float
{
if (threatSpell)
{
if (threatSpell->AttributesEx & SPELL_ATTR1_NO_THREAT)
return 0.0f;
if (SpellThreatEntry const* threatEntry = sSpellMgr->GetSpellThreatEntry(threatSpell->Id))
if (threatEntry->pctMod != 1.0f)
threat *= threatEntry->pctMod;
// Energize is not affected by Mods
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; i++)
if (threatSpell->Effects[i].Effect == SPELL_EFFECT_ENERGIZE || threatSpell->Effects[i].ApplyAuraName == SPELL_AURA_PERIODIC_ENERGIZE)
return threat;
if (Player* modOwner = hatedUnit->GetSpellModOwner())
modOwner->ApplySpellMod(threatSpell->Id, SPELLMOD_THREAT, threat);
@@ -46,7 +52,7 @@ float ThreatCalcHelper::calcThreat(Unit* hatedUnit, Unit* /*hatingUnit*/, float
return hatedUnit->ApplyTotalThreatModifier(threat, schoolMask);
}
bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellInfo const* /*threatSpell*/)
bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellInfo const* threatSpell)
{
//function deals with adding threat and adding players and pets into ThreatList
//mobs, NPCs, guards have ThreatList and HateOfflineList
@@ -68,6 +74,10 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn
if (!hatedUnit->isAlive() || !hatingUnit->isAlive())
return false;
// spell not causing threat
if (threatSpell && threatSpell->AttributesEx & SPELL_ATTR1_NO_THREAT)
return false;
ASSERT(hatingUnit->GetTypeId() == TYPEID_UNIT);
return true;