Allow for a kill threshold to be specified in epic missions (for use with unwinnable missions).
This commit is contained in:
parent
b8dccb9882
commit
e59af4bfbc
|
@ -364,6 +364,11 @@ void doFighter(void)
|
|||
updateObjective(self->name, TT_DESTROY);
|
||||
updateObjective(self->groupName, TT_DESTROY);
|
||||
|
||||
if (battle.isEpic && self->killedBy == player)
|
||||
{
|
||||
updateObjective("EPIC_PLAYER_KILLS", TT_DESTROY);
|
||||
}
|
||||
|
||||
adjustObjectiveTargetValue(self->name, TT_ESCAPED, -1);
|
||||
|
||||
updateCondition(self->name, TT_DESTROY);
|
||||
|
|
|
@ -346,3 +346,23 @@ void addEpicLivesObjective(void)
|
|||
o->active = 1;
|
||||
o->isCondition = 1;
|
||||
}
|
||||
|
||||
void addEpicKillsObjective(void)
|
||||
{
|
||||
Objective *o;
|
||||
char id[MAX_DESCRIPTION_LENGTH];
|
||||
|
||||
o = malloc(sizeof(Objective));
|
||||
memset(o, 0, sizeof(Objective));
|
||||
battle.objectiveTail->next = o;
|
||||
battle.objectiveTail = o;
|
||||
|
||||
sprintf(id, _("Destroy at least %d enemy fighters"), battle.epicKills);
|
||||
|
||||
STRNCPY(o->id, id, MAX_DESCRIPTION_LENGTH);
|
||||
STRNCPY(o->description, id, MAX_DESCRIPTION_LENGTH);
|
||||
STRNCPY(o->targetName, "EPIC_PLAYER_KILLS", MAX_NAME_LENGTH);
|
||||
o->targetValue = battle.epicKills;
|
||||
o->targetType = TT_DESTROY;
|
||||
o->active = 1;
|
||||
}
|
||||
|
|
|
@ -432,7 +432,7 @@ static void preFireMissile(void)
|
|||
}
|
||||
}
|
||||
|
||||
void initPlayerSelect(void)
|
||||
static void initPlayerSelect(void)
|
||||
{
|
||||
Entity *e;
|
||||
|
||||
|
@ -440,7 +440,7 @@ void initPlayerSelect(void)
|
|||
|
||||
selectedPlayerIndex = 0;
|
||||
|
||||
if (battle.epicLives > 0 && --battle.epicLives > 0)
|
||||
if (battle.epicLives == 0 || (battle.epicLives > 0 && --battle.epicLives > 0))
|
||||
{
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
{
|
||||
|
@ -461,6 +461,11 @@ void initPlayerSelect(void)
|
|||
{
|
||||
battle.isEpic = 0;
|
||||
|
||||
if (battle.epicKills > 0 && battle.stats[STAT_ENEMIES_KILLED_PLAYER] < battle.epicKills)
|
||||
{
|
||||
battle.unwinnable = 0;
|
||||
}
|
||||
|
||||
failMission();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -421,12 +421,18 @@ static void loadEpicData(cJSON *node)
|
|||
battle.epicFighterLimit = cJSON_GetObjectItem(node, "fighterLimit")->valueint;
|
||||
battle.unlimitedEnemies = getJSONValue(node, "unlimitedEnemies", 0);
|
||||
battle.epicLives = getJSONValue(node, "lives", 0);
|
||||
battle.epicKills = getJSONValue(node, "kills", 0);
|
||||
|
||||
if (battle.epicLives > 0)
|
||||
{
|
||||
addEpicLivesObjective();
|
||||
}
|
||||
|
||||
if (battle.epicKills != 0)
|
||||
{
|
||||
addEpicKillsObjective();
|
||||
}
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
{
|
||||
if (e->active && e->type == ET_FIGHTER && numFighters[e->side]++ >= battle.epicFighterLimit)
|
||||
|
|
|
@ -65,6 +65,7 @@ extern void awardPostMissionTrophies(void);
|
|||
extern void awardCraftTrophy(void);
|
||||
extern void setInitialPlayerAngle(void);
|
||||
extern void addEpicLivesObjective(void);
|
||||
extern void addEpicKillsObjective(void);
|
||||
|
||||
extern Battle battle;
|
||||
extern Dev dev;
|
||||
|
|
|
@ -345,6 +345,7 @@ typedef struct {
|
|||
int unlimitedEnemies;
|
||||
int epicFighterLimit;
|
||||
int epicLives;
|
||||
int epicKills;
|
||||
int playerSelect;
|
||||
int manualComplete;
|
||||
int unwinnable;
|
||||
|
|
Loading…
Reference in New Issue