Пример #1
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);
					}
				}
			}
		}
}
Пример #2
0
void CMultiMagicMissile::CheckCollision(float level, EntityHandle caster)
{
	for(size_t i = 0; i < pTab.size(); i++) {
		CMagicMissile * missile = (CMagicMissile *) pTab[i];
		
		if(missile->bExplo)
			continue;
			
		Sphere sphere;
		sphere.origin = missile->eCurPos;
		sphere.radius	= 10.f;
		
		if(CheckAnythingInSphere(sphere, caster, CAS_NO_SAME_GROUP))
		{
			LaunchMagicMissileExplosion(missile->eCurPos, m_mrCheat);
			ARX_NPC_SpawnAudibleSound(missile->eCurPos, entities[caster]);
			
			missile->SetTTL(1000);
			missile->bExplo = true;
			missile->bMove  = false;
			
			missile->lLightId = LightHandle::Invalid;
			
			DamageParameters damage;
			damage.pos = missile->eCurPos;
			damage.radius = 80.f;
			damage.damages = (4 + level * ( 1.0f / 5 )) * .8f;
			damage.area	= DAMAGE_FULL;
			damage.duration = -1;
			damage.source = caster;
			damage.flags = DAMAGE_FLAG_DONT_HURT_SOURCE;
			damage.type = DAMAGE_TYPE_MAGICAL;
			DamageCreate(damage);
			
			Color3f rgb(.3f, .3f, .45f);
			ARX_PARTICLES_Add_Smoke(&missile->eCurPos, 0, 6, &rgb);
		}
	}
}
Пример #3
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);
					}
				}
			}
		}
	}
}
Пример #4
0
void MagicMissileSpell::Update() {
	
	
	for(size_t i = 0; i < pTab.size(); i++) {
		CMagicMissile * missile = pTab[i];
		
		if(missile->bExplo)
			continue;
			
		Sphere sphere = Sphere(missile->eCurPos, 10.f);
		
		if(CheckAnythingInSphere(sphere, m_caster, CAS_NO_SAME_GROUP)) {
			
			LaunchMagicMissileExplosion(missile->eCurPos, m_mrCheat);
			ARX_NPC_SpawnAudibleSound(missile->eCurPos, entities[m_caster]);
			
			missile->SetTTL(ArxDurationMs(1000));
			missile->bExplo = true;
			missile->bMove  = false;
			
			missile->lLightId = LightHandle();
			
			DamageParameters damage;
			damage.pos = missile->eCurPos;
			damage.radius = 80.f;
			damage.damages = (4 + m_level * ( 1.0f / 5 )) * .8f;
			damage.area	= DAMAGE_FULL;
			damage.duration = ArxDuration(-1);
			damage.source = m_caster;
			damage.flags = DAMAGE_FLAG_DONT_HURT_SOURCE;
			damage.type = DAMAGE_TYPE_MAGICAL;
			DamageCreate(damage);
			
			Color3f rgb(.3f, .3f, .45f);
			ARX_PARTICLES_Add_Smoke(missile->eCurPos, 0, 6, rgb);
		}
	}
	
	for(size_t i = 0 ; i < pTab.size() ; i++) {
		pTab[i]->Update(ArxDurationMs(g_framedelay));
	}
	
	{ // CheckAllDestroyed
		long nbmissiles	= 0;
		
		for(size_t i = 0; i < pTab.size(); i++) {
			CMagicMissile *pMM = pTab[i];
			if(pMM->bMove)
				nbmissiles++;
		}
		
		if(nbmissiles == 0)
			m_duration = ArxDuration_ZERO;
	}
	
	for(size_t i = 0; i < pTab.size(); i++) {
		pTab[i]->Render();
		
		CMagicMissile * pMM = pTab[i];
		
		EERIE_LIGHT * el = lightHandleGet(pMM->lLightId);
		if(el) {
			el->intensity		= 0.7f + 2.3f * pMM->lightIntensityFactor;
			el->pos = pMM->eCurPos;
			el->creationTime	= arxtime.now();
		}
	}
}