Changeset 284 for trunk/src/game/Unit.cpp
- Timestamp:
- 11/22/08 01:55:20 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Unit.cpp
r283 r284 47 47 #include "CellImpl.h" 48 48 #include "Path.h" 49 #include "TemporarySummon.h" 49 50 50 51 #include <math.h> … … 3412 3413 if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spell_id)) 3413 3414 { 3415 // Unsummon any summoned as possessed creatures on channel interrupt 3416 SpellEntry const *spellInfo = m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo; 3417 for (int i = 0; i < 3; i++) 3418 { 3419 if (spellInfo->Effect[i] == SPELL_EFFECT_SUMMON && 3420 (spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED || 3421 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2 || 3422 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED3)) 3423 { 3424 // Possession is removed in the UnSummon function 3425 if (GetCharm()) 3426 ((TemporarySummon*)GetCharm())->UnSummon(); 3427 } 3428 } 3429 3414 3430 if (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED) 3415 3431 m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel(); … … 9791 9807 9792 9808 CharmInfo::CharmInfo(Unit* unit) 9793 : m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0) 9809 : m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0), m_barInit(false) 9794 9810 { 9795 9811 for(int i =0; i<4; ++i) … … 9802 9818 void CharmInfo::InitPetActionBar() 9803 9819 { 9820 if (m_barInit) 9821 return; 9822 9804 9823 // the first 3 SpellOrActions are attack, follow and stay 9805 9824 for(uint32 i = 0; i < 3; i++) … … 9816 9835 PetActionBar[i + 3].SpellOrAction = 0; 9817 9836 } 9818 } 9819 9820 void CharmInfo::InitEmptyActionBar() 9821 { 9822 for(uint32 x = 1; x < 10; ++x) 9837 m_barInit = true; 9838 } 9839 9840 void CharmInfo::InitEmptyActionBar(bool withAttack) 9841 { 9842 if (m_barInit) 9843 return; 9844 9845 for(uint32 x = 0; x < 10; ++x) 9823 9846 { 9824 9847 PetActionBar[x].Type = ACT_CAST; 9825 9848 PetActionBar[x].SpellOrAction = 0; 9826 9849 } 9827 PetActionBar[0].Type = ACT_COMMAND; 9828 PetActionBar[0].SpellOrAction = COMMAND_ATTACK; 9850 if (withAttack) 9851 { 9852 PetActionBar[0].Type = ACT_COMMAND; 9853 PetActionBar[0].SpellOrAction = COMMAND_ATTACK; 9854 } 9855 m_barInit = true; 9829 9856 } 9830 9857