diff options
author | megamage <none@none> | 2009-04-30 16:31:05 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-04-30 16:31:05 -0500 |
commit | 48dab8af91eadec76f59d0cd3d99fc7fca3a69e9 (patch) | |
tree | 97dbed833e095599a50d5877aa8c4943660d9fb1 /src/game/Unit.cpp | |
parent | d6b1013763a4405ec844ace19398c2bda5b5940e (diff) | |
parent | eb9328e4dbd5e136728f90ae794da1066688953f (diff) |
*Merge.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 28dc1694e0d..b1a39c30cce 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3394,12 +3394,14 @@ void Unit::SetCurrentCastedSpell( Spell * pSpell ) pSpell->SetReferencedFromCurrent(true); } -void Unit::InterruptSpell(uint32 spellType, bool withDelayed) +void Unit::InterruptSpell(uint32 spellType, bool withDelayed, bool withInstant) { assert(spellType < CURRENT_MAX_SPELL); Spell *spell = m_currentSpells[spellType]; - if(spell && (withDelayed || spell->getState() != SPELL_STATE_DELAYED) ) + if(spell + && (withDelayed || spell->getState() != SPELL_STATE_DELAYED) + && (withInstant || spell->GetCastTime() > 0)) { // for example, do not let self-stun aura interrupt itself if(!spell->IsInterruptable()) @@ -3443,19 +3445,19 @@ bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skip return(false); } -void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id) +void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id, bool withInstant) { // generic spells are interrupted if they are not finished or delayed if (m_currentSpells[CURRENT_GENERIC_SPELL] && (!spell_id || m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id==spell_id)) - InterruptSpell(CURRENT_GENERIC_SPELL,withDelayed); + InterruptSpell(CURRENT_GENERIC_SPELL,withDelayed,withInstant); // autorepeat spells are interrupted if they are not finished or delayed if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && (!spell_id || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id==spell_id)) - InterruptSpell(CURRENT_AUTOREPEAT_SPELL,withDelayed); + InterruptSpell(CURRENT_AUTOREPEAT_SPELL,withDelayed,withInstant); // channeled spells are interrupted if they are not finished, even if they are delayed if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spell_id)) - InterruptSpell(CURRENT_CHANNELED_SPELL,true); + InterruptSpell(CURRENT_CHANNELED_SPELL,true,true); } Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const @@ -3484,10 +3486,9 @@ bool Unit::isInBack(Unit const* target, float distance, float arc) const bool Unit::isInLine(Unit const* target, float distance) const { if(!HasInArc(M_PI, target) || !IsWithinDistInMap(target, distance)) return false; - float width = (GetObjectSize() / 2 + target->GetObjectSize()) / 2; - float angle = GetAngle(target); - angle -= GetOrientation(); - return abs(sin(angle)) * distance < width; + float width = GetObjectSize() + target->GetObjectSize() * 0.5f; + float angle = GetAngle(target) - GetOrientation(); + return abs(sin(angle)) * GetExactDistance2d(target->GetPositionX(), target->GetPositionY()) < width; } bool Unit::isInAccessiblePlaceFor(Creature const* c) const |