diff --git a/src/battle/ai.c b/src/battle/ai.c index e21cab1..d90f990 100644 --- a/src/battle/ai.c +++ b/src/battle/ai.c @@ -50,6 +50,12 @@ static void flee(void); void doAI(void) { 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) { diff --git a/src/battle/entities.c b/src/battle/entities.c index 59687b2..ae79b0a 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -55,12 +55,6 @@ void doEntities(void) e->x += e->dx; e->y += e->dy; - - if (e->target != NULL && e->target->health <= 0) - { - e->action = e->defaultAction; - e->target = NULL; - } if (e->action != NULL) { diff --git a/src/battle/fighters.c b/src/battle/fighters.c index 3bc117f..3382de9 100644 --- a/src/battle/fighters.c +++ b/src/battle/fighters.c @@ -155,13 +155,13 @@ static void randomizeDartGuns(Entity *dart) void doFighter(void) { - if (self != player && self->health > 0) - { - separate(); - } - - if (self->health > 0) + if (self->alive == ALIVE_ALIVE) { + if (self != player) + { + separate(); + } + self->reload = MAX(self->reload - 1, 0); self->shieldRecharge = MAX(self->shieldRecharge - 1, 0); self->armourHit = MAX(self->armourHit - 25, 0); @@ -183,10 +183,7 @@ void doFighter(void) { self->action = self->defaultAction; } - } - - if (self->alive == ALIVE_ALIVE) - { + if (self->health <= 0) { self->health = 0; @@ -239,7 +236,10 @@ void doFighter(void) { battle.stats[STAT_ALLIES_KILLED]++; - addHudMessage(colors.red, "Ally has been killed"); + if (!battle.epic) + { + addHudMessage(colors.red, "Ally has been killed"); + } } }