Allow some missions have to unlimited enemies (unwinnable epics).

This commit is contained in:
Steve 2016-05-29 09:36:10 +01:00
parent dc8e582812
commit 6d8f9f575e
9 changed files with 46 additions and 16 deletions

View File

@ -9,14 +9,15 @@
"objectives" : [
{
"description" : "Destroy all enemy targets",
"targetName" : "Pandoran",
"targetValue" : 999,
"targetName" : "ENEMY",
"targetValue" : 1,
"targetType" : "TT_DESTROY",
"hideNumbers" : 1
"isEliminateAll" : 1
}
],
"epic" : {
"fighterLimit" : 24
"fighterLimit" : 24,
"unlimitedEnemies" : 1
},
"player" : {
"type" : "Rook",

View File

@ -6,16 +6,17 @@
"planet" : "gfx/planets/bluePlanet.png",
"music" : "music/battle/Tactical Pursuit.mp3",
"epic" : {
"fighterLimit" : 12
"fighterLimit" : 12,
"unlimitedEnemies" : 1
},
"unwinnable" : 1,
"objectives" : [
{
"description" : "Destroy all enemy targets",
"targetName" : "Pandoran",
"targetValue" : 999,
"targetName" : "ENEMY",
"targetValue" : 1,
"targetType" : "TT_DESTROY",
"hideNumbers" : 1
"isEliminateAll" : 1
}
],
"player" : {

View File

@ -8,7 +8,8 @@
"music" : "music/battle/Tactical Pursuit.mp3",
"unwinnable" : 1,
"epic" : {
"fighterLimit" : 18
"fighterLimit" : 18,
"unlimitedEnemies" : 1
},
"objectives" : [
{
@ -53,7 +54,7 @@
"side" : "SIDE_PANDORAN",
"x" : 25,
"y" : 15,
"number" : 999,
"number" : 100,
"scatter" : 5000,
"flags" : "+EF_AI_TARGET"
}

View File

@ -189,11 +189,19 @@ void doEntities(void)
cutRope(e);
prev->next = e->next;
/* move to dead list */
e->next = NULL;
deadTail->next = e;
deadTail = e;
/* Move to end of entity queue if unlimited epic enemies. Otherwise, in dead list */
if (battle.isEpic && e->side != player->side && battle.unlimitedEnemies)
{
resetFighter(e);
}
else
{
deadTail->next = e;
deadTail = e;
}
e = prev;
}

View File

@ -38,6 +38,7 @@ extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore);
extern int isOnBattleScreen(int x, int y, int w, int h);
extern long lookup(char *name);
extern void awardTrophy(char *id);
extern void resetFighter(Entity *e);
extern App app;
extern Battle battle;

View File

@ -190,6 +190,22 @@ static void randomizeDartGuns(Entity *dart)
}
}
void resetFighter(Entity *e)
{
e->active = 0;
e->health = e->maxHealth;
e->systemPower = MAX_SYSTEM_POWER;
e->alive = ALIVE_ALIVE;
e->action = doAI;
e->die = die;
e->next = NULL;
battle.entityTail->next = e;
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Resetting fighter '%s'", e->name);
}
void doFighter(void)
{
if (self->alive == ALIVE_ALIVE)
@ -584,7 +600,7 @@ static void die(void)
incFighterStat(self->defName);
}
if (battle.isEpic)
if (battle.isEpic && player->flags & EF_COMMON_FIGHTER)
{
battle.stats[STAT_EPIC_KILL_STREAK]++;
}

View File

@ -425,7 +425,7 @@ static void drawNumFighters(void)
/* Enemies */
SDL_SetTextureColorMod(smallFighter, 255, 100, 100);
blit(smallFighter, SCREEN_WIDTH - 410, 15, 0);
drawText(SCREEN_WIDTH - 420, 11, 14, TA_RIGHT, colors.white, battle.numEnemies < 1000 ? "(%d)" : "(999+)", battle.numEnemies);
drawText(SCREEN_WIDTH - 420, 11, 14, TA_RIGHT, colors.white, !battle.unlimitedEnemies ? "(%d)" : "(999+)", battle.numEnemies);
}
static void drawObjectives(void)

View File

@ -407,6 +407,7 @@ static void loadEpicData(cJSON *node)
battle.isEpic = 1;
battle.epicFighterLimit = cJSON_GetObjectItem(node, "fighterLimit")->valueint;
battle.unlimitedEnemies = getJSONValue(node, "unlimitedEnemies", 0);
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
{

View File

@ -339,6 +339,7 @@ typedef struct {
int numInitialEnemies;
int status;
int isEpic;
int unlimitedEnemies;
int epicFighterLimit;
int playerSelect;
int manualComplete;