aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Combat/ThreatManager.cpp
diff options
context:
space:
mode:
authorsarjuuk <junkdump@gmx.net>2011-08-21 12:00:36 +0200
committerQAston <qaston@gmail.com>2011-09-03 17:42:44 +0200
commitb40bf693194abd3f1b9e35ab6792f0df2369d1dc (patch)
tree249282c9ea638669a0d1958a5a5e7ad472de40fb /src/server/game/Combat/ThreatManager.cpp
parentdc01541111c707eb4a58f914ee6234bf93e968af (diff)
[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)
Diffstat (limited to 'src/server/game/Combat/ThreatManager.cpp')
-rwxr-xr-xsrc/server/game/Combat/ThreatManager.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp
index bf3650f611e..858ef057baf 100755
--- a/src/server/game/Combat/ThreatManager.cpp
+++ b/src/server/game/Combat/ThreatManager.cpp
@@ -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;