Skip to content

Commit

Permalink
Core/NPCs: Interrupt Spells from fleeing Creatures
Browse files Browse the repository at this point in the history
Ticket: 668
  • Loading branch information
wahaxlekuke committed Nov 12, 2011
1 parent 55c0d3e commit a18305f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/server/game/Entities/Creature/Creature.cpp
Expand Up @@ -48,6 +48,7 @@
#include "Vehicle.h"
#include "SpellAuraEffects.h"
#include "Group.h"
#include "Spell.h"
// apply implementation of the singletons

TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const
Expand Down Expand Up @@ -654,6 +655,23 @@ void Creature::DoFleeToGetAssistance()
if (HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
return;

for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_AUTOREPEAT_SPELL; ++i)
{
if (Spell* spell = GetCurrentSpell(CurrentSpellTypes(i)))
{
SpellInfo const* curSpellInfo = spell->m_spellInfo;
// check if we can interrupt spell
if ((spell->getState() == SPELL_STATE_CASTING
|| (spell->getState() == SPELL_STATE_PREPARING && spell->GetCastTime() > 0.0f))
&& curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE
&& ((i == CURRENT_GENERIC_SPELL && curSpellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT)

This comment has been minimized.

Copy link
@idostyle

idostyle Nov 12, 2011

Geht ja um Bewegung, dann besser SPELL_INTERRUPT_FLAG_MOVEMENT.
Für Channel ist keiner definiert, weiß ich nicht ob es da noch einen gibt.
SPELL_PREVENTION_TYPE_SILENCE sollte keine Bedingung sein, geht hierbei nicht um EffectInterruptCast.

|| (i == CURRENT_CHANNELED_SPELL && curSpellInfo->ChannelInterruptFlags & CHANNEL_INTERRUPT_FLAG_INTERRUPT)))
{
InterruptSpell(CurrentSpellTypes(i), false);
}
}
}

float radius = sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
if (radius >0)
{
Expand Down

1 comment on commit a18305f

@wahaxlekuke
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.