Use battle.hasThreats to determine if all enemies have been defeated.
This commit is contained in:
parent
6dcbd265d9
commit
025e72822b
|
@ -67,7 +67,7 @@ void doEntities(void)
|
||||||
|
|
||||||
prev = &battle.entityHead;
|
prev = &battle.entityHead;
|
||||||
|
|
||||||
numAllies = numEnemies = numActiveAllies = numActiveEnemies = numSpawnedEnemies = 0;
|
battle.hasThreats = numAllies = numEnemies = numActiveAllies = numActiveEnemies = numSpawnedEnemies = 0;
|
||||||
|
|
||||||
if (dev.playerImmortal)
|
if (dev.playerImmortal)
|
||||||
{
|
{
|
||||||
|
@ -218,6 +218,11 @@ void doEntities(void)
|
||||||
numSpawnedEnemies++;
|
numSpawnedEnemies++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e->health > 0 && !(e->flags & EF_DISABLED))
|
||||||
|
{
|
||||||
|
battle.hasThreats = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ void updateObjective(char *name, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o->isEliminateAll && o->status != OS_COMPLETE && (battle.stats[STAT_ENEMIES_KILLED] + battle.stats[STAT_CAPITAL_SHIPS_DESTROYED]) == battle.numInitialEnemies)
|
if (o->isEliminateAll && o->status != OS_COMPLETE && !battle.hasThreats)
|
||||||
{
|
{
|
||||||
addHudMessage(colors.green, _("%s - Objective Complete!"), o->description);
|
addHudMessage(colors.green, _("%s - Objective Complete!"), o->description);
|
||||||
|
|
||||||
|
|
|
@ -262,7 +262,7 @@ static void executeNextLine(ScriptRunner *runner)
|
||||||
}
|
}
|
||||||
else if (strcmp(command, "END_CHALLENGE") == 0)
|
else if (strcmp(command, "END_CHALLENGE") == 0)
|
||||||
{
|
{
|
||||||
game.currentMission->challengeData.scriptedEnd = 1;
|
battle.scriptedEnd = 1;
|
||||||
}
|
}
|
||||||
else if (strcmp(command, "RETREAT_ALLIES") == 0)
|
else if (strcmp(command, "RETREAT_ALLIES") == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -89,8 +89,6 @@ void loadChallenge(Mission *mission, cJSON *node)
|
||||||
int i;
|
int i;
|
||||||
Challenge *challenge;
|
Challenge *challenge;
|
||||||
|
|
||||||
memset(&mission->challengeData, 0, sizeof(ChallengeData));
|
|
||||||
|
|
||||||
mission->challengeData.isChallenge = 1;
|
mission->challengeData.isChallenge = 1;
|
||||||
|
|
||||||
/* limits */
|
/* limits */
|
||||||
|
@ -117,6 +115,7 @@ void loadChallenge(Mission *mission, cJSON *node)
|
||||||
/* misc */
|
/* misc */
|
||||||
mission->challengeData.allowPlayerDeath = getJSONValue(node, "allowPlayerDeath", 0);
|
mission->challengeData.allowPlayerDeath = getJSONValue(node, "allowPlayerDeath", 0);
|
||||||
mission->challengeData.clearWaypointEnemies = getJSONValue(node, "clearWaypointEnemies", 0);
|
mission->challengeData.clearWaypointEnemies = getJSONValue(node, "clearWaypointEnemies", 0);
|
||||||
|
mission->challengeData.eliminateThreats = getJSONValue(node, "eliminateThreats", 0);
|
||||||
|
|
||||||
node = cJSON_GetObjectItem(node, "challenges");
|
node = cJSON_GetObjectItem(node, "challenges");
|
||||||
|
|
||||||
|
@ -208,7 +207,12 @@ static int challengeFinished(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (player->health <= 0 || player->alive == ALIVE_ESCAPED || game.currentMission->challengeData.scriptedEnd);
|
if (game.currentMission->challengeData.eliminateThreats && !battle.hasThreats)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (player->health <= 0 || player->alive == ALIVE_ESCAPED || battle.scriptedEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int updateChallenges(void)
|
static int updateChallenges(void)
|
||||||
|
|
|
@ -262,9 +262,9 @@ typedef struct {
|
||||||
int noBoost;
|
int noBoost;
|
||||||
int noECM;
|
int noECM;
|
||||||
int noGuns;
|
int noGuns;
|
||||||
int scriptedEnd;
|
|
||||||
int allowPlayerDeath;
|
int allowPlayerDeath;
|
||||||
int clearWaypointEnemies;
|
int clearWaypointEnemies;
|
||||||
|
int eliminateThreats;
|
||||||
Challenge *challenges[MAX_CHALLENGES];
|
Challenge *challenges[MAX_CHALLENGES];
|
||||||
} ChallengeData;
|
} ChallengeData;
|
||||||
|
|
||||||
|
@ -345,6 +345,8 @@ typedef struct {
|
||||||
int radarRange;
|
int radarRange;
|
||||||
int numPlayerGuns;
|
int numPlayerGuns;
|
||||||
int numObjectivesComplete, numObjectivesTotal, numConditions;
|
int numObjectivesComplete, numObjectivesTotal, numConditions;
|
||||||
|
int scriptedEnd;
|
||||||
|
int hasThreats;
|
||||||
Entity *missionTarget;
|
Entity *missionTarget;
|
||||||
Entity *jumpgate;
|
Entity *jumpgate;
|
||||||
Entity *messageSpeaker;
|
Entity *messageSpeaker;
|
||||||
|
|
Loading…
Reference in New Issue