Fix some rogue issues (#122)

* Ported commits from cm

* Various external fixes - part 8
Ported commits from cmangos repositories
  - https://github.com/cmangos/mangos-classic/commit/f4b1f9f
  - https://github.com/cmangos/mangos-classic/commit/dc8b867
Simplify debug log output in Unit.cpp

* Fix some rogue issues
  -Distract ability was not set the target orientation properly
  -Improved Sap restored wrong rank of Stealth
Also revert part of previous commit, due to strange side effects.
Many thanks @mpfans for his support in fixing these issues.
This commit is contained in:
H0zen 2016-05-09 21:23:13 +03:00 committed by Antz
parent b15f4711a3
commit 7ba43d38d7
2 changed files with 9 additions and 7 deletions

View File

@ -2599,11 +2599,8 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
m_caster->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
}
// execute triggered without cast time explicitly in call point
if (!m_timer)
cast(true);
// add non-triggered (with cast time and without)
else if (!m_IsTriggeredSpell)
if (!m_IsTriggeredSpell)
{
// add to cast type slot
m_caster->SetCurrentCastedSpell(this);
@ -2614,6 +2611,9 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
TriggerGlobalCooldown();
}
// execute triggered without cast time explicitly in call point
if (m_timer == 0)
cast(true);
// else triggered with cast time will execute execute at next tick or later
// without adding to cast type slot
// will not show cast bar but will show effects at casting time etc

View File

@ -2440,8 +2440,10 @@ void Spell::EffectDistract(SpellEffectIndex /*eff_idx*/)
if (unitTarget->hasUnitState(UNIT_STAT_CAN_NOT_REACT))
{ return; }
unitTarget->SetFacingTo(unitTarget->GetAngle(m_targets.m_destX, m_targets.m_destY));
float angle = unitTarget->GetAngle(m_targets.m_destX, m_targets.m_destY);
unitTarget->SetFacingTo(angle);
unitTarget->clearUnitState(UNIT_STAT_MOVING);
unitTarget->SetOrientation(angle);
if (unitTarget->GetTypeId() == TYPEID_UNIT)
{ unitTarget->GetMotionMaster()->MoveDistract(damage * IN_MILLISECONDS); }
@ -3840,10 +3842,10 @@ void Spell::EffectSanctuary(SpellEffectIndex /*eff_idx*/)
// Improved Sap: a hacky way
if (m_triggeredByAuraSpell && m_spellInfo->Id == 14093 && unitTarget->GetTypeId() == TYPEID_PLAYER)
{
// find Stealth spell cooldown
// find highest rank Stealth spell cooldown
uint32 stealth_id = 0;
SpellCooldowns const scm = ((Player*)unitTarget)->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator it = scm.begin(); it != scm.end(); ++it)
for (SpellCooldowns::const_reverse_iterator it = scm.rbegin(); it != scm.rend(); ++it)
{
if (it->first >= 1784 && it->first <= 1787)
{