//-----------------------------------------------------------------------------
float CMultiPoisonProjectile::Render(LPDIRECT3DDEVICE7 m_pd3dDevice)
{
 

	for (UINT i = 0 ; i < uiNumber ; i++)
	{
		float fa = pTab[i]->Render(m_pd3dDevice);

		CPoisonProjectile * pPoisonProjectile = (CPoisonProjectile *) pTab[i];

		if (pPoisonProjectile->lLightId != -1)
		{
			long id					= pPoisonProjectile->lLightId;
			DynLight[id].exist		= 1;
			DynLight[id].intensity	= 2.3f * fa;
			DynLight[id].fallend	= 250.f;
			DynLight[id].fallstart	= 150.f;
			DynLight[id].rgb.r		= 0.f;
			DynLight[id].rgb.g		= 1.0f;
			DynLight[id].rgb.b		= 0.f;
			DynLight[id].pos.x		= pPoisonProjectile->eCurPos.x;
			DynLight[id].pos.y		= pPoisonProjectile->eCurPos.y;
			DynLight[id].pos.z		= pPoisonProjectile->eCurPos.z;
			DynLight[id].time_creation = ARXTimeUL();
			DynLight[id].duration	= 200;
		}

		long t = ARX_DAMAGES_GetFree();
		AddPoisonFog(&pPoisonProjectile->eCurPos, spells[spellinstance].caster_level + 7);

		if ((t != -1)
		        &&	(spells[pTab[i]->spellinstance].timcreation + 1600 < ARXTimeUL()))
		{
			damages[t].pos.x  = pPoisonProjectile->eCurPos.x;
			damages[t].pos.y  = pPoisonProjectile->eCurPos.y;
			damages[t].pos.z  = pPoisonProjectile->eCurPos.z;
			damages[t].radius = 120.f;
			float v = spells[spellinstance].caster_level;
			v = 4.f + v * DIV10 * 6.f ;
			damages[t].damages	= v * DIV1000 * _framedelay;
			damages[t].area		= DAMAGE_FULL;
			damages[t].duration	= ARX_CLEAN_WARN_CAST_LONG(FrameDiff);
			damages[t].source	= spells[spellinstance].caster;
			damages[t].flags	= 0;
			damages[t].type		= DAMAGE_TYPE_MAGICAL | DAMAGE_TYPE_POISON;
			damages[t].exist	= TRUE;
		}
	}

	return 1;
}
Exemplo n.º 2
0
void CMultiMagicMissile::CheckCollision()
{
	if(!pTab)
		return;

		for(unsigned int i = 0; i < uiNumber; i++) {
			if(pTab[i]) {
				CMagicMissile * pMM = (CMagicMissile *) pTab[i];

				if(!pMM->bExplo) {
					
					EERIE_SPHERE sphere;
					sphere.origin = pMM->eCurPos;
					sphere.radius	= 10.f;

					if(spellinstance != -1 && (CheckAnythingInSphere(&sphere, spells[spellinstance].caster, CAS_NO_SAME_GROUP)))
					{
						LaunchMagicMissileExplosion(pMM->eCurPos, 0, spellinstance);
						ARX_NPC_SpawnAudibleSound(&pMM->eCurPos, entities[spells[spellinstance].caster]);

						pMM->SetTTL(1000);
						pMM->bExplo = true;
						pMM->bMove  = false;

						if(pMM->lLightId != -1)
							pMM->lLightId = -1;

						long ttt = ARX_DAMAGES_GetFree();

						if(ttt != -1) {
							damages[ttt].pos = pMM->eCurPos;
							damages[ttt].radius	= 80.f;
							damages[ttt].damages = (4 + spells[spellinstance].caster_level * ( 1.0f / 5 )) * .8f; 
							damages[ttt].area	= DAMAGE_FULL;
							damages[ttt].duration = -1;
							damages[ttt].source	= spells[spellinstance].caster;
							damages[ttt].flags	= DAMAGE_FLAG_DONT_HURT_SOURCE;
							damages[ttt].type	= DAMAGE_TYPE_MAGICAL;
							damages[ttt].exist	= true;
						}

						Color3f rgb(.3f, .3f, .45f);
						ARX_PARTICLES_Add_Smoke(&pMM->eCurPos, 0, 6, &rgb);
					}
				}
			}
		}
}
Exemplo n.º 3
0
//-----------------------------------------------------------------------------
float CMultiPoisonProjectile::Render()
{
 

	for (unsigned int i = 0 ; i < uiNumber ; i++)
	{
		float fa = pTab[i]->Render();

		CPoisonProjectile * pPoisonProjectile = (CPoisonProjectile *) pTab[i];

		if (pPoisonProjectile->lLightId != -1)
		{
			long id					= pPoisonProjectile->lLightId;
			DynLight[id].exist		= 1;
			DynLight[id].intensity	= 2.3f * fa;
			DynLight[id].fallend	= 250.f;
			DynLight[id].fallstart	= 150.f;
			DynLight[id].rgb = Color3f::green;
			DynLight[id].pos = pPoisonProjectile->eCurPos;
			DynLight[id].time_creation = (unsigned long)(arxtime);
			DynLight[id].duration	= 200;
		}

		long t = ARX_DAMAGES_GetFree();
		AddPoisonFog(&pPoisonProjectile->eCurPos, spells[spellinstance].caster_level + 7);

		if ((t != -1)
		        &&	(spells[pTab[i]->spellinstance].timcreation + 1600 < (unsigned long)(arxtime)))
		{
			damages[t].pos = pPoisonProjectile->eCurPos;
			damages[t].radius = 120.f;
			float v = spells[spellinstance].caster_level;
			v = 4.f + v * ( 1.0f / 10 ) * 6.f ;
			damages[t].damages	= v * ( 1.0f / 1000 ) * framedelay;
			damages[t].area		= DAMAGE_FULL;
			damages[t].duration	= static_cast<long>(FrameDiff);
			damages[t].source	= spells[spellinstance].caster;
			damages[t].flags	= 0;
			damages[t].type		= DAMAGE_TYPE_MAGICAL | DAMAGE_TYPE_POISON;
			damages[t].exist	= true;
		}
	}

	return 1;
}
Exemplo n.º 4
0
//-----------------------------------------------------------------------------
void CIceProjectile::Create(Vec3f aeSrc, float afBeta)
{
	SetDuration(ulDuration);
	SetAngle(afBeta);

	fSize = 1;

	float xmin, ymin, zmin;

	Vec3f s, e, h;

	s.x					= aeSrc.x;
	s.y					= aeSrc.y - 100;
	s.z					= aeSrc.z;
	float fspelldist	= static_cast<float>(iMax * 15);

	fspelldist = min(fspelldist, 200.0f);
	fspelldist = max(fspelldist, 450.0f);
	e.x = aeSrc.x - fBetaRadSin * fspelldist;
	e.y = aeSrc.y - 100;
	e.z = aeSrc.z + fBetaRadCos * fspelldist;

	float fd;

	if (!Visible(&s, &e, NULL, &h))
	{
		e.x = h.x + fBetaRadSin * 20;
		e.y = h.y;
		e.z = h.z - fBetaRadCos * 20;
	}

	fd = fdist(s, e);

	float fCalc = ulDuration * (fd / fspelldist);
	SetDuration(checked_range_cast<unsigned long>(fCalc));

	float fDist = (fd / fspelldist) * iMax ;

	iNumber = checked_range_cast<int>(fDist);

	int end = iNumber / 2;
	tv1a[0].p = s + Vec3f(0.f, 100.f, 0.f);
	tv1a[end].p = e + Vec3f(0.f, 100.f, 0.f);

	Split(tv1a, 0, end, 80, 0.5f, 0, 1, 80, 0.5f);

	for (int i = 0; i < iNumber; i++)
	{
		float t = rnd();

		if (t < 0.5f)
			tType[i] = 0;
		else
			tType[i] = 1;

		tSize[i] = Vec3f::ZERO;
		tSizeMax[i] = randomVec() + Vec3f(0.f, 0.2f, 0.f);

		if (tType[i] == 0)
		{
			xmin = 1.2f;
			ymin = 1;
			zmin = 1.2f;
		}
		else
		{
			xmin = 0.4f;
			ymin = 0.3f;
			zmin = 0.4f;
		}

		if (tSizeMax[i].x < xmin)
			tSizeMax[i].x = xmin;

		if (tSizeMax[i].y < ymin)
			tSizeMax[i].y = ymin;

		if (tSizeMax[i].z < zmin)
			tSizeMax[i].z = zmin;

		int iNum = static_cast<int>(i / 2);

		if (tType[i] == 0)
		{
			tPos[i].x = tv1a[iNum].p.x + frand2() * 80;
			tPos[i].y = tv1a[iNum].p.y;
			tPos[i].z = tv1a[iNum].p.z + frand2() * 80;
		}
		else
		{
			tPos[i].x = tv1a[iNum].p.x + frand2() * 40;
			tPos[i].y = tv1a[iNum].p.y;
			tPos[i].z = tv1a[iNum].p.z + frand2() * 40;
		}

		long ttt = ARX_DAMAGES_GetFree();
		if(ttt != -1) {
			damages[ttt].pos = tPos[i];
			damages[ttt].radius = 60.f;
			damages[ttt].damages = 0.1f * spells[spellinstance].caster_level;
			damages[ttt].area = DAMAGE_FULL;
			damages[ttt].duration = ulDuration;
			damages[ttt].source = spells[spellinstance].caster;
			damages[ttt].flags = DAMAGE_FLAG_DONT_HURT_SOURCE;
			damages[ttt].type = DAMAGE_TYPE_MAGICAL | DAMAGE_TYPE_COLD;
			damages[ttt].exist = true;
		}
	}

	fColor = 1;
}
Exemplo n.º 5
0
//-----------------------------------------------------------------------------
void CMultiMagicMissile::CheckCollision(float _fPlayer_Magic_Level)
{
	if (pTab)
	{
		for (UINT i = 0 ; i < uiNumber ; i++)
		{
			if (pTab[i])
			{
				CMagicMissile * pMM = (CMagicMissile *) pTab[i];

				if (pMM->bExplo == false)
				{
					EERIE_SPHERE sphere;
					sphere.origin.x = pMM->eCurPos.x;
					sphere.origin.y = pMM->eCurPos.y;
					sphere.origin.z = pMM->eCurPos.z;
					sphere.radius	= 10.f;

					if ((spellinstance != -1) && (CheckAnythingInSphere(&sphere, spells[spellinstance].caster, CAS_NO_SAME_GROUP)))
					{
 

						EERIE_3D eE3D;
						eE3D.x = pMM->eCurPos.x;
						eE3D.y = pMM->eCurPos.y;
						eE3D.z = pMM->eCurPos.z;
						LaunchMagicMissileExplosion(pMM->eCurPos, 0, spellinstance);
						ARX_NPC_SpawnAudibleSound(&pMM->eCurPos, inter.iobj[spells[spellinstance].caster]);

						pMM->SetTTL(1000);
						pMM->bExplo = true;
						pMM->bMove  = false;

						if (pMM->lLightId != -1)
						{
							pMM->lLightId = -1;
						}

						long ttt = ARX_DAMAGES_GetFree();

						if (ttt != -1)
						{
							damages[ttt].pos.x	= pMM->eCurPos.x;
							damages[ttt].pos.y	= pMM->eCurPos.y;
							damages[ttt].pos.z	= pMM->eCurPos.z;
							damages[ttt].radius	= 80.f;
							damages[ttt].damages = (4 + spells[spellinstance].caster_level * DIV5) * .8f; 
							damages[ttt].area	= DAMAGE_FULL;
							damages[ttt].duration = -1;
							damages[ttt].source	= spells[spellinstance].caster;
							damages[ttt].flags	= DAMAGE_FLAG_DONT_HURT_SOURCE;
							damages[ttt].type	= DAMAGE_TYPE_MAGICAL;
							damages[ttt].exist	= TRUE;
						}

						EERIE_RGB rgb;
						rgb.r = 0.3f;
						rgb.g = 0.3f;
						rgb.b = 0.45f;
						ARX_PARTICLES_Add_Smoke(&pMM->eCurPos, 0, 6, &rgb);
					}
				}
			}
		}
	}
}