Prevent fighters from magically coming back to life if their target is kill while they are also dying.

This commit is contained in:
Steve 2015-11-01 11:37:12 +00:00
parent 5466bb2ea5
commit 2a38221bcf
3 changed files with 17 additions and 17 deletions

View File

@ -50,6 +50,12 @@ static void flee(void);
void doAI(void) void doAI(void)
{ {
int r; int r;
if (self->target != NULL && self->target->health <= 0)
{
self->action = self->defaultAction;
self->target = NULL;
}
if (!self->target || targetOutOfRange() || self->target->systemPower <= 0) if (!self->target || targetOutOfRange() || self->target->systemPower <= 0)
{ {

View File

@ -55,12 +55,6 @@ void doEntities(void)
e->x += e->dx; e->x += e->dx;
e->y += e->dy; e->y += e->dy;
if (e->target != NULL && e->target->health <= 0)
{
e->action = e->defaultAction;
e->target = NULL;
}
if (e->action != NULL) if (e->action != NULL)
{ {

View File

@ -155,13 +155,13 @@ static void randomizeDartGuns(Entity *dart)
void doFighter(void) void doFighter(void)
{ {
if (self != player && self->health > 0) if (self->alive == ALIVE_ALIVE)
{
separate();
}
if (self->health > 0)
{ {
if (self != player)
{
separate();
}
self->reload = MAX(self->reload - 1, 0); self->reload = MAX(self->reload - 1, 0);
self->shieldRecharge = MAX(self->shieldRecharge - 1, 0); self->shieldRecharge = MAX(self->shieldRecharge - 1, 0);
self->armourHit = MAX(self->armourHit - 25, 0); self->armourHit = MAX(self->armourHit - 25, 0);
@ -183,10 +183,7 @@ void doFighter(void)
{ {
self->action = self->defaultAction; self->action = self->defaultAction;
} }
}
if (self->alive == ALIVE_ALIVE)
{
if (self->health <= 0) if (self->health <= 0)
{ {
self->health = 0; self->health = 0;
@ -239,7 +236,10 @@ void doFighter(void)
{ {
battle.stats[STAT_ALLIES_KILLED]++; battle.stats[STAT_ALLIES_KILLED]++;
addHudMessage(colors.red, "Ally has been killed"); if (!battle.epic)
{
addHudMessage(colors.red, "Ally has been killed");
}
} }
} }