Example #1
0
 void OnStackChange(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
 {
     if (GetStackAmount() == 15)
     {
         Unit* target = GetTarget(); // store target because aura gets removed
         target->CastSpell(target, SPELL_EXPLOSIVE_BARRAGE_DAMAGE, false);
         target->RemoveAurasDueToSpell(SPELL_HASTY_GROW);
         target->RemoveAurasDueToSpell(SPELL_AUTO_GROW);
         target->RemoveAurasDueToSpell(SPELL_EXPLODING_ORB);
         if (Creature* creature = target->ToCreature())
             creature->DespawnOrUnsummon();
     }
 }
void TimedFleeingMovementGenerator::Finalize(Unit &owner)
{
    owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
    owner.ClearUnitState(UNIT_STATE_FLEEING|UNIT_STATE_FLEEING_MOVE);
    if (Unit* victim = owner.getVictim())
    {
        if (owner.isAlive())
        {
            owner.AttackStop();
            owner.ToCreature()->AI()->AttackStart(victim);
        }
    }
}