481 | | return; |
482 | | } |
483 | | } |
| 486 | break; |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | // interrupt channeled spell |
| 491 | if(Spell* spell = m_currentSpells[CURRENT_CHANNELED_SPELL]) |
| 492 | if(spell->getState() == SPELL_STATE_CASTING && (spell->m_spellInfo->AuraInterruptFlags & flag)) |
| 493 | InterruptNonMeleeSpells(false); |
| 494 | } |
| 495 | |
| 496 | void Unit::UpdateInterruptMask() |
| 497 | { |
| 498 | m_interruptMask = 0; |
| 499 | for(AuraList::iterator i = m_interruptableAuras.begin(); i != m_interruptableAuras.end(); ++i) |
| 500 | { |
| 501 | if(*i) |
| 502 | m_interruptMask |= (*i)->GetSpellProto()->AuraInterruptFlags; |
| 503 | } |
| 504 | if(Spell* spell = m_currentSpells[CURRENT_CHANNELED_SPELL]) |
| 505 | if(spell->getState() == SPELL_STATE_CASTING) |
| 506 | m_interruptMask |= spell->m_spellInfo->AuraInterruptFlags; |
912 | | // TODO: Store auras by interrupt flag to speed this up. |
913 | | /*AuraMap& vAuras = pVictim->GetAuras(); |
914 | | for (AuraMap::iterator i = vAuras.begin(), next; i != vAuras.end(); i = next) |
915 | | { |
916 | | const SpellEntry *se = i->second->GetSpellProto(); |
917 | | next = i; ++next; |
918 | | if( se->AuraInterruptFlags & AURA_INTERRUPT_FLAG_DAMAGE ) |
919 | | { |
920 | | bool remove = true; |
921 | | if (se->procFlags & (1<<3)) |
922 | | { |
923 | | if (!roll_chance_i(se->procChance)) |
924 | | remove = false; |
925 | | } |
926 | | if (remove) |
927 | | { |
928 | | pVictim->RemoveAurasDueToSpell(i->second->GetId()); |
929 | | // FIXME: this may cause the auras with proc chance to be rerolled several times |
930 | | next = vAuras.begin(); |
931 | | } |
932 | | } |
933 | | else */ |
934 | | pVictim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DAMAGE); |
935 | | pVictim->RemoveSpellbyDamageTaken(damage, spellProto ? spellProto->Id : 0); |
936 | | |
937 | | if (damagetype != NODAMAGE && damage && pVictim->GetTypeId() == TYPEID_PLAYER) |
938 | | { |
939 | | if( damagetype != DOT ) |
940 | | { |
941 | | for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++) |
942 | | { |
943 | | // skip channeled spell (processed differently below) |
944 | | if (i == CURRENT_CHANNELED_SPELL) |
945 | | continue; |
946 | | |
947 | | if(Spell* spell = pVictim->m_currentSpells[i]) |
| 920 | if (damagetype != NODAMAGE && damage)// && pVictim->GetTypeId() == TYPEID_PLAYER) |
| 921 | { |
| 922 | //if (se->procFlags & (1<<3)) |
| 923 | pVictim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DAMAGE); |
| 924 | pVictim->RemoveSpellbyDamageTaken(damage, spellProto ? spellProto->Id : 0); |
| 925 | |
| 926 | if(pVictim != this && pVictim->GetTypeId() == TYPEID_PLAYER) // does not support creature push_back |
| 927 | { |
| 928 | if(damagetype != DOT) |
| 929 | { |
| 930 | if(Spell* spell = pVictim->m_currentSpells[CURRENT_GENERIC_SPELL]) |
| 931 | { |
949 | | spell->Delayed(); |
950 | | } |
951 | | } |
952 | | |
953 | | if(Spell* spell = pVictim->m_currentSpells[CURRENT_CHANNELED_SPELL]) |
954 | | { |
955 | | if (spell->getState() == SPELL_STATE_CASTING) |
956 | | { |
957 | | uint32 channelInterruptFlags = spell->m_spellInfo->ChannelInterruptFlags; |
958 | | if( channelInterruptFlags & CHANNEL_FLAG_DELAY ) |
| 933 | { |
| 934 | uint32 interruptFlags = spell->m_spellInfo->InterruptFlags; |
| 935 | if(interruptFlags & SPELL_INTERRUPT_FLAG_DAMAGE) |
| 936 | pVictim->InterruptNonMeleeSpells(false); |
| 937 | else if(interruptFlags & SPELL_INTERRUPT_FLAG_PUSH_BACK) |
| 938 | spell->Delayed(); |
| 939 | } |
| 940 | } |
| 941 | } |
| 942 | |
| 943 | if(Spell* spell = pVictim->m_currentSpells[CURRENT_CHANNELED_SPELL]) |
| 944 | { |
| 945 | if(spell->getState() == SPELL_STATE_CASTING) |
963 | | else if( (channelInterruptFlags & (CHANNEL_FLAG_DAMAGE | CHANNEL_FLAG_DAMAGE2)) ) |
964 | | { |
965 | | sLog.outDetail("Spell %u canceled at damage!",spell->m_spellInfo->Id); |
966 | | pVictim->InterruptSpell(CURRENT_CHANNELED_SPELL); |
967 | | } |
968 | | } |
969 | | else if (spell->getState() == SPELL_STATE_DELAYED) |
970 | | // break channeled spell in delayed state on damage |
971 | | { |
972 | | sLog.outDetail("Spell %u canceled at damage!",spell->m_spellInfo->Id); |
973 | | pVictim->InterruptSpell(CURRENT_CHANNELED_SPELL); |