Esempio n. 1
0
void Projectile::Clone(Projectile *pClone)
{
	PhysicalObject::Clone(pClone);

	SetCreator(pClone->GetCreator());
	SetWeapon(pClone->GetWeapon());
}
Esempio n. 2
0
bool CCharacter::TakeWeapon(int Weapon)
{
    int NumWeps = 0;
    for(int i = 0; i < NUM_WEAPONS; i++)
        if (m_aWeapons[i].m_Got)
            NumWeps++;

    if (Weapon < 0 || Weapon >= NUM_WEAPONS || NumWeps <= 1 || !m_aWeapons[Weapon].m_Got)
        return false;

    m_aWeapons[Weapon].m_Got = false;

    if (m_ActiveWeapon == Weapon)
    {
        int NewWeap = 0;
        if (m_LastWeapon != -1 && m_LastWeapon != Weapon && m_aWeapons[m_LastWeapon].m_Got)
            NewWeap = m_LastWeapon;
        else
            for(; NewWeap < NUM_WEAPONS && !m_aWeapons[NewWeap].m_Got; NewWeap++);

        SetWeapon(NewWeap);
    }

    if (m_LastWeapon != -1 && !m_aWeapons[m_LastWeapon].m_Got)
        m_LastWeapon = m_ActiveWeapon;

    if (m_QueuedWeapon != -1 && !m_aWeapons[m_QueuedWeapon].m_Got)
        m_QueuedWeapon = -1;

    return true;
}
Esempio n. 3
0
void CBoss3::SetTarget(float x, float y)
{
	_target.x = x;
	_target.y = y;
	SetWeapon(CResourcesManager::GetInstance()->_weapon_enemy);
	Attacking();
}
Esempio n. 4
0
void CCharacter::DoWeaponSwitch()
{
	// make sure we can switch
	if(m_ReloadTimer != 0 || m_QueuedWeapon == -1 || m_aWeapons[WEAPON_NINJA].m_Got)
		return;

	// switch Weapon
	SetWeapon(m_QueuedWeapon);
}
Esempio n. 5
0
void CCharacter::DoWeaponSwitch()
{
	// make sure we can switch
	if(m_ReloadTimer != 0 || m_QueuedWeapon == -1)
		return;
	if(m_aWeapons[WEAPON_NINJA].m_Got && (g_Config.m_SvInsta == 0 || g_Config.m_SvInsta == 32))
		return;

	// switch Weapon
	SetWeapon(m_QueuedWeapon);
}
Esempio n. 6
0
Radiant::Radiant(int lvl)
{
	//m_hImage = SGD::GraphicsManager::GetInstance()->LoadTexture("resources/graphics/radiant.png");
	m_szSize = {  64, 64 };
	level = lvl;
	rateOfAttack = (100 - dexterity) * 0.01f;
	attackTimer = rateOfAttack;
	SetStats();
	charAnim.SetCurrAnimation("Rad_Idle");

	SetWeapon(new Pistol(Pistol::PistolType::spittle));	
	weapon->Release();
}
/* Weapon Handling **/
void UAREquipmentComponent::SwapWeapon(int32 Hand)
{
	if (GetOwnerRole() < ROLE_Authority)
	{
		ServerSwapWeapon(Hand);
	}
	else
	{
		if (Hand == 0)
		{
			for (FARDragDropInfo& weapon : LeftHandWeapons)
			{
				if (!weapon.ItemKey.IsNone() && weapon.ItemKey != ActiveLeftHandWeaponStruct.ItemKey)
				{
					weapon.IsAttached = false;

					ActiveLeftHandWeaponStruct = weapon;

					SetWeapon(ActiveLeftHandWeaponStruct, ActiveLeftHandWeapon, Hand);
					return;
				}
			}
		}
		else if (Hand == 1)
		{
			for (FARDragDropInfo& weapon : RightHandWeapons)
			{
				if (!weapon.ItemKey.IsNone() && weapon.ItemKey != ActiveRightHandWeaponStruct.ItemKey)
				{
					ActiveRightHandWeaponStruct = weapon;
					SetWeapon(ActiveRightHandWeaponStruct, ActiveRightHandWeapon, Hand);
					return;
				}
			}
		}
	}
}
Esempio n. 8
0
void CBotInfoView::Clear()
{
	SetAIInfo( _T("") );
	SetAttackDist( _T("") );
	SetAttackName( _T("") );
	SetAttackPos( _T("") );
	SetBotPos( _T("") );
	SetFrags( _T("") );
	SetHealth( _T("") );
	SetMoveDist( _T("") );
	SetMoveName( _T("") );
	SetMovePos( _T("") );
	SetVelocity( _T("") );
	SetWeapon( _T("") );
}
void CRunmanFire::SetTargetAttack(float x, float y)
{
	if (_physical.n == 0) return; //Đang lơ lững thì k bắn

	float distance_x = _physical.x > x ? _physical.x - x : x - _physical.x;
	float distance_y = _physical.y > y ? _physical.y - y : y - _physical.y;

	if (distance_y <= ENEMY_RUN_MAN_FIRE_ATTACK_DISTANCE &&
		distance_x <= ENEMY_RUN_MAN_FIRE_ATTACK_DISTANCE + 30 &&
		_count_bullet < ENEMY_RUN_MAN_FIRE_MAX_BULLET &&
		_rm_status == RMRun)
	{
		SetWeapon(CResourcesManager::GetInstance()->_weapon_enemy);
		Attacking();
	}
}
Esempio n. 10
0
	void tcWeaponInterface::DeletePlatform()
	{
        if (weapon == 0) return;

		if (!weapon->IsEditMode()) return;

        tcScenarioRandomizer* randomizer = tcScenarioRandomizer::Get();
        randomizer->DeleteUnit(weapon->mzUnit.c_str());

        tcSimState* simState = tcSimState::Get();
		simState->DeleteObject(weapon->mnID);

        SetWeapon(0);

        tcSimPythonInterface::Get()->SetMenuPlatform(-1);
	}
Esempio n. 11
0
void CCharacter::HandleNinja()
{
	if(m_ActiveWeapon != WEAPON_NINJA)
		return;

	if ((Server()->Tick() - m_Ninja.m_ActivationTick) > (g_pData->m_Weapons.m_Ninja.m_Duration * Server()->TickSpeed() / 1000))
	{
		// time's up, return
		m_aWeapons[WEAPON_NINJA].m_Got = false;
		m_ActiveWeapon = m_LastWeapon;

		SetWeapon(m_ActiveWeapon);
		return;
	}

	// force ninja Weapon
	SetWeapon(WEAPON_NINJA);

	m_Ninja.m_CurrentMoveTime--;

	if (m_Ninja.m_CurrentMoveTime == 0)
	{
		// reset velocity
		m_Core.m_Vel = m_Ninja.m_ActivationDir*m_Ninja.m_OldVelAmount;
	}

	if (m_Ninja.m_CurrentMoveTime > 0)
	{
		// Set velocity
		m_Core.m_Vel = m_Ninja.m_ActivationDir * g_pData->m_Weapons.m_Ninja.m_Velocity;
		vec2 OldPos = m_Pos;
		GameServer()->Collision()->MoveBox(&m_Core.m_Pos, &m_Core.m_Vel, vec2(m_ProximityRadius, m_ProximityRadius), 0.f);

		// reset velocity so the client doesn't predict stuff
		m_Core.m_Vel = vec2(0.f, 0.f);

		// check if we Hit anything along the way
		{
			CCharacter *aEnts[MAX_CLIENTS];
			vec2 Dir = m_Pos - OldPos;
			float Radius = m_ProximityRadius * 2.0f;
			vec2 Center = OldPos + Dir * 0.5f;
			int Num = GameServer()->m_World.FindEntities(Center, Radius, (CEntity**)aEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER);

			for (int i = 0; i < Num; ++i)
			{
				if (aEnts[i] == this)
					continue;

				// make sure we haven't Hit this object before
				bool bAlreadyHit = false;
				for (int j = 0; j < m_NumObjectsHit; j++)
				{
					if (m_apHitObjects[j] == aEnts[i])
						bAlreadyHit = true;
				}
				if (bAlreadyHit)
					continue;

				// check so we are sufficiently close
				if (distance(aEnts[i]->m_Pos, m_Pos) > (m_ProximityRadius * 2.0f))
					continue;

				// Hit a player, give him damage and stuffs...
				GameServer()->CreateSound(aEnts[i]->m_Pos, SOUND_NINJA_HIT);
				// set his velocity to fast upward (for now)
				if(m_NumObjectsHit < 10)
					m_apHitObjects[m_NumObjectsHit++] = aEnts[i];

				aEnts[i]->TakeDamage(vec2(0, -10.0f), g_pData->m_Weapons.m_Ninja.m_pBase->m_Damage, m_pPlayer->GetCID(), WEAPON_NINJA);
			}
		}

		return;
	}

	return;
}
Esempio n. 12
0
Projectile::~Projectile()
{
	SetCreator(0);
	SetWeapon(0);
}
Esempio n. 13
0
Radiant::~Radiant(void)
{
	SetWeapon(nullptr);
}