Sylv6

//taking central flux
#include 159

int gInfoIndex;
int NUM_BLERBS = 11;
bool[] gShown(NUM_BLERBS);

void reset()
{
	gNextScript = 292;
	commonReset();
	setMapSeed(16539);

	gHumanPlayer.addToHand("Grove");
	gHumanPlayer.addToHand("Bamboo Watch Tower");
	gHumanPlayer.addToHand("Great Oak");
	gHumanPlayer.addToHand("Elven Scout");
	gHumanPlayer.addToHand("Valedune Arborist");
	gHumanPlayer.addToHand("Ascent");
	gHumanPlayer.addToHand("Entangle");
	gHumanPlayer.addToDeck("Bindweed Poultice", 2);
	gHumanPlayer.addToDeck("Valedune Arborist", 3);
	gHumanPlayer.addToDeck("Treeherd", 1);
	gHumanPlayer.addToDeck("Graft", 4);
	gHumanPlayer.addToDeck("Bindweed Poultice", 5);

	gAIPlayer.addToHand("Dwarven Hall");
	gAIPlayer.addToHand("Dwarven Hall");
	gAIPlayer.addToHand("Craig Scout");
	gAIPlayer.addToHand("Home Guard");
	gAIPlayer.addToHand("Apprentice Timesap");
	gAIPlayer.addToHand("Clay Ram");
	gAIPlayer.addToDeck("Craig Scout", 1);
	gAIPlayer.addToDeck("Craig Scout", 2);
	gAIPlayer.addToDeck("Shield Warrior", 3);
	gAIPlayer.addToDeck("Axe Captain", 4);
	gAIPlayer.addToDeck("Dwarven Warrior", 5);

	createEntity("Flux Well", createLocation(2, 2));
	createEntity("Flux Well", createLocation(2, 10));
	createEntity("Flux Well", createLocation(6, 6));
	createEntity("Flux Well", createLocation(10, 2));
	createEntity("Flux Well", createLocation(10, 10));

	for (int n = 0; n < NUM_BLERBS; n++) gShown[n] = false;

	gAIPlayer.addFlux(-gAIPlayer.getFlux() + 10);
	gHumanPlayer.addFlux(-gHumanPlayer.getFlux() + 10);
	gAIPlayer.addGlory(-gAIPlayer.getGlory());
	gHumanPlayer.addGlory(-gHumanPlayer.getGlory());

	fogMap();
	lightFog(gHumanPlayer, 0, 0, 2, 5);
	lightFog(gAIPlayer, 7, 0, 12, 11);

	wipeEffect();
	showInfo();

}

void onNewRound()
{
	if (gHumanPlayer.getGlory() >= 8)
	{
		if (loadData(gHumanPlayer, 0) < 6)
			saveData(gHumanPlayer, 0, 6);
		gFinished = true;

		DlgBox box = createDialog("Victory!", "Congratulations, you passed the sixth mission. Keep it up.");
		box.addOption("Play Again", "", 3);
		box.addOption("Next Scenario", "", 2);
		box.show(gHumanPlayer);
	}
	else if (gAIPlayer.getGlory() > 2)
	{
		gFinished = true;
		DlgBox box = createDialog("", "You lost. Your enemy reached 4 Glory. That's ok you can just try again.");
		box.addOption("Try Again", "", 3);
		box.show(gHumanPlayer);
	}
}
void onPlayersTurn(Player player)
{
	if (player == gHumanPlayer)
		showInfo();
}

int getNextDialog()
{
	if (!gShown[0]) return (0);
	if (!gShown[1]) return (1);
	if (!gShown[2] && (createLocation(6, 6).getController()) == gHumanPlayer)
		return (2);

	return (NUM_BLERBS - 1); // nothing
}

void showInfo()
{
	//statusMsg(nullPlayer,"showInfo");
	int index = getNextDialog();
	gShown[index] = true;
	switch (index)
	{
	case 0:
	{
		string msg = "In this mission you have a {C,Bamboo Watch Tower} and a {C,Great Oak} - two buildings each with 2 vision.";
		infoBox("Mission 6.", msg , true, nullEntity, nullCard, nullLocation, nullPlayer, false, 0);
	}
	break;
	case 1:
	{
		string msg = "With proper placement of the buildings, you can capture the central Flux Well by building on your own territory.";
		infoBox("", msg, false, nullEntity, nullCard, nullLocation, nullPlayer, false, 0);
	}
	break;
	case 2:
	{
		string msg = "Now you only need to accumulate 10 Glory to win.";
		infoBox("", msg , true, nullEntity, nullCard, nullLocation, nullPlayer, false, 0);
	}
	break;
	}
}