*Fix incorrect threat calculation of taunt spells.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-04-17 18:08:52 -05:00
parent 9de045c6d3
commit 8b7fb65c36
2 changed files with 16 additions and 10 deletions
+14 -8
View File
@@ -4042,18 +4042,24 @@ void Spell::EffectTaunt(uint32 /*i*/)
{ {
// this effect use before aura Taunt apply for prevent taunt already attacking target // this effect use before aura Taunt apply for prevent taunt already attacking target
// for spell as marked "non effective at already attacking target" // for spell as marked "non effective at already attacking target"
if(unitTarget && unitTarget->GetTypeId() != TYPEID_PLAYER) if(!unitTarget || !unitTarget->CanHaveThreatList()
|| unitTarget->getVictim() == m_caster)
{ {
if(unitTarget->getVictim()==m_caster) SendCastResult(SPELL_FAILED_DONT_REPORT);
{ return;
SendCastResult(SPELL_FAILED_DONT_REPORT);
return;
}
} }
// Also use this effect to set the taunter's threat to the taunted creature's highest value // Also use this effect to set the taunter's threat to the taunted creature's highest value
if(unitTarget->CanHaveThreatList() && unitTarget->getThreatManager().getCurrentVictim()) if(unitTarget->getThreatManager().getCurrentVictim())
unitTarget->getThreatManager().addThreat(m_caster,unitTarget->getThreatManager().getCurrentVictim()->getThreat()); {
float myThreat = unitTarget->getThreatManager().getThreat(m_caster);
float itsThreat = unitTarget->getThreatManager().getCurrentVictim()->getThreat();
if(itsThreat > myThreat)
unitTarget->getThreatManager().addThreat(m_caster, itsThreat - myThreat);
}
if(((Creature*)unitTarget)->IsAIEnabled)
((Creature*)unitTarget)->AI()->AttackStart(m_caster);
} }
void Spell::EffectWeaponDmg(uint32 i) void Spell::EffectWeaponDmg(uint32 i)
+2 -2
View File
@@ -10120,7 +10120,7 @@ void Unit::TauntApply(Unit* taunter)
if (((Creature*)this)->IsAIEnabled) if (((Creature*)this)->IsAIEnabled)
((Creature*)this)->AI()->AttackStart(taunter); ((Creature*)this)->AI()->AttackStart(taunter);
m_ThreatManager.tauntApply(taunter); //m_ThreatManager.tauntApply(taunter);
} }
//====================================================================== //======================================================================
@@ -10146,7 +10146,7 @@ void Unit::TauntFadeOut(Unit *taunter)
return; return;
} }
m_ThreatManager.tauntFadeOut(taunter); //m_ThreatManager.tauntFadeOut(taunter);
target = m_ThreatManager.getHostilTarget(); target = m_ThreatManager.getHostilTarget();
if (target && target != taunter) if (target && target != taunter)