Jump to content

Maybe useless part in Unit::_UpdateAutoRepeatSpell ?

Guest Toinan67

Recommended Posts


I was looking at Unit::_UpdateAutoRepeatSpell code and I saw this :

   //check movement
   if (GetTypeId() == TYPEID_PLAYER && ((Player*)this)->isMoving())
       // cancel wand shoot
       // auto shot just waits

(movement checking before casting auto-repeat spell)

Then we call Spell::CheckCast :

// Check if able to cast
if(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->CheckCast(true) != SPELL_CAST_OK)

// we want to shoot
Spell* spell = new Spell(this, m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo, true, 0);

But in CheckCast we have this :

   // cancel autorepeat spells if cast start when moving
   // (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
   if( m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->isMoving() )
       // skip stuck spell to allow use it in falling case and apply spell limitations at movement
       if( (!((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLINGFAR) || m_spellInfo->Effect[EFFECT_INDEX_0] != SPELL_EFFECT_STUCK) &&
           (IsAutoRepeat() || (m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) != 0) )
           return SPELL_FAILED_MOVING;

So, why the first part is there?

Thanks for your answer :)

Edit : Moreover, why do we have to call CheckCast explicitly in _UpdateAutoRepeatSpell, whereas it is called by Spell::Prepare a few lines later?

Link to comment
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use