Exploded mines will push others aside.

This commit is contained in:
Steve 2016-04-01 17:02:36 +01:00
parent 0985bcd0e9
commit cfc41a624b
1 changed files with 17 additions and 2 deletions

View File

@ -40,6 +40,7 @@ Entity *spawnMine(void)
mine->type = ET_MINE; mine->type = ET_MINE;
mine->health = mine->maxHealth = 1; mine->health = mine->maxHealth = 1;
mine->speed = 1;
mine->systemPower = SYSTEM_POWER; mine->systemPower = SYSTEM_POWER;
mine->texture = mineNormal; mine->texture = mineNormal;
mine->action = think; mine->action = think;
@ -62,6 +63,9 @@ static void think(void)
self->angle -= 360; self->angle -= 360;
} }
self->dx *= 0.99;
self->dy *= 0.99;
lookForFighters(); lookForFighters();
if (self->systemPower < SYSTEM_POWER && battle.stats[STAT_TIME] % 8 < 4) if (self->systemPower < SYSTEM_POWER && battle.stats[STAT_TIME] % 8 < 4)
@ -119,7 +123,7 @@ static void doSplashDamage(void)
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i]) for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
{ {
if (e->health > 0 && e->type == ET_FIGHTER && !(e->flags & EF_IMMORTAL)) if (e->health > 0 && (e->type == ET_FIGHTER || e->type == ET_MINE) && !(e->flags & EF_IMMORTAL))
{ {
dist = getDistance(self->x, self->y, e->x, e->y); dist = getDistance(self->x, self->y, e->x, e->y);
@ -132,8 +136,19 @@ static void doSplashDamage(void)
damage = 100; damage = 100;
damage *= percent; damage *= percent;
if (e->type == ET_FIGHTER)
{
damageFighter(e, damage, 0); damageFighter(e, damage, 0);
} }
else if (e->type == ET_MINE)
{
e->dx = e->x - self->x;
e->dy = e->y - self->y;
e->dx *= 0.01;
e->dy *= 0.01;
}
}
} }
} }
} }