[Add] Implemented volatility damage.

This commit is contained in:
Allanis 2013-12-21 00:45:14 +00:00
parent c8104d16be
commit 11a96c9b00
5 changed files with 54 additions and 39 deletions

View File

@ -215,7 +215,7 @@
<general> <general>
<bar>The Raglan bar is a pretty small bar for Draktharr standards, and quite empty too.</bar> <bar>The Raglan bar is a pretty small bar for Draktharr standards, and quite empty too.</bar>
<description>Raglan Outpost was established after the Draktharr-Frontier war broke out before the Incident. To this day the Frontier still is demanding for it's dismantling in the halls of the Emperor, although he has yet to make a statement. Meanwhile the Draktharrs use this base intensively in their fight against the DLF.</description> <description>Raglan Outpost was established after the Draktharr-Frontier war broke out before the Incident. To this day the Frontier still is demanding for it's dismantling in the halls of the Emperor, although he has yet to make a statement. Meanwhile the Draktharrs use this base intensively in their fight against the DLF.</description>
<faction>Dvaered</faction> <faction>Draktharr</faction>
<tech> <tech>
<main>7</main> <main>7</main>
<special>0</special> <special>0</special>

View File

@ -116,31 +116,36 @@ Outfit** outfit_getTech(int* n, const int* tech, const int techmax) {
void outfit_calcDamage(double* dshield, double* darmour, double* knockback, void outfit_calcDamage(double* dshield, double* darmour, double* knockback,
DamageType dtype, double dmg) { DamageType dtype, double dmg) {
double ds, da, kn;
switch(dtype) { switch(dtype) {
case DAMAGE_TYPE_ENERGY: case DAMAGE_TYPE_ENERGY:
(*dshield) = dmg*1.1; ds = dmg*1.1;
(*darmour) = dmg*0.7; da = dmg*0.7;
(*knockback) = 0.1; kn = 0.1;
break; break;
case DAMAGE_TYPE_KINETIC: case DAMAGE_TYPE_KINETIC:
(*dshield) = dmg*0.8; ds = dmg*0.8;
(*darmour) = dmg*1.2; da = dmg*1.2;
(*knockback) = 1.; kn = 1.;
break; break;
case DAMAGE_TYPE_ION: case DAMAGE_TYPE_ION:
(*dshield) = 0.; ds = dmg;
(*darmour) = dmg; da = dmg;
(*knockback) = 0.4; kn = 0.4;
break; break;
case DAMAGE_TYPE_RADIATION: case DAMAGE_TYPE_RADIATION:
(*dshield) = 0.15; /* Still take damage, just very little. */ ds = dmg*0.15; /* Still take damage, just very little. */
(*darmour) = dmg; da = dmg;
(*knockback) = 0.8; kn = 0.8;
default: default:
WARN("Unknown damage type: %d!", dtype); WARN("Unknown damage type: %d!", dtype);
(*dshield) = (*darmour) = (*knockback) = 0.; ds = da = kn = 0.;
break; break;
} }
if(dshield) *dshield = ds;
if(darmour) *darmour = da;
if(knockback) *knockback = kn;
} }
/** /**

View File

@ -410,11 +410,12 @@ void pilot_hit(Pilot* p, const Solid* w, const unsigned int shooter,
} }
} }
/* Knock back effect is dependent on both damage and mass of the weapon. */ if(shooter != 0)
/* should probably turn it into a partial conservative collision.. */ /* Knock back effect is dependent on both damage and mass of the weapon. */
vect_cadd(&p->solid->vel, /* should probably turn it into a partial conservative collision.. */
knockback * (w->vel.x * (dam_mod/6. + w->mass/p->solid->mass/6.)), vect_cadd(&p->solid->vel,
knockback * (w->vel.y * (dam_mod/6. + w->mass/p->solid->mass/6.))); knockback * (w->vel.x * (dam_mod/6. + w->mass/p->solid->mass/6.)),
knockback * (w->vel.y * (dam_mod/6. + w->mass/p->solid->mass/6.)));
} }
/** /**

View File

@ -867,9 +867,14 @@ void player_renderGUI(void) {
/* Lockon warning. */ /* Lockon warning. */
if(player->lockons > 0) if(player->lockons > 0)
gl_printMid(NULL, SCREEN_W, 0., SCREEN_H-gl_defFont.h-25., gl_printMid(NULL, SCREEN_W - gui_xoff, 0., SCREEN_H-gl_defFont.h-25.,
&cRed, "LOCKON DETECTED"); &cRed, "LOCKON DETECTED");
/* Volatile Environment. */
if(cur_system->nebu_volatility > 0.)
gl_printMid(NULL, SCREEN_W - gui_xoff, 0., SCREEN_H-gl_defFont.h*2.-35.,
&cRed, "VOLATILE ENVIRONMENT DETECTED");
/* GUI! */ /* GUI! */
/* -- Frame. */ /* -- Frame. */
gl_blitStatic(gui.gfx_frame, gui.frame.x, gui.frame.y, NULL); gl_blitStatic(gui.gfx_frame, gui.frame.x, gui.frame.y, NULL);

View File

@ -382,29 +382,33 @@ void space_update(const double dt) {
if(cur_system == NULL) return; /* Can't update a null system. */ if(cur_system == NULL) return; /* Can't update a null system. */
if(!space_spawn) return; /* Spawning is disabled. */ if(space_spawn) {
spawn_timer -= dt;
spawn_timer -= dt; if(cur_system->nfleets == 0) /* Stop checking if there are no fleets. */
spawn_timer = 300.;
if(cur_system->nfleets == 0) if(spawn_timer < 0.) { /* time to possibly spawn. */
/* Please stop checking that there are no fleets. */ /* Spawn chance is based on overall %. */
spawn_timer = 300.; f = RNG(0, 100*cur_system->nfleets);
j = 0;
if(spawn_timer < 0.) { for(i = 0; i < cur_system->nfleets; i++) {
/* Time to possibly spawn. */ j += cur_system->fleets[i].chance;
if(f < j) { /* Add one fleet. */
/* Spawn chance is based on overall percentage. */ space_addFleet(cur_system->fleets[i].fleet, 0);
f = RNG(0, 100*cur_system->nfleets); break;
j = 0; }
for(i = 0; i < cur_system->nfleets; i++) {
j += cur_system->fleets[i].chance;
if(f < j) {
/* Add one fleet. */
space_addFleet(cur_system->fleets[i].fleet, 0);
break;
} }
spawn_timer = 60./(float)cur_system->nfleets;
} }
spawn_timer = 60./(float)cur_system->nfleets; }
/* Volatile system. */
if(cur_system->nebu_volatility > 0.) {
/* Player takes damage. */
if(player)
pilot_hit(player, NULL, 0, DAMAGE_TYPE_RADIATION,
pow2(cur_system->nebu_volatility) / 500. * dt);
} }
} }