void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            if (TargetTimer <= diff && Enslaved == false)
            {
                EnslaveTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
                TargetTimer = 1000;
            } else TargetTimer -= diff;

            if (EnslaveEndTimer <= diff && Enslaved == true)
            {
                me->SetReactState(REACT_AGGRESSIVE);
                EnslaveTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
                EnslaveTarget->RemoveAurasDueToSpell(SPELL_ENSLAVE);
                EnslaveTarget->RemoveAurasDueToSpell(SPELL_ENSLAVE_BUFF);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                Enslaved = false;
                EnslaveTimer = 30000;
                AbsorbMagicTimer = 20000;
                MindFogTimer = urand(6000,12000);
                UnrelentingAgonyTimer = 10000;
                EnslaveEndTimer = 90000;
            } else EnslaveEndTimer -= diff;

            if (EnslaveTimer <= diff && Enslaved == false)
            {
                if (EnslaveTarget)
                {
                    DoZoneInCombat();
                    me->SetReactState(REACT_PASSIVE);
                    DoCast(EnslaveTarget, SPELL_ENSLAVE);
                    DoCast(EnslaveTarget, SPELL_ENSLAVE_BUFF);
                    me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    DoScriptText(RAND(SAY_MIND_CONTROL_1,SAY_MIND_CONTROL_2,SAY_MIND_CONTROL_3), me);
                    Enslaved = true;
                    EnslaveTimer = 180000;
                    AbsorbMagicTimer = 180000;
                    MindFogTimer = 180000;
                    UnrelentingAgonyTimer = 180000;
                    EnslaveEndTimer = DUNGEON_MODE(60000,30000);
                    CastTimer = 2000;
                }
                EnslaveTimer = 1000;
            } else EnslaveTimer -= diff;

            if (EnslaveTarget && Enslaved == true)
                if (EnslaveTarget->HealthBelowPct(50))
                {
                    me->SetReactState(REACT_AGGRESSIVE);
                    EnslaveTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
                    EnslaveTarget->RemoveAurasDueToSpell(SPELL_ENSLAVE);
                    EnslaveTarget->RemoveAurasDueToSpell(SPELL_ENSLAVE_BUFF);
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    Enslaved = false;
                    EnslaveTimer = 30000;
                    AbsorbMagicTimer = 20000;
                    MindFogTimer = urand(6000,12000);
                    UnrelentingAgonyTimer = 10000;
                }

            if (CastTimer <= diff && Enslaved == true)
            {
                if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, NotCharmedTargetSelector()))
                {
                    switch(EnslaveTarget->getClass())
                    {
                    case CLASS_DRUID:
                        if (urand(0,1))
                            EnslaveTarget->CastSpell(pTarget, 8921, false);
                        else
                            EnslaveTarget->CastSpell(me, 774, false);
                        break;
                    case CLASS_HUNTER:
                        EnslaveTarget->CastSpell(pTarget, RAND(2643, 1978), false);
                        break;
                    case CLASS_MAGE:
                        EnslaveTarget->CastSpell(pTarget, RAND(44614, 30455), false);
                        break;
                    case CLASS_WARLOCK:
                        EnslaveTarget->CastSpell(pTarget, RAND(980, 686), true);
                        break;
                    case CLASS_WARRIOR:
                        EnslaveTarget->CastSpell(pTarget, RAND(46924, 845), false);
                        break;
                    case CLASS_PALADIN:
                        if (urand(0,1))
                            EnslaveTarget->CastSpell(pTarget, 853, false);
                        else
                            EnslaveTarget->CastSpell(me, 20473, false);
                        break;
                    case CLASS_PRIEST:
                        if (urand(0,1))
                            EnslaveTarget->CastSpell(pTarget, 34914, false);
                        else
                            EnslaveTarget->CastSpell(me, 139, false);
                        break;
                    case CLASS_SHAMAN:
                        if (urand(0,1))
                            EnslaveTarget->CastSpell(pTarget, 421, false);
                        else
                            EnslaveTarget->CastSpell(me, 61295, false);
                        break;
                    case CLASS_ROGUE:
                        EnslaveTarget->CastSpell(pTarget, RAND(16511, 1329), false);
                        break;
                    case CLASS_DEATH_KNIGHT:
                        if (urand(0,1))
                            EnslaveTarget->CastSpell(pTarget, 45462, true);
                        else
                            EnslaveTarget->CastSpell(pTarget, 49184, true);
                        break;
                    }
                }
                CastTimer = 3000;
            } else CastTimer -= diff;

            if (AbsorbMagicTimer <= diff && Enslaved == false)
            {
                DoCast(me, SPELL_ABSORB_MAGIC);
                AbsorbMagicTimer = urand(15000,20000);
            } else AbsorbMagicTimer -= diff;

            if (MindFogTimer <= diff && Enslaved == false)
            {
                DoCast(me, SPELL_MIND_FOG_SUMMON);
                DoScriptText(SAY_MIND_FOG, me);
                MindFogTimer = 18000;
            } else MindFogTimer -= diff;

            if (UnrelentingAgonyTimer <= diff && Enslaved == false)
            {
                DoCastAOE(SPELL_UNRELENTING_AGONY);
                UnrelentingAgonyTimer = 20000;
            } else UnrelentingAgonyTimer -= diff;

            DoMeleeAttackIfReady();
        }
Example #2
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();
     }
 }
Example #3
0
    void JustDied(Unit* killer)
    {
        if (!m_creature || m_creature->GetTypeId() != TYPEID_UNIT)
            return;

        if (!ownerGUID)
            ownerGUID = m_creature->GetCreatorGUID();

        Unit* owner = m_creature->GetMap()->GetUnit(ownerGUID);

        if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
            return;

        owner->RemoveAurasDueToSpell(seatSpell);
        owner->RemoveAurasDueToSpell(53797);
        m_creature->SetCreatorGUID(0);
    }
Example #4
0
 void HandleDummyTick(AuraEffect const* /*aurEff*/)
 {
     Unit* caster = GetCaster();
     Unit* target = GetTarget();
     if (caster && target)
     {
         if (target->HasUnitState(UNIT_STATE_CASTING))
         {
             caster->CastSpell(target, SPELL_MISTRESS_KISS_DAMAGE_SILENCE, true);
             target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
         }
     }
 }