Exemplo n.º 1
0
            // Fly away when dismissed
            void FlyAway()
            {
                RemoveTargetAura();

                // Stop Fighting
                me->CombatStop(true);
                me->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE, true);

                // Sanctuary
                me->CastSpell(me, SPELL_DK_SANCTUARY, true);
                me->SetReactState(REACT_PASSIVE);

                me->SetSpeed(MOVE_FLIGHT, 1.0f, true);
                me->SetSpeed(MOVE_RUN, 1.0f, true);
                float x = me->GetPositionX() + 20 * cos(me->GetOrientation());
                float y = me->GetPositionY() + 20 * sin(me->GetOrientation());
                float z = me->GetPositionZ() + 40;
                me->DisableSpline();
                me->GetMotionMaster()->Clear(false);

                me->GetMotionMaster()->MoveCharge(x, y, z, 7.0f, 1);
                me->SetCanFly(true);
                me->SetDisableGravity(true);

                _despawning = true;
            }
Exemplo n.º 2
0
 void AttackStart(Unit* who)
 {
     RemoveTargetAura();
     _targetGUID = who->GetGUID();
     me->AddAura(SPELL_DK_SUMMON_GARGOYLE_1, who);
     ScriptedAI::AttackStart(who);
 }
Exemplo n.º 3
0
            void MySelectNextTarget()
            {
                Unit* owner = me->GetOwner();
                if (owner && owner->GetTypeId() == TYPEID_PLAYER)
                {
                    Unit* ghoulTarget = ObjectAccessor::GetUnit(*me, GetGhoulTargetGUID());
                    Unit* dkTarget = owner->ToPlayer()->GetSelectedUnit();

                    if (ghoulTarget && ghoulTarget != me->GetVictim() && me->IsValidAttackTarget(ghoulTarget))
                    {
                        me->GetMotionMaster()->Clear(false);
                        SwitchTargetAndAttack(ghoulTarget);
                        return;
                    }
                    
                    if (dkTarget && dkTarget != me->GetVictim() && me->IsValidAttackTarget(dkTarget))
                    {
                        me->GetMotionMaster()->Clear(false);
                        SwitchTargetAndAttack(dkTarget);
                        return;
                    }
                    
                    if (!me->GetVictim() || !owner->CanSeeOrDetect(me->GetVictim()))
                    {
                        me->CombatStop(true);
                        me->GetMotionMaster()->Clear(false);
                        me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, 0.0f);
                        RemoveTargetAura();
                        return;
                    }
                }
            }
Exemplo n.º 4
0
            void SwitchTargetAndAttack(Unit* who) 
            {
                RemoveTargetAura();
                _targetGUID = who->GetGUID();

                me->AddAura(SPELL_DK_SUMMON_GARGOYLE_1, who);
                ScriptedAI::AttackStart(who);
                me->SetReactState(REACT_PASSIVE);
            }
Exemplo n.º 5
0
 void MySelectNextTarget()
 {
     Unit* owner = me->GetOwner();
     if (owner && owner->GetTypeId() == TYPEID_PLAYER && (!me->GetVictim() || me->GetVictim()->IsImmunedToSpell(sSpellMgr->GetSpellInfo(51963)) || !me->IsValidAttackTarget(me->GetVictim()) || !owner->CanSeeOrDetect(me->GetVictim())))
     {
         Unit* selection = owner->ToPlayer()->GetSelectedUnit();
         if (selection && selection != me->GetVictim() && me->IsValidAttackTarget(selection))
         {
             me->GetMotionMaster()->Clear(false);
             SetGazeOn(selection);
         }
         else if (!me->GetVictim() || !owner->CanSeeOrDetect(me->GetVictim()))
         {
             me->CombatStop(true);
             me->GetMotionMaster()->Clear(false);
             me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, 0.0f);
             RemoveTargetAura();
         }
     }
 }