#include "enemy_formations.h"
#include "balloon.h" // for BALLOON_VELX_NEGATIVE, BALLOON_VELX_POSITIVE
#include "param.h"	 // for param
#include "utils.h"	 // for ParamGame, Param, Zone, BLOCK

// Constructor
EnemyFormations::EnemyFormations()
{
	initEnemyFormations();
	initEnemyPools();
	initGameStages();
}

// Inicializa las formaciones enemigas
void EnemyFormations::initEnemyFormations()
{
	const int y4 = -BLOCK;
	const int x4_0 = param.game.play_area.rect.x;
	const int x4_100 = param.game.play_area.rect.w - BALLOON_WIDTH_4;

	const int y3 = -BLOCK;
	const int x3_0 = param.game.play_area.rect.x;
	const int x3_100 = param.game.play_area.rect.w - BALLOON_WIDTH_3;

	const int y2 = -BLOCK;
	const int x2_0 = param.game.play_area.rect.x;
	const int x2_100 = param.game.play_area.rect.w - BALLOON_WIDTH_2;

	const int y1 = -BLOCK;
	const int x1_0 = param.game.play_area.rect.x;
	const int x1_50 = param.game.play_area.center_x - (BALLOON_WIDTH_1 / 2);
	const int x1_100 = param.game.play_area.rect.w - BALLOON_WIDTH_1;

	// Inicializa a cero las variables
	for (int i = 0; i < NUMBER_OF_ENEMY_FORMATIONS; i++)
	{
		enemyFormation[i].numberOfEnemies = 0;
		for (int j = 0; j < MAX_NUMBER_OF_ENEMIES_IN_A_FORMATION; j++)
		{
			enemyFormation[i].init[j].x = 0;
			enemyFormation[i].init[j].y = 0;
			enemyFormation[i].init[j].velX = 0;
			enemyFormation[i].init[j].kind = 0;
			enemyFormation[i].init[j].creationCounter = 0;
		}
	}

	const int creationTime = 300;
	int incX = 0;
	int incTime = 0;
	int j = 0;

	// #00 - Dos enemigos BALLOON4 uno a cada extremo
	j = 0;
	enemyFormation[j].numberOfEnemies = 2;
	incX = x4_100;
	incTime = 0;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x4_0 + (i * incX);
		enemyFormation[j].init[i].y = y4;
		enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE * (((i % 2) * 2) - 1);
		enemyFormation[j].init[i].kind = BALLOON_4;
		enemyFormation[j].init[i].creationCounter = creationTime + (incTime * i);
	}

	// #01 - Dos enemigos BALLOON4 uno a cada cuarto. Ambos van hacia el centro
	j = 1;
	enemyFormation[j].numberOfEnemies = 2;
	incX = param.game.play_area.center_x;
	incTime = 0;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = param.game.play_area.first_quarter_x - (BALLOON_WIDTH_4 / 2) + (i * incX);
		enemyFormation[j].init[i].y = y4;
		enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE * (((i % 2) * 2) - 1);
		enemyFormation[j].init[i].kind = BALLOON_4;
		enemyFormation[j].init[i].creationCounter = creationTime + (incTime * i);
	}

	// #02 - Cuatro enemigos BALLOON2 uno detras del otro. A la izquierda y hacia el centro
	j = 2;
	enemyFormation[j].numberOfEnemies = 4;
	incX = BALLOON_WIDTH_2 + 1;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x2_0 + (i * incX);
		enemyFormation[j].init[i].y = y2;
		enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
		enemyFormation[j].init[i].kind = BALLOON_2;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #03 - Cuatro enemigos BALLOON2 uno detras del otro. A la derecha y hacia el centro
	j = 3;
	enemyFormation[j].numberOfEnemies = 4;
	incX = BALLOON_WIDTH_2 + 1;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x2_100 - (i * incX);
		enemyFormation[j].init[i].y = y2;
		enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
		enemyFormation[j].init[i].kind = BALLOON_2;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #04 - Tres enemigos BALLOON3. 0, 25, 50. Hacia la derecha
	j = 4;
	enemyFormation[j].numberOfEnemies = 3;
	incX = BALLOON_WIDTH_3 * 2;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x3_0 + (i * incX);
		enemyFormation[j].init[i].y = y3;
		enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
		enemyFormation[j].init[i].kind = BALLOON_3;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #05 - Tres enemigos BALLOON3. 50, 75, 100. Hacia la izquierda
	j = 5;
	enemyFormation[j].numberOfEnemies = 3;
	incX = BALLOON_WIDTH_3 * 2;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x3_100 - (i * incX);
		enemyFormation[j].init[i].y = y3;
		enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
		enemyFormation[j].init[i].kind = BALLOON_3;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #06 - Tres enemigos BALLOON3. 0, 0, 0. Hacia la derecha
	j = 6;
	enemyFormation[j].numberOfEnemies = 3;
	incX = BALLOON_WIDTH_3 + 1;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x3_0 + (i * incX);
		enemyFormation[j].init[i].y = y3;
		enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
		enemyFormation[j].init[i].kind = BALLOON_3;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #07 - Tres enemigos BALLOON3. 100, 100, 100. Hacia la izquierda
	j = 7;
	enemyFormation[j].numberOfEnemies = 3;
	incX = BALLOON_WIDTH_3 + 1;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x3_100 - (i * incX);
		enemyFormation[j].init[i].y = y3;
		enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
		enemyFormation[j].init[i].kind = BALLOON_3;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #08 - Seis enemigos BALLOON1. 0, 0, 0, 0, 0, 0. Hacia la derecha
	j = 8;
	enemyFormation[j].numberOfEnemies = 6;
	incX = BALLOON_WIDTH_1 + 1;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x1_0 + (i * incX);
		enemyFormation[j].init[i].y = y1;
		enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
		enemyFormation[j].init[i].kind = BALLOON_1;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #09 - Seis enemigos BALLOON1. 100, 100, 100, 100, 100, 100. Hacia la izquierda
	j = 9;
	enemyFormation[j].numberOfEnemies = 6;
	incX = BALLOON_WIDTH_1 + 1;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x1_100 - (i * incX);
		enemyFormation[j].init[i].y = y1;
		enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
		enemyFormation[j].init[i].kind = BALLOON_1;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #10 - Tres enemigos BALLOON4 seguidos desde la izquierda
	j = 10;
	enemyFormation[j].numberOfEnemies = 3;
	incX = BALLOON_WIDTH_4 + 1;
	incTime = 15;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x4_0 + (i * incX);
		enemyFormation[j].init[i].y = y4;
		enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
		enemyFormation[j].init[i].kind = BALLOON_4;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #11 - Tres enemigos BALLOON4 seguidos desde la derecha
	j = 11;
	enemyFormation[j].numberOfEnemies = 3;
	incX = BALLOON_WIDTH_4 + 1;
	incTime = 15;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x4_100 - (i * incX);
		enemyFormation[j].init[i].y = y4;
		enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
		enemyFormation[j].init[i].kind = BALLOON_4;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #12 - Seis enemigos BALLOON2 uno detras del otro. A la izquierda y hacia el centro
	j = 12;
	enemyFormation[j].numberOfEnemies = 6;
	incX = BALLOON_WIDTH_2 + 1;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x2_0 + (i * incX);
		enemyFormation[j].init[i].y = y2;
		enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
		enemyFormation[j].init[i].kind = BALLOON_2;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #13 - Seis enemigos BALLOON2 uno detras del otro. A la derecha y hacia el centro
	j = 13;
	enemyFormation[j].numberOfEnemies = 6;
	incX = BALLOON_WIDTH_2 + 1;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x2_100 - (i * incX);
		enemyFormation[j].init[i].y = y2;
		enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
		enemyFormation[j].init[i].kind = BALLOON_2;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #14 - Cinco enemigos BALLOON3. Hacia la derecha. Separados
	j = 14;
	enemyFormation[j].numberOfEnemies = 5;
	incX = BALLOON_WIDTH_3 * 2;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x3_0 + (i * incX);
		enemyFormation[j].init[i].y = y3;
		enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
		enemyFormation[j].init[i].kind = BALLOON_3;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #15 - Cinco enemigos BALLOON3. Hacia la izquierda. Separados
	j = 15;
	enemyFormation[j].numberOfEnemies = 5;
	incX = BALLOON_WIDTH_3 * 2;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x3_100 - (i * incX);
		enemyFormation[j].init[i].y = y3;
		enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
		enemyFormation[j].init[i].kind = BALLOON_3;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #16 - Cinco enemigos BALLOON3. Hacia la derecha. Juntos
	j = 16;
	enemyFormation[j].numberOfEnemies = 5;
	incX = BALLOON_WIDTH_3 + 1;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x3_0 + (i * incX);
		enemyFormation[j].init[i].y = y3;
		enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
		enemyFormation[j].init[i].kind = BALLOON_3;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #17 - Cinco enemigos BALLOON3. Hacia la izquierda. Juntos
	j = 17;
	enemyFormation[j].numberOfEnemies = 5;
	incX = BALLOON_WIDTH_3 + 1;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x3_100 - (i * incX);
		enemyFormation[j].init[i].y = y3;
		enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
		enemyFormation[j].init[i].kind = BALLOON_3;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #18 - Doce enemigos BALLOON1. Hacia la derecha. Juntos
	j = 18;
	enemyFormation[j].numberOfEnemies = 12;
	incX = BALLOON_WIDTH_1 + 1;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x1_0 + (i * incX);
		enemyFormation[j].init[i].y = y1;
		enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
		enemyFormation[j].init[i].kind = BALLOON_1;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #19 - Doce enemigos BALLOON1. Hacia la izquierda. Juntos
	j = 19;
	enemyFormation[j].numberOfEnemies = 12;
	incX = BALLOON_WIDTH_1 + 1;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		enemyFormation[j].init[i].x = x1_100 - (i * incX);
		enemyFormation[j].init[i].y = y1;
		enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
		enemyFormation[j].init[i].kind = BALLOON_1;
		enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i);
	}

	// #20 - Dos enemigos BALLOON4 seguidos desde la izquierda/derecha. Simetricos
	j = 20;
	enemyFormation[j].numberOfEnemies = 4;
	incX = BALLOON_WIDTH_4 + 1;
	incTime = 0;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		const int half = enemyFormation[j].numberOfEnemies / 2;
		if (i < half)
		{
			enemyFormation[j].init[i].x = x4_0 + (i * incX);
			enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
		}
		else
		{
			enemyFormation[j].init[i].x = x4_100 - ((i - half) * incX);
			enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
		}
		enemyFormation[j].init[i].y = y4;
		enemyFormation[j].init[i].kind = BALLOON_4;
		enemyFormation[j].init[i].creationCounter = creationTime + (incTime * i);
	}

	// #21 - Diez enemigos BALLOON2 uno detras del otro. Izquierda/derecha. Simetricos
	j = 21;
	enemyFormation[j].numberOfEnemies = 10;
	incX = BALLOON_WIDTH_2 + 1;
	incTime = 3;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		const int half = enemyFormation[j].numberOfEnemies / 2;
		if (i < half)
		{
			enemyFormation[j].init[i].x = x2_0 + (i * incX);
			enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
			enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * i);
		}
		else
		{
			enemyFormation[j].init[i].x = x2_100 - ((i - half) * incX);
			enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
			enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * (i - half));
		}
		enemyFormation[j].init[i].y = y2;
		enemyFormation[j].init[i].kind = BALLOON_2;
	}

	// #22 - Diez enemigos BALLOON3. Hacia la derecha/izquierda. Separados. Simetricos
	j = 22;
	enemyFormation[j].numberOfEnemies = 10;
	incX = BALLOON_WIDTH_3 * 2;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		const int half = enemyFormation[j].numberOfEnemies / 2;
		if (i < half)
		{
			enemyFormation[j].init[i].x = x3_0 + (i * incX);
			enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
			enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * i);
		}
		else
		{
			enemyFormation[j].init[i].x = x3_100 - ((i - half) * incX);
			enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
			enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * (i - half));
		}
		enemyFormation[j].init[i].y = y3;
		enemyFormation[j].init[i].kind = BALLOON_3;
	}

	// #23 - Diez enemigos BALLOON3. Hacia la derecha. Juntos. Simetricos
	j = 23;
	enemyFormation[j].numberOfEnemies = 10;
	incX = BALLOON_WIDTH_3 + 1;
	incTime = 10;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		const int half = enemyFormation[j].numberOfEnemies / 2;
		if (i < half)
		{
			enemyFormation[j].init[i].x = x3_0 + (i * incX);
			enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
			enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * i);
		}
		else
		{
			enemyFormation[j].init[i].x = x3_100 - ((i - half) * incX);
			enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
			enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * (i - half));
		}
		enemyFormation[j].init[i].y = y3;
		enemyFormation[j].init[i].kind = BALLOON_3;
	}

	// #24 - Treinta enemigos BALLOON1. Del centro hacia los extremos. Juntos. Simetricos
	j = 24;
	enemyFormation[j].numberOfEnemies = 30;
	incX = 0;
	incTime = 5;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		const int half = enemyFormation[j].numberOfEnemies / 2;
		if (i < half)
		{
			enemyFormation[j].init[i].x = x1_50;
			enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
			enemyFormation[j].init[i].creationCounter = (creationTime) + (incTime * i);
		}
		else
		{
			enemyFormation[j].init[i].x = x1_50;
			enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
			enemyFormation[j].init[i].creationCounter = (creationTime) + (incTime * (i - half));
		}
		enemyFormation[j].init[i].y = y1;
		enemyFormation[j].init[i].kind = BALLOON_1;
	}

	// #25 - Treinta enemigos BALLOON1. Del centro hacia adentro. Juntos. Simetricos
	j = 25;
	enemyFormation[j].numberOfEnemies = 30;
	incX = BALLOON_WIDTH_1 + 1;
	incTime = 5;
	for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
	{
		const int half = enemyFormation[j].numberOfEnemies / 2;
		if (i < half)
		{
			enemyFormation[j].init[i].x = x1_50 + 20;
			enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE;
			enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * i);
		}
		else
		{
			enemyFormation[j].init[i].x = x1_50 - 20;
			enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE;
			enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * (i - half));
		}
		enemyFormation[j].init[i].y = y1;
		enemyFormation[j].init[i].kind = BALLOON_1;
	}

	// Crea las mismas formaciones pero con hexagonos a partir de la posición 50 del vector
	for (int k = 0; k < j + 1; k++)
	{
		enemyFormation[k + 50].numberOfEnemies = enemyFormation[k].numberOfEnemies;
		for (int i = 0; i < enemyFormation[k + 50].numberOfEnemies; i++)
		{
			enemyFormation[k + 50].init[i].x = enemyFormation[k].init[i].x;
			enemyFormation[k + 50].init[i].y = enemyFormation[k].init[i].y;
			enemyFormation[k + 50].init[i].velX = enemyFormation[k].init[i].velX;
			enemyFormation[k + 50].init[i].creationCounter = enemyFormation[k].init[i].creationCounter;
			enemyFormation[k + 50].init[i].kind = enemyFormation[k].init[i].kind + 4;
		}
	}

	// TEST
	enemyFormation[99].numberOfEnemies = 4;

	enemyFormation[99].init[0].x = 10;
	enemyFormation[99].init[0].y = y1;
	enemyFormation[99].init[0].velX = 0;
	enemyFormation[99].init[0].kind = BALLOON_1;
	enemyFormation[99].init[0].creationCounter = 200;

	enemyFormation[99].init[1].x = 50;
	enemyFormation[99].init[1].y = y1;
	enemyFormation[99].init[1].velX = 0;
	enemyFormation[99].init[1].kind = BALLOON_2;
	enemyFormation[99].init[1].creationCounter = 200;

	enemyFormation[99].init[2].x = 90;
	enemyFormation[99].init[2].y = y1;
	enemyFormation[99].init[2].velX = 0;
	enemyFormation[99].init[2].kind = BALLOON_3;
	enemyFormation[99].init[2].creationCounter = 200;

	enemyFormation[99].init[3].x = 140;
	enemyFormation[99].init[3].y = y1;
	enemyFormation[99].init[3].velX = 0;
	enemyFormation[99].init[3].kind = BALLOON_4;
	enemyFormation[99].init[3].creationCounter = 200;
}

// Inicializa los conjuntos de formaciones
void EnemyFormations::initEnemyPools()
{
	// EnemyPool #0
	enemyPool[0].set[0] = &enemyFormation[0];
	enemyPool[0].set[1] = &enemyFormation[1];
	enemyPool[0].set[2] = &enemyFormation[2];
	enemyPool[0].set[3] = &enemyFormation[3];
	enemyPool[0].set[4] = &enemyFormation[4];
	enemyPool[0].set[5] = &enemyFormation[5];
	enemyPool[0].set[6] = &enemyFormation[6];
	enemyPool[0].set[7] = &enemyFormation[7];
	enemyPool[0].set[8] = &enemyFormation[8];
	enemyPool[0].set[9] = &enemyFormation[9];

	// EnemyPool #1
	enemyPool[1].set[0] = &enemyFormation[10];
	enemyPool[1].set[1] = &enemyFormation[11];
	enemyPool[1].set[2] = &enemyFormation[12];
	enemyPool[1].set[3] = &enemyFormation[13];
	enemyPool[1].set[4] = &enemyFormation[14];
	enemyPool[1].set[5] = &enemyFormation[15];
	enemyPool[1].set[6] = &enemyFormation[16];
	enemyPool[1].set[7] = &enemyFormation[17];
	enemyPool[1].set[8] = &enemyFormation[18];
	enemyPool[1].set[9] = &enemyFormation[19];

	// EnemyPool #2
	enemyPool[2].set[0] = &enemyFormation[0];
	enemyPool[2].set[1] = &enemyFormation[1];
	enemyPool[2].set[2] = &enemyFormation[2];
	enemyPool[2].set[3] = &enemyFormation[3];
	enemyPool[2].set[4] = &enemyFormation[4];
	enemyPool[2].set[5] = &enemyFormation[55];
	enemyPool[2].set[6] = &enemyFormation[56];
	enemyPool[2].set[7] = &enemyFormation[57];
	enemyPool[2].set[8] = &enemyFormation[58];
	enemyPool[2].set[9] = &enemyFormation[59];

	// EnemyPool #3
	enemyPool[3].set[0] = &enemyFormation[50];
	enemyPool[3].set[1] = &enemyFormation[51];
	enemyPool[3].set[2] = &enemyFormation[52];
	enemyPool[3].set[3] = &enemyFormation[53];
	enemyPool[3].set[4] = &enemyFormation[54];
	enemyPool[3].set[5] = &enemyFormation[5];
	enemyPool[3].set[6] = &enemyFormation[6];
	enemyPool[3].set[7] = &enemyFormation[7];
	enemyPool[3].set[8] = &enemyFormation[8];
	enemyPool[3].set[9] = &enemyFormation[9];

	// EnemyPool #4
	enemyPool[4].set[0] = &enemyFormation[60];
	enemyPool[4].set[1] = &enemyFormation[61];
	enemyPool[4].set[2] = &enemyFormation[62];
	enemyPool[4].set[3] = &enemyFormation[63];
	enemyPool[4].set[4] = &enemyFormation[64];
	enemyPool[4].set[5] = &enemyFormation[65];
	enemyPool[4].set[6] = &enemyFormation[66];
	enemyPool[4].set[7] = &enemyFormation[67];
	enemyPool[4].set[8] = &enemyFormation[68];
	enemyPool[4].set[9] = &enemyFormation[69];

	// EnemyPool #5
	enemyPool[5].set[0] = &enemyFormation[10];
	enemyPool[5].set[1] = &enemyFormation[61];
	enemyPool[5].set[2] = &enemyFormation[12];
	enemyPool[5].set[3] = &enemyFormation[63];
	enemyPool[5].set[4] = &enemyFormation[14];
	enemyPool[5].set[5] = &enemyFormation[65];
	enemyPool[5].set[6] = &enemyFormation[16];
	enemyPool[5].set[7] = &enemyFormation[67];
	enemyPool[5].set[8] = &enemyFormation[18];
	enemyPool[5].set[9] = &enemyFormation[69];

	// EnemyPool #6
	enemyPool[6].set[0] = &enemyFormation[60];
	enemyPool[6].set[1] = &enemyFormation[11];
	enemyPool[6].set[2] = &enemyFormation[62];
	enemyPool[6].set[3] = &enemyFormation[13];
	enemyPool[6].set[4] = &enemyFormation[64];
	enemyPool[6].set[5] = &enemyFormation[15];
	enemyPool[6].set[6] = &enemyFormation[66];
	enemyPool[6].set[7] = &enemyFormation[17];
	enemyPool[6].set[8] = &enemyFormation[68];
	enemyPool[6].set[9] = &enemyFormation[19];

	// EnemyPool #7
	enemyPool[7].set[0] = &enemyFormation[20];
	enemyPool[7].set[1] = &enemyFormation[21];
	enemyPool[7].set[2] = &enemyFormation[22];
	enemyPool[7].set[3] = &enemyFormation[23];
	enemyPool[7].set[4] = &enemyFormation[24];
	enemyPool[7].set[5] = &enemyFormation[65];
	enemyPool[7].set[6] = &enemyFormation[66];
	enemyPool[7].set[7] = &enemyFormation[67];
	enemyPool[7].set[8] = &enemyFormation[68];
	enemyPool[7].set[9] = &enemyFormation[69];

	// EnemyPool #8
	enemyPool[8].set[0] = &enemyFormation[70];
	enemyPool[8].set[1] = &enemyFormation[71];
	enemyPool[8].set[2] = &enemyFormation[72];
	enemyPool[8].set[3] = &enemyFormation[73];
	enemyPool[8].set[4] = &enemyFormation[74];
	enemyPool[8].set[5] = &enemyFormation[15];
	enemyPool[8].set[6] = &enemyFormation[16];
	enemyPool[8].set[7] = &enemyFormation[17];
	enemyPool[8].set[8] = &enemyFormation[18];
	enemyPool[8].set[9] = &enemyFormation[19];

	// EnemyPool #9
	enemyPool[9].set[0] = &enemyFormation[20];
	enemyPool[9].set[1] = &enemyFormation[21];
	enemyPool[9].set[2] = &enemyFormation[22];
	enemyPool[9].set[3] = &enemyFormation[23];
	enemyPool[9].set[4] = &enemyFormation[24];
	enemyPool[9].set[5] = &enemyFormation[70];
	enemyPool[9].set[6] = &enemyFormation[71];
	enemyPool[9].set[7] = &enemyFormation[72];
	enemyPool[9].set[8] = &enemyFormation[73];
	enemyPool[9].set[9] = &enemyFormation[74];
}

// Inicializa las fases del juego
void EnemyFormations::initGameStages()
{
	// STAGE 1
	stage[0].number = 1;
	stage[0].powerToComplete = 200;
	stage[0].minMenace = 7 + (4 * 1);
	stage[0].maxMenace = 7 + (4 * 3);
	stage[0].enemyPool = &enemyPool[0];

	// STAGE 2
	stage[1].number = 2;
	stage[1].powerToComplete = 300;
	stage[1].minMenace = 7 + (4 * 2);
	stage[1].maxMenace = 7 + (4 * 4);
	stage[1].enemyPool = &enemyPool[1];

	// STAGE 3
	stage[2].number = 3;
	stage[2].powerToComplete = 600;
	stage[2].minMenace = 7 + (4 * 3);
	stage[2].maxMenace = 7 + (4 * 5);
	stage[2].enemyPool = &enemyPool[2];

	// STAGE 4
	stage[3].number = 4;
	stage[3].powerToComplete = 600;
	stage[3].minMenace = 7 + (4 * 3);
	stage[3].maxMenace = 7 + (4 * 5);
	stage[3].enemyPool = &enemyPool[3];

	// STAGE 5
	stage[4].number = 5;
	stage[4].powerToComplete = 600;
	stage[4].minMenace = 7 + (4 * 4);
	stage[4].maxMenace = 7 + (4 * 6);
	stage[4].enemyPool = &enemyPool[4];

	// STAGE 6
	stage[5].number = 6;
	stage[5].powerToComplete = 600;
	stage[5].minMenace = 7 + (4 * 4);
	stage[5].maxMenace = 7 + (4 * 6);
	stage[5].enemyPool = &enemyPool[5];

	// STAGE 7
	stage[6].number = 7;
	stage[6].powerToComplete = 650;
	stage[6].minMenace = 7 + (4 * 5);
	stage[6].maxMenace = 7 + (4 * 7);
	stage[6].enemyPool = &enemyPool[6];

	// STAGE 8
	stage[7].number = 8;
	stage[7].powerToComplete = 750;
	stage[7].minMenace = 7 + (4 * 5);
	stage[7].maxMenace = 7 + (4 * 7);
	stage[7].enemyPool = &enemyPool[7];

	// STAGE 9
	stage[8].number = 9;
	stage[8].powerToComplete = 850;
	stage[8].minMenace = 7 + (4 * 6);
	stage[8].maxMenace = 7 + (4 * 8);
	stage[8].enemyPool = &enemyPool[8];

	// STAGE 10
	stage[9].number = 10;
	stage[9].powerToComplete = 950;
	stage[9].minMenace = 7 + (4 * 7);
	stage[9].maxMenace = 7 + (4 * 10);
	stage[9].enemyPool = &enemyPool[9];
}

// Devuelve una fase
stage_t EnemyFormations::getStage(int index) const
{
	return stage[index];
}