Ejemplo n.º 1
0
void CWeaponProjectile::Collision(CUnit* unit)
{
	if (/* !weaponDef->noExplode || gs->frameNum & 1 */ true) {
		// don't do damage only on odd-numbered frames
		// for noExplode projectiles (it breaks coldet)
		float3 impactDir = speed;
		impactDir.Normalize();

		// Dynamic Damage
		DamageArray damages;
		if (weaponDef->dynDamageExp > 0) {
			damages = weaponDefHandler->DynamicDamages(weaponDef->damages,
					startpos, pos,
					weaponDef->dynDamageRange > 0?
						weaponDef->dynDamageRange:
						weaponDef->range,
					weaponDef->dynDamageExp, weaponDef->dynDamageMin,
					weaponDef->dynDamageInverted);
		} else {
			damages = weaponDef->damages;
		}

		helper->Explosion(pos, damages,
			weaponDef->areaOfEffect, weaponDef->edgeEffectiveness,
			weaponDef->explosionSpeed, owner(), true,
			weaponDef->noExplode ? 0.3f : 1,
			weaponDef->noExplode, weaponDef->impactOnly,
			weaponDef->explosionGenerator, unit,
			impactDir, weaponDef->id);
	}

	if (weaponDef->soundhit.getID(0) > 0) {
		Channels::Battle.PlaySample(weaponDef->soundhit.getID(0), this,
				weaponDef->soundhit.getVolume(0));
	}

	if(!weaponDef->noExplode)
		CProjectile::Collision(unit);
	else {
		if (TraveledRange())
			CProjectile::Collision();
	}
}
void CWeaponProjectile::Collision(CUnit* unit)
{
	if(!weaponDef->noExplode || gs->frameNum&1)
	{
		float3 impactDir = speed;
		impactDir.Normalize();
		helper->Explosion(pos,weaponDef->damages,weaponDef->areaOfEffect,weaponDef->edgeEffectiveness,weaponDef->explosionSpeed,owner,true,weaponDef->noExplode? 0.3f:1,weaponDef->noExplode,weaponDef->explosionGenerator,unit,impactDir);
	}

	if(weaponDef->soundhit.id)
		sound->PlaySample(weaponDef->soundhit.id,this,weaponDef->soundhit.volume);

	if(!weaponDef->noExplode)
		CProjectile::Collision(unit);
	else
	{
		if(TraveledRange())
			CProjectile::Collision();
	}
}
void CFireBallProjectile::Update()
{
	if (checkCol) {
		pos += speed;

		if (weaponDef->gravityAffected)
			speed.y += mapInfo->map.gravity;

		// g�ra om till ttl sedan kanske
		if (weaponDef->noExplode) {
			if (TraveledRange())
				checkCol = false;
		}

		EmitSpark();
	}
	else {
		if (sparks.size() == 0)
			deleteMe = true;
	}

	for (unsigned int i = 0; i < sparks.size(); i++) {
		sparks[i].ttl--;
		if (sparks[i].ttl == 0) {
			sparks.pop_back();
			break;
		}
		if (checkCol)
			sparks[i].pos += sparks[i].speed;
		sparks[i].speed *= 0.95f;
	}

	if (cegTag.size() > 0) {
		ceg.Explosion(pos, ttl, (sparks.size() > 0)? sparks[0].size: 0.0f, 0x0, 0.0f, 0x0, speed);
	}

	UpdateGroundBounce();
}
Ejemplo n.º 4
0
void CFireBallProjectile::Update()
{
	if (checkCol) {
		if (!luaMoveCtrl) {
			pos += speed;

			if (weaponDef->gravityAffected) {
				speed.y += mygravity;
			}
		}

		if (weaponDef->noExplode && TraveledRange()) {
			checkCol = false;
		}

		EmitSpark();
	} else {
		if (sparks.empty()) {
			deleteMe = true;
		}
	}

	for (unsigned int i = 0; i < sparks.size(); i++) {
		sparks[i].ttl--;
		if (sparks[i].ttl == 0) {
			sparks.pop_back();
			break;
		}
		if (checkCol) {
			sparks[i].pos += sparks[i].speed;
		}
		sparks[i].speed *= 0.95f;
	}

	gCEG->Explosion(cegID, pos, ttl, !sparks.empty() ? sparks[0].size : 0.0f, NULL, 0.0f, NULL, speed);
	UpdateGroundBounce();
	UpdateInterception();
}
Ejemplo n.º 5
0
void CExplosiveProjectile::Update()
{
	CProjectile::Update();

	if (--ttl == 0) {
		Collision();
	} else {
		if (ttl > 0) {
			explGenHandler->GenExplosion(cegID, pos, speed, ttl, damages->damageAreaOfEffect, 0.0f, NULL, NULL);
		}
	}

	curTime += invttl;
	curTime = std::min(curTime, 1.0f);

	if (weaponDef->noExplode && TraveledRange()) {
		CProjectile::Collision();
		return;
	}

	UpdateGroundBounce();
	UpdateInterception();
}
void CFireBallProjectile::Update()
{
	if(checkCol)
	{
		pos+=speed;

		if(weaponDef->gravityAffected)
			speed.y+=gs->gravity;

		//göra om till ttl sedan kanske
		if(weaponDef->noExplode)
		{
			if(TraveledRange())
				checkCol=false;
		}

		EmitSpark();
	}
	else
	{
		if(sparks.size()==0)
			deleteMe = true;
	}

	for(unsigned int i=0; i<sparks.size(); i++)
	{
		sparks[i].ttl--;
		if(sparks[i].ttl==0){
			sparks.pop_back();
			break;
		}
		if(checkCol)
			sparks[i].pos += sparks[i].speed;
		sparks[i].speed *= 0.95f;
	}
}