diff --git a/src/battle/battle.c b/src/battle/battle.c index f9c43d7..f98cc67 100644 --- a/src/battle/battle.c +++ b/src/battle/battle.c @@ -52,6 +52,8 @@ void initBattle(void) app.delegate.logic = &logic; app.delegate.draw = &draw; memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS); + + battle.hasThreats = 1; initQuadtree(&battle.quadtree); diff --git a/src/battle/entities.c b/src/battle/entities.c index acd1881..04a4ff4 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -84,7 +84,7 @@ void doEntities(void) e->health = e->maxHealth; e->shield = e->maxShield; } - + if (e->active) { self = e; @@ -217,11 +217,11 @@ void doEntities(void) { numSpawnedEnemies++; } - } - - if (e->health > 0 && !(e->flags & EF_DISABLED)) - { - battle.hasThreats = 1; + + if (!(e->flags & EF_DISABLED)) + { + battle.hasThreats = 1; + } } } } diff --git a/src/battle/objectives.c b/src/battle/objectives.c index 94f8371..b377d87 100644 --- a/src/battle/objectives.c +++ b/src/battle/objectives.c @@ -42,6 +42,17 @@ void doObjectives(void) { battle.numConditions++; } + + if (o->isEliminateAll && o->status != OS_COMPLETE && !battle.hasThreats) + { + addHudMessage(colors.green, _("%s - Objective Complete!"), o->description); + + o->currentValue = o->targetValue; + + o->status = OS_COMPLETE; + + runScriptFunction("OBJECTIVES_COMPLETE %d", battle.numObjectivesComplete + 1); + } } else { @@ -119,17 +130,6 @@ void updateObjective(char *name, int type) runScriptFunction("OBJECTIVES_COMPLETE %d", ++completed); } } - - if (o->isEliminateAll && o->status != OS_COMPLETE && !battle.hasThreats) - { - addHudMessage(colors.green, _("%s - Objective Complete!"), o->description); - - o->currentValue = o->targetValue; - - o->status = OS_COMPLETE; - - runScriptFunction("OBJECTIVES_COMPLETE %d", ++completed); - } } if (!o->active)