void UpdateAI(uint32 diff)
            {
                events.Update(diff);
                if (events.GetTimer() < 1200)
                    return;

                if (!me->IsInCombat() || !me->GetVictim())
                {
                    MySelectNextTarget();
                    return;
                }

                checktarget += diff;

                if (checktarget >= 1000)
                {
                    if (me->GetVictim()->HasBreakableByDamageCrowdControlAura() || !me->GetVictim()->IsAlive())
                    {
                        MySelectNextTarget();
                        me->InterruptNonMeleeSpells(true); // Stop casting if target is CC or not Alive.
                        return;
                    }
                }

                if (me->HasUnitState(UNIT_STATE_CASTING))
                    return;

                if (uint32 spellId = events.GetEvent())
                {
                    events.RescheduleEvent(spellId, spellId == 59637 ? 6500 : 2500);
                    me->CastSpell(me->GetVictim(), spellId, false);
                }
            }
Exemple #2
0
            void UpdateAI(uint32 diff)
            {
                if (_initialSelection)
                {
                    _initialSelection = false;
                    // Find victim of Summon Gargoyle spell
                    std::list<Unit*> targets;
                    Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 50);
                    Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targets, u_check);
                    me->VisitNearbyObject(50, searcher);
                    for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
                        if ((*iter)->GetAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID()))
                        {
                            (*iter)->RemoveAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID());
                            SetGazeOn(*iter);
                            _targetGUID = (*iter)->GetGUID();
                            break;
                        }
                }
                if (_despawnTimer > 4000)
                {
                    _despawnTimer -= diff;
                    if (!UpdateVictimWithGaze())
                    {
                        MySelectNextTarget();
                        return;
                    }

                    _initialCastTimer += diff;
                    _selectionTimer += diff;
                    if (_selectionTimer >= 1000)
                    {
                        MySelectNextTarget();
                        _selectionTimer = 0;
                    }
                    if (_initialCastTimer >= 2000 && !me->HasUnitState(UNIT_STATE_CASTING|UNIT_STATE_LOST_CONTROL) && me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE)
                        me->CastSpell(me->GetVictim(), 51963, false);
                }
                else
                {
                    if (!_despawning)
                        FlyAway();

                    if (_despawnTimer > diff)
                        _despawnTimer -= diff;
                    else
                        me->DespawnOrUnsummon();
                }
            }
            void UpdateAI(uint32 diff)
            {
                if (_initialSelection)
                {
                    _initialSelection = false;
                    // Find victim of Summon Gargoyle spell
                    std::list<Unit*> targets;
                    Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 50);
                    Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targets, u_check);
                    me->VisitNearbyObject(50, searcher);
                    for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
                        if ((*iter)->GetAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID()))
                        {
                            SwitchTargetAndAttack((*iter));
                            break;
                        }
                }

                if (_despawnTimer > 4000)
                {
                    _despawnTimer -= diff;

                    _initialCastTimer += diff;
                    _selectionTimer += diff;

                    if (_selectionTimer >= 1000)
                    {
                        MySelectNextTarget();
                        _selectionTimer = 0;
                    }
                    // check start timer and if not casting
                    if(_initialCastTimer >= 2000 && !me->HasUnitState(UNIT_STATE_CASTING))
                        if (!(me->HasAuraType(SPELL_AURA_MOD_FEAR) || me->HasAuraType(SPELL_AURA_MOD_ROOT) || me->HasAuraType(SPELL_AURA_MOD_CONFUSE) || me->HasAuraType(SPELL_AURA_MOD_STUN)))
                            if (_initialCastTimer >= 2000 && !me->HasUnitState(UNIT_STATE_LOST_CONTROL) && me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE)
                                me->CastSpell(me->GetVictim(), 51963, false);
                }
                else
                {
                    if (!_despawning)
                        FlyAway();

                    if (_despawnTimer > diff)
                        _despawnTimer -= diff;
                    else
                        me->DespawnOrUnsummon();
                }
            }
Exemple #4
0
 void Reset()
 {
     _selectionTimer = 0;
     me->SetReactState(REACT_PASSIVE);
     MySelectNextTarget();
 }