Beispiel #1
0
void CAIBomber::DoBehavior()
{
	// reset jump and attack
	m_Jump = 0;
	m_Attack = 0;
	
	CheckAITiles();
	SeekPlayer();

	
	if (m_PlayerSpotCount > 0)
	{
		m_TargetTimer = 0;
	
		// on "first" sight
		if (m_PlayerSpotCount == 1 && m_BombTimer == 0)
		{
			Player()->GetCharacter()->SetEmoteFor(EMOTE_HAPPY, 1200, 1200);
			GameServer()->SendEmoticon(Player()->GetCID(), EMOTICON_HEARTS);
		}

		MoveTowardsPlayer(40);
		JumpIfPlayerIsAbove();
		
		m_Direction = m_PlayerDirection;
		
	
		if (m_BombTimer == 0)
		{
			if (m_PlayerDistance < 200)
			{
				m_BombTimer = 60;
				
				Player()->GetCharacter()->SetEmoteFor(EMOTE_HAPPY, 1200, 1200);
				GameServer()->SendEmoticon(Player()->GetCID(), EMOTICON_DEVILTEE);
				GameServer()->CreateSound(m_Pos, SOUND_PLAYER_PAIN_LONG);
			}
		}

		
		if (m_Pos.y < m_PlayerPos.y)
			m_Jump = 0;
	}
	
	Unstuck();
	HeadToMovingDirection();
	
	// next reaction in
	m_ReactionTime = 6 + frandom()*3;
	
}
void wgt_QVideoPlayer::SetCurrentPos(QTime Pos) {
    SeekPlayer(QTime(0,0,0,0).msecsTo(Pos));
}
void CAIPistolbot::DoBehavior()
{
	vec2 Pos;

	// character check
	if (Player()->GetCharacter())
		Pos = Player()->GetCharacter()->m_Pos;
	else
		return;

	// reset jump and attack
	m_Jump = 0;
	m_Attack = 0;
	
	CheckAITiles();
	SeekPlayer();
	
	// unstuck move
	if (abs(Pos.x - m_LastPos.x) < 20)
	{
		if (frandom() * 10 < 3)
			m_Move = -1;
		if (frandom() * 10 < 3)
			m_Move = 1;
		
		if (frandom() * 10 < 2)
			m_Jump = 1;
	}

	
	if (m_PlayerSpotCount > 0)
	{
		m_TargetTimer = 0;
	
		// on first time standstill and look stupid
		if (m_PlayerSpotCount == 1)
		{
			m_Move = 0;
			m_Direction = m_PlayerDirection;
			m_TargetPos = m_PlayerPos;
			m_Jump = 0;

			Player()->GetCharacter()->SetEmoteFor(EMOTE_ANGRY, 1200, 1200);
			m_ReactionTime = 40;
			return;
		}

		if (m_PlayerPos.x < Pos.x)
			m_TargetPos.x = m_PlayerPos.x + 400;
		else
			m_TargetPos.x = m_PlayerPos.x - 400;
		
		MoveTowardsTarget(140);
		
		if (m_PlayerDistance < 600)
			m_Attack = 1;
		
		
		if (m_PlayerDistance < 800)
		{
			m_Direction = m_PlayerDirection;
		}
		
		// start timer
		if (m_PlayerSpotTimer == 0)
			m_PlayerSpotTimer++;
	}
	else
	{
		// head to moving direction
		if (m_Move != 0)
			m_Direction = vec2(m_Move, 0);
	}
	

	
	
	/*
	// forget target after a while
	if (m_TargetTimer > 0)
	{
		MoveTowardsTarget();
		
		if (m_TargetTimer > 20)
		{
			m_TargetTimer = 0;
			m_Move = 0;
			m_Jump = 0;
			m_Attack = 0;
			m_ReactionTime = 60 + frandom()*3;
			
			Player()->GetCharacter()->SetEmoteFor(EMOTE_HAPPY, 1200);
			GameServer()->SendEmoticon(Player()->GetCID(), EMOTICON_ZZZ);
			return;
		}
	}
	*/
	
	
	

	// next reaction in
	m_ReactionTime = 6 + frandom()*3;
	
}
Beispiel #4
0
void CAIElectro::DoBehavior()
{
	vec2 Pos;

	// character check
	if (Player()->GetCharacter())
		Pos = Player()->GetCharacter()->m_Pos;
	else
		return;

	// reset jump and attack
	m_Jump = 0;
	m_Attack = 0;
	
	CheckAITiles();
	SeekPlayer();
	
	
	if (m_PlayerSpotCount > 0)
	{
		m_TargetTimer = 0;
	
		// on first time standstill and look stupid
		if (m_PlayerSpotCount == 1)
		{
			m_Move = 0;
			m_Jump = 0;
			m_Direction = m_PlayerDirection;

			Player()->GetCharacter()->SetEmoteFor(EMOTE_HAPPY, 1200, 1200);
			m_ReactionTime = 40;
			return;
		}

		MoveTowardsPlayer(40);
		m_Direction = m_PlayerDirection;
		
		if (m_PlayerDistance < 120)
			m_Attack = 1;
			
		if (m_PlayerDistance < 600)
		{
			float Angle = frandom()*360.0f*RAD;
			new CLightning(Player()->GetCharacter()->GameWorld(), Pos, vec2(cosf(Angle), sinf(Angle)), 50, 50, Player()->GetCID(), 1);
			Angle = frandom()*360.0f*RAD;
			new CLightning(Player()->GetCharacter()->GameWorld(), Pos, vec2(cosf(Angle), sinf(Angle)), 50, 50, Player()->GetCID(), 1);
		}
		
		
		JumpIfPlayerIsAbove();
			
		if (Pos.y < m_PlayerPos.y)
			m_Jump = 0;
	}
	
	Unstuck();
	HeadToMovingDirection();
	
	m_ReactionTime = 5;
	
}
Beispiel #5
0
void CAIBosshead::DoBehavior()
{
	// reset jump and attack
	m_Jump = 0;
	m_Attack = 0;
	m_Hook = 0;
	
	SeekPlayer();

	// state change if damaged enough
	if (Player()->GetCharacter()->m_HiddenHealth < m_StateHealth - 100)
	{
		m_State++;
		m_StateHealth = Player()->GetCharacter()->m_HiddenHealth;
		
		m_Move = 0;
		m_Attack = 0;
		
		// stop body too
		if (Player()->GetCharacter()->m_Bottom->GetPlayer()->m_pAI)
			Player()->GetCharacter()->m_Bottom->GetPlayer()->m_pAI->StandStill(60);
		
		StandStill(100);
		
		int Emoticon = EMOTICON_EXCLAMATION;
		
		if (m_State == 1)
		{
			Player()->GetCharacter()->SetCustomWeapon(HAMMER_BOTBASIC);
			Player()->GetCharacter()->m_Bottom->SetCustomWeapon(HAMMER_BOTFLYHAMMER);
			Emoticon = EMOTICON_EXCLAMATION;
		}
		if (m_State == 2)
		{
			Player()->GetCharacter()->SetCustomWeapon(GUN_BOTPISTOL);
			Player()->GetCharacter()->m_Bottom->SetCustomWeapon(GUN_BOTPISTOL);
			Emoticon = EMOTICON_ZOMG;
		}
		if (m_State == 3)
		{
			Player()->GetCharacter()->SetCustomWeapon(RIFLE_BOTLIGHTNING);
			Player()->GetCharacter()->m_Bottom->SetCustomWeapon(HAMMER_BOTBASIC);
			Emoticon = EMOTICON_SUSHI;
		}
		if (m_State == 4)
		{
			Player()->GetCharacter()->m_Bottom->SetCustomWeapon(HAMMER_BOTFLYHAMMER);
			Emoticon = EMOTICON_WTF;
		}
		if (m_State == 5)
		{
			
			Player()->GetCharacter()->SetCustomWeapon(RIFLE_BOTLIGHTNING);
			Player()->GetCharacter()->m_Bottom->SetCustomWeapon(RIFLE_BOTLIGHTNING);
			Emoticon = EMOTICON_SPLATTEE;
		}
		if (m_State == 6)
		{
			
			Player()->GetCharacter()->SetCustomWeapon(RIFLE_BOTLASER);
			Player()->GetCharacter()->m_Bottom->SetCustomWeapon(RIFLE_BOTLASER);
			Emoticon = EMOTICON_DEVILTEE;
		}
		
		GameServer()->SendEmoticon(Player()->GetCID(), Emoticon);
		Player()->GetCharacter()->SetEmoteFor(EMOTE_PAIN, 1200, 1200);
		
		return;
	}
	
	
	if (m_PlayerSpotCount > 0)
	{
		if (m_PlayerSpotCount == 1)
			Player()->GetCharacter()->SetEmoteFor(EMOTE_ANGRY, 1200, 1200);
				
		if (m_PlayerDistance < BotAttackRange[Player()->GetCharacter()->m_ActiveCustomWeapon])
			m_Attack = 1;
		
		m_Direction = m_PlayerDirection;
	}
	
	// next reaction in
	m_ReactionTime = 2;
	
}
Beispiel #6
0
void CAILaserbot::DoBehavior()
{
	// reset jump and attack
	m_Jump = 0;
	m_Attack = 0;
	
	CheckAITiles();
	SeekPlayer();
	
	if (m_PlayerSpotCount == 0)	
		m_Hook = 0;
	
	Unstuck();

	// hook moving (sucks)
	vec2 HookPos = m_Pos - vec2(0, 300);
			
	if (m_Move < 0)
		HookPos.x -= 250;
	else
		HookPos.x += 250;
			
				
	// hook if something in sight
	if (GameServer()->Collision()->IntersectLine(m_Pos, HookPos, NULL, NULL) && 
		m_LastHook == 0 && m_PlayerSpotCount == 0 && frandom()*10 < 4)
	{
		m_Hook = 1;
		m_Direction = HookPos - m_Pos;
		if (Player()->GetCharacter()->IsGrounded())
			m_Jump = 1;
	}
	else
		HeadToMovingDirection();
	
	
	if (m_PlayerSpotCount > 0)
	{
		m_TargetTimer = 0;
	
		// on first time standstill and look stupid
		if (m_PlayerSpotCount == 1)
		{
			m_Move = 0;
			m_Direction = m_PlayerDirection;
			m_TargetPos = m_PlayerPos;
			m_Jump = 0;

			Player()->GetCharacter()->SetEmoteFor(EMOTE_ANGRY, 1200, 1200);
			m_ReactionTime = 40;
			return;
		}


		if (m_PlayerPos.x < m_Pos.x)
			m_TargetPos.x = m_PlayerPos.x + 600;
		else
			m_TargetPos.x = m_PlayerPos.x - 600;
		
		MoveTowardsTarget(140);
		
		if (m_PlayerDistance < 700)
			m_Attack = 1;
		
		
		if (m_PlayerDistance < 1000)
			m_Direction = m_PlayerDirection;
	}

	// next reaction in
	m_ReactionTime = 6 + frandom()*3;
	
}
Beispiel #7
0
void CAIRunner::DoBehavior()
{
	vec2 Pos;

	// character check
	if (Player()->GetCharacter())
		Pos = Player()->GetCharacter()->m_Pos;
	else
		return;

	// reset jump and attack
	m_Jump = 0;
	m_Attack = 0;
	
	CheckAITiles();
	SeekPlayer();
	
	

	
	if (m_PlayerSpotCount > 0)
	{
		m_TargetTimer = 0;
	
		// on first time standstill and look stupid
		if (m_PlayerSpotCount == 1)
		{
			m_Move = 0;
			m_Jump = 0;
			m_Direction = m_PlayerDirection;

			Player()->GetCharacter()->SetEmoteFor(EMOTE_ANGRY, 1200, 1200);
			//GameServer()->SendEmoticon(Player()->GetCID(), EMOTICON_QUESTION);
			m_ReactionTime = 40;
			return;
		}

		MoveTowardsPlayer(40);
		m_Direction = m_PlayerDirection;
		
		if (m_PlayerDistance < 120)
			m_Attack = 1;
		
		// if the player is above bot
		if (abs(m_PlayerPos.x - Pos.x) < 100 && Pos.y > m_PlayerPos.y + 100)
		{
			if (frandom() * 10 < 3)
				m_Jump = 1;
		}

			
		if (Pos.y < m_PlayerPos.y)
			m_Jump = 0;
	}
	
	// unstuck move
	if (abs(Pos.x - m_LastPos.x) < 14 && Player()->GetCharacter()->IsGrounded())
	{
		if (frandom() * 10 < 3)
			m_Move = -1;
		if (frandom() * 10 < 3)
			m_Move = 1;
		if (frandom() * 10 < 2)
			m_Jump = 1;
	}
	
	/*
	// forget target after a while
	if (m_TargetTimer > 0)
	{
		MoveTowardsTarget();
		
		if (m_TargetTimer > 20)
		{
			m_TargetTimer = 0;
			m_Move = 0;
			m_Jump = 0;
			m_Attack = 0;
			m_ReactionTime = 60 + frandom()*3;
			
			Player()->GetCharacter()->SetEmoteFor(EMOTE_HAPPY, 1200);
			GameServer()->SendEmoticon(Player()->GetCID(), EMOTICON_ZZZ);
			return;
		}
	}
	*/
	
	
	// head to moving direction
	if (m_Move != 0)
		m_Direction = vec2(m_Move, 0);
	

	// next reaction in
	m_ReactionTime = 6 + frandom()*3;
	
}
void DlgEditMusic::SetCurrentPos(QTime Pos) {
    SeekPlayer(QTime(0,0,0,0).msecsTo(Pos));
}
void DlgEditMusic::s_SeekRight() {
    SeekPlayer(QTime(0,0,0,0).msecsTo(MusicObject->EndPos));
    SetPlayerToPause();
}
void DlgEditMusic::s_SeekLeft() {
    SeekPlayer(QTime(0,0,0,0).msecsTo(MusicObject->StartPos));
    SetPlayerToPause();
}