Beispiel #1
0
        void StartDefense()
        {
            Player* player = GetNearestPlayer();

            if (player == nullptr)
                return;

            //Don't do anything with horde players
            if (player->IsTeamHorde())
                return;

            float player_x = player->GetPositionX();
            float player_y = player->GetPositionY();
            float player_z = player->GetPositionZ();

            //hardcoded values...
            // the guards should cast the spell if someone is behind them...
            if (player_x < 5891.88f && player_x >5858.89f && player_y < 594.99f && player_y >565.51f && player_z > 635.0f)
            {
                _unit->SetTargetGUID(player->GetGUID());
                _unit->EventCastSpell(player, dbcSpell.LookupEntry(54029));
            }
            else
            {
                _unit->SetTargetGUID(0); //Reset target... ugly
            }
        }
Beispiel #2
0
void Chaser::Update()
{
    bool before = IsOnScreen();

    if ( _timer )
        _timer--;
    if ( _timer <= 0 ) {
        _timer = TIME * ( _move + 1 );
        _move = !_move;
        if ( _move ) {
            Ship* p = GetNearestPlayer();
            _dir = p->GetPosition() - GetPosition();
            _dir.Normalise();
            _dir *= SPEED;
        }
    }
    if ( _move ) {
        Move( _dir );
        if ( !before && IsOnScreen() ) {
            _move = false;
        }
    }
    else {
        Rotate( M_PT_ONE );
    }
}
Beispiel #3
0
        void StartDefense()
        {
            Player* player = GetNearestPlayer();

            if (player == nullptr)
                return;

            //Don't do anything with alliance players
            if (player->IsTeamAlliance())
                return;

            float player_x = player->GetPositionX();
            float player_y = player->GetPositionY();
            float player_z = player->GetPositionZ();

            //hardcoded values...
            // the guards should cast the spell if someone is behind them...
            if (player_x < 5761.9f && player_x >5738.68f && player_y < 732.12f && player_y >712.09f && player_z > 635.0f)
            {
                _unit->SetTargetGUID(player->GetGUID());
                _unit->EventCastSpell(player, dbcSpell.LookupEntry(54028));
            }
            else
            {
                _unit->SetTargetGUID(0); //Reset target... ugly
            }
        }
Beispiel #4
0
		void OnLoad()
		{
			Player * pPlayer = GetNearestPlayer();

			if(pPlayer)
			{
				uint32 quests[] = { 12667, 12672, 12668, 12674, 12675, 0 };
				QuestLogEntry * en;
				bool has_quest = false;
				for( int i = 0; i < 6; i++ )
				{
					en = pPlayer->GetQuestLogForEntry( quests[i] );

					if(en != NULL)
					{
						has_quest = true;
						break;
					}
				}

				if( !has_quest )
				{
					pPlayer->RemoveAura(51671);
					return;
				}

				pPlayer->CastSpell(pPlayer, 51671, true);
			}
		}
        void OnLoad()
        {
            Player* pTarget = GetNearestPlayer();
            if (pTarget != NULL)
                _unit->GetAIInterface()->AttackReaction(pTarget, 50, 0);

            ParentClass::OnLoad();
        };
Beispiel #6
0
void Shielder::Update()
{
    fixed s = _power ? M_PT_ZERO_ONE * 12 : M_PT_ZERO_ONE * 4;
    Rotate( s );
    GetShape( 9 ).Rotate( -2 * s );
    for ( int i = 0; i < 8; i++ )
        GetShape( i ).Rotate( -s );

    bool onScreen = false;
    if ( GetPosition()._x < 0 )
        _dir.Set( 1, 0 );
    else if ( GetPosition()._x > Lib::WIDTH )
        _dir.Set( -1, 0 );
    else if ( GetPosition()._y < 0 )
        _dir.Set( 0, 1 );
    else if ( GetPosition()._y > Lib::HEIGHT )
        _dir.Set( 0, -1 );
    else
        onScreen = true;

    if ( !onScreen && _rotate ) {
        _timer = 0;
        _rotate = false;
    }

    fixed speed = SPEED + ( _power ? M_PT_ONE * 3 : M_PT_ONE * 2 ) * ( 16 - GetHP() );
    if ( _rotate ) {
        Vec2 d( _dir );
        d.Rotate( ( _rDir ? 1 : -1 ) * ( TIMER - _timer ) * M_PI / ( M_TWO * TIMER ) );
        _timer--;
        if ( _timer <= 0 ) {
            _timer = 0;
            _rotate = false;
            _dir.Rotate( ( _rDir ? 1 : -1 ) * M_PI / M_TWO );
        }
        Move( d * speed );
    }
    else {
        _timer++;
        if ( _timer > TIMER * 2 ) {
            _timer = TIMER;
            _rotate = true;
            _rDir = GetLib().RandInt( 2 ) != 0;
        }
        if ( IsOnScreen() && _timer % TIMER == TIMER / 2 && _power ) {
            Player* p = GetNearestPlayer();
            Vec2 v = GetPosition();

            Vec2 d = p->GetPosition() - v;
            d.Normalise();
            Spawn( new SBBossShot( v, d * M_THREE, 0x33cc99ff ) );
            PlaySoundRandom( Lib::SOUND_BOSS_FIRE );
        }
        Move( _dir * speed );
    }
    _dir.Normalise();

}
        void OnLoad()
        {
            _unit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_9);

            Player* pTarget = GetNearestPlayer();
            if (pTarget != NULL)
                _unit->GetAIInterface()->AttackReaction(pTarget, 50, 0);

            ParentClass::OnLoad();
        };
Beispiel #8
0
void Follow::Update()
{
    Rotate( M_PT_ONE );
    if ( Player::CountKilledPlayers() >= GetPlayers().size() )
        return;

    _timer++;
    if ( !_target || _timer > TIME ) {
        _target = GetNearestPlayer();
        _timer = 0;
    }
    Vec2 d = _target->GetPosition() - GetPosition();
    if ( d.Length() > 0 ) {
        d.Normalise();
        d *= SPEED;

        Move( d );
    }
}
	void OnReachWP(uint32 iWaypointId, bool bForwards)
	{
		if( iWaypointId == 1 )
		{
			switch( RandomUInt(2) )
			{
			case 0: Emote( "Life from the lifelessness... death for you.",			Text_Yell, 13961); break;
			case 1: Emote( "Nothing is wasted in the process. You will see....",	Text_Yell, 13962); break;
			};
			
			MoonScriptCreatureAI* pAnvil = GetNearestCreature( CN_VOLKHANS_ANVIL );
			if( pAnvil )
				_unit->CastSpell( pAnvil->GetUnit(), SPELL_TEMPER, true );
			else
				_unit->CastSpell( GetUnit(), SPELL_TEMPER, true );

			SetCanEnterCombat( true ); 
			_unit->GetAIInterface()->AttackReaction( GetNearestPlayer() , 1 ); // hackfix
		};
	};
	void AIUpdate()
	{
		m_part += 1;

		if( m_part == 1 )
		{
			_unit->CastSpell( _unit, SPELL_CRYSTAL_SPIKE_VISUAL, true );
		}
		else if( m_part == 5 )
		{
			PlayerPointer _plr = GetNearestPlayer();
			
			if ( IsHeroic() )
			{
				_unit->CastSpell( _plr, dbcSpell.LookupEntry(SPELL_CRYSTAL_SPIKE_H), true );
			}
			else
			{
				_unit->CastSpell( _plr, dbcSpell.LookupEntry(SPELL_CRYSTAL_SPIKE), true );
			};
		};
	};
Beispiel #11
0
 void OnLoad()
 {
     SetCanMove(false);
     plr = GetNearestPlayer();
     ParentClass::OnLoad();
 };
Beispiel #12
0
void Tractor::Update()
{
    GetShape( 0 ).Rotate(  M_PT_ZERO_ONE * 5 );
    GetShape( 1 ).Rotate( -M_PT_ZERO_ONE * 5 );
    if ( _power ) {
        GetShape( 3 ).Rotate( -M_PT_ZERO_ONE * 8 );
        GetShape( 4 ).Rotate(  M_PT_ZERO_ONE * 8 );
    }

    if ( GetPosition()._x < 0 )
        _dir.Set( 1, 0 );
    else if ( GetPosition()._x > Lib::WIDTH )
        _dir.Set( -1, 0 );
    else if ( GetPosition()._y < 0 )
        _dir.Set( 0, 1 );
    else if ( GetPosition()._y > Lib::HEIGHT )
        _dir.Set( 0, -1 );
    else
        _timer++;

    if ( !_ready && !_spinning ) {
        Move( _dir * SPEED * ( IsOnScreen() ? M_ONE : M_TWO + M_HALF ) );

        if ( _timer > TIMER * 8 ) {
            _ready = true;
            _timer = 0;
        }
    } else if ( _ready ) {
        if ( _timer > TIMER ) {
            _ready = false;
            _spinning = true;
            _timer = 0;
            _players = GetPlayers();
            PlaySound( Lib::SOUND_BOSS_FIRE );
        }
    } else if ( _spinning ) {
        Rotate( M_PT_ONE * 3 );
        for ( unsigned int i = 0; i < _players.size(); i++ ) {
            if ( !( ( Player* )_players[ i ] )->IsKilled() ) {
                Vec2 d = GetPosition() - _players[ i ]->GetPosition();
                d.Normalise();
                _players[ i ]->Move( d * TRACTOR_SPEED );
            }
        }

        if ( _timer % ( TIMER / 2 ) == 0 && IsOnScreen() && _power ) {
            Player* p = GetNearestPlayer();
            Vec2 v = GetPosition();

            Vec2 d = p->GetPosition() - v;
            d.Normalise();
            Spawn( new SBBossShot( v, d * M_FOUR, 0xcc33ccff ) );
            PlaySoundRandom( Lib::SOUND_BOSS_FIRE );
        }

        if ( _timer > TIMER * 5 ) {
            _spinning = false;
            _timer = 0;
        }
    }
}
Beispiel #13
0
	void AIUpdate()
	{
		GetNearestPlayer()->Possess( GetUnit() );
		GetUnit()->CastSpell( GetNearestPlayer(), POSSES_DRAGON, true ); 
	};