From d33bcf94148f6738d41540009d364daae23a503d Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 27 Mar 2016 08:55:25 +0100 Subject: [PATCH] In epic battles, spawned in entities (such as swarmers) don't count towards the epicLimit. --- src/battle/entities.c | 8 ++++++++ src/battle/spawners.c | 7 ++++++- src/structs.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/battle/entities.c b/src/battle/entities.c index f3a7155..3a163c2 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -63,6 +63,7 @@ void doEntities(void) { int numAllies, numEnemies; int numActiveAllies, numActiveEnemies; + int numSpawnedEnemies; Entity *e, *prev; prev = &battle.entityHead; @@ -217,6 +218,11 @@ void doEntities(void) if (e->health > 0 && e->active) { numActiveEnemies++; + + if (e->spawned) + { + numSpawnedEnemies++; + } } } } @@ -229,6 +235,8 @@ void doEntities(void) if (battle.isEpic && battle.stats[STAT_TIME] % FPS == 0) { + numActiveEnemies -= numSpawnedEnemies; + if (numAllies > battle.epicFighterLimit) { activateEpicFighters(battle.epicFighterLimit - numActiveAllies, SIDE_ALLIES); diff --git a/src/battle/spawners.c b/src/battle/spawners.c index b25c053..fda46dd 100644 --- a/src/battle/spawners.c +++ b/src/battle/spawners.c @@ -40,7 +40,10 @@ void doSpawners(void) s->total -= num; } - battle.numInitialEnemies += num; + if (s->side != SIDE_ALLIES) + { + battle.numInitialEnemies += num; + } for (i = 0 ; i < num ; i++) { @@ -48,6 +51,8 @@ void doSpawners(void) e = spawnFighter(type, 0, 0, s->side); + e->spawned = 1; + if (s->offscreen) { e->x = player->x; diff --git a/src/structs.h b/src/structs.h index c909afd..65a9e74 100644 --- a/src/structs.h +++ b/src/structs.h @@ -100,6 +100,7 @@ struct Entity { char defName[MAX_NAME_LENGTH]; char groupName[MAX_NAME_LENGTH]; int active; + int spawned; int id; int side; float x;