[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>
<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>
<faction>Dvaered</faction>
<faction>Draktharr</faction>
<tech>
<main>7</main>
<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,
DamageType dtype, double dmg) {
double ds, da, kn;
switch(dtype) {
case DAMAGE_TYPE_ENERGY:
(*dshield) = dmg*1.1;
(*darmour) = dmg*0.7;
(*knockback) = 0.1;
ds = dmg*1.1;
da = dmg*0.7;
kn = 0.1;
break;
case DAMAGE_TYPE_KINETIC:
(*dshield) = dmg*0.8;
(*darmour) = dmg*1.2;
(*knockback) = 1.;
ds = dmg*0.8;
da = dmg*1.2;
kn = 1.;
break;
case DAMAGE_TYPE_ION:
(*dshield) = 0.;
(*darmour) = dmg;
(*knockback) = 0.4;
ds = dmg;
da = dmg;
kn = 0.4;
break;
case DAMAGE_TYPE_RADIATION:
(*dshield) = 0.15; /* Still take damage, just very little. */
(*darmour) = dmg;
(*knockback) = 0.8;
ds = dmg*0.15; /* Still take damage, just very little. */
da = dmg;
kn = 0.8;
default:
WARN("Unknown damage type: %d!", dtype);
(*dshield) = (*darmour) = (*knockback) = 0.;
ds = da = kn = 0.;
break;
}
if(dshield) *dshield = ds;
if(darmour) *darmour = da;
if(knockback) *knockback = kn;
}
/**

View File

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

View File

@ -867,9 +867,14 @@ void player_renderGUI(void) {
/* Lockon warning. */
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");
/* 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! */
/* -- Frame. */
gl_blitStatic(gui.gfx_frame, gui.frame.x, gui.frame.y, NULL);

View File

@ -382,30 +382,34 @@ void space_update(const double dt) {
if(cur_system == NULL) return; /* Can't update a null system. */
if(!space_spawn) return; /* Spawning is disabled. */
if(space_spawn) {
spawn_timer -= dt;
if(cur_system->nfleets == 0)
/* Please stop checking that there are no fleets. */
if(cur_system->nfleets == 0) /* Stop checking if there are no fleets. */
spawn_timer = 300.;
if(spawn_timer < 0.) {
/* Time to possibly spawn. */
/* Spawn chance is based on overall percentage. */
if(spawn_timer < 0.) { /* time to possibly spawn. */
/* Spawn chance is based on overall %. */
f = RNG(0, 100*cur_system->nfleets);
j = 0;
for(i = 0; i < cur_system->nfleets; i++) {
j += cur_system->fleets[i].chance;
if(f < j) {
/* Add one fleet. */
if(f < j) { /* Add one fleet. */
space_addFleet(cur_system->fleets[i].fleet, 0);
break;
}
}
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);
}
}
/**