[SpellEffect] Fix bugged amount of threat given by Taunt

1) doAddThreat call instead of AddThreat. ThreatCalcHelper shouldnt be called. Otherwise, the value of the threat that will be added to the caster will be multiplied by a threatModifier (about 1.6)
2) Taunt should give the caster the same threat as the one in the top of the list. If player A has aggro with 1000 threat, player B has 1050 threat and if player C taunts, player C should have 1050 threat after the taunt and not 1000 (the difference can be much bigger with ranged players).
This commit is contained in:
chaodhib
2015-06-28 17:21:14 +02:00
parent accab5451d
commit 00788c6f01

View File

@@ -3100,19 +3100,18 @@ void Spell::EffectTaunt(SpellEffIndex /*effIndex*/)
if (m_spellInfo->Id == 62124)
m_caster->CastSpell(unitTarget, 67485, true);
// Also use this effect to set the taunter's threat to the taunted creature's highest value
if (unitTarget->getThreatManager().getCurrentVictim())
{
float myThreat = unitTarget->getThreatManager().getThreat(m_caster);
float itsThreat = unitTarget->getThreatManager().getCurrentVictim()->getThreat();
if (itsThreat > myThreat)
unitTarget->getThreatManager().addThreat(m_caster, itsThreat - myThreat);
}
//Set aggro victim to caster
if (!unitTarget->getThreatManager().getOnlineContainer().empty())
{
// Also use this effect to set the taunter's threat to the taunted creature's highest value
float myThreat = unitTarget->getThreatManager().getThreat(m_caster);
float topThreat = unitTarget->getThreatManager().getOnlineContainer().getMostHated()->getThreat();
if (topThreat > myThreat)
unitTarget->getThreatManager().doAddThreat(m_caster, topThreat - myThreat);
//Set aggro victim to caster
if (HostileReference* forcedVictim = unitTarget->getThreatManager().getOnlineContainer().getReferenceByTarget(m_caster))
unitTarget->getThreatManager().setCurrentVictim(forcedVictim);
}
if (unitTarget->ToCreature()->IsAIEnabled && !unitTarget->ToCreature()->HasReactState(REACT_PASSIVE))
unitTarget->ToCreature()->AI()->AttackStart(m_caster);