MF8

//8th MF
#include 159

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

void reset()
{
	setMapSeed(8299);
	commonReset();

	gHumanPlayer.addToHand("Dwarven Hall");
	gHumanPlayer.addToHand("Walled Outpost");
	gHumanPlayer.addToHand("Craig Scout");
	gHumanPlayer.addToHand("Iron Gate");
	gHumanPlayer.addToHand("Dwarven Warrior");
	gHumanPlayer.addToHand("Manipulation");
	gHumanPlayer.addToHand("Volcano");

	gHumanPlayer.addToDeck("Dwarven Hall", 1);
	gHumanPlayer.addToDeck("Shield Warrior", 2);
	gHumanPlayer.addToDeck("Ord Stone", 3);
	gHumanPlayer.addToDeck("Rune of Shielding", 4);
	gHumanPlayer.addToDeck("Horns to Hide", 5);
	gHumanPlayer.addToDeck("Axe Captain", 6);
	gHumanPlayer.addToDeck("Dwarven Hall", 7);
	gHumanPlayer.addToDeck("Earthworks", 8);
	gHumanPlayer.addToDeck("Dwarven Hall", 9);
	gHumanPlayer.addToDeck("Stone Mauler", 10);
	gHumanPlayer.addToDeck("Clay Ram", 11);
	gHumanPlayer.addToDeck("Disenchant", 12);
	gHumanPlayer.addToDeck("Craig Scout", 13);
	gHumanPlayer.addToDeck("Avalanche", 14);

	gAIPlayer.addToHand("Grove");
	gAIPlayer.addToHand("Elven Scout");
	gAIPlayer.addToHand("Tenderfoot Archer");
	gAIPlayer.addToHand("Treeherd");
	gAIPlayer.addToHand("Treeherd");
	gAIPlayer.addToHand("Dellenari Beastmaster");
	gAIPlayer.addToHand("Ascent");

	gAIPlayer.addToDeck("Grove", 1);
	gAIPlayer.addToDeck("Ascent", 2);
	gAIPlayer.addToDeck("Dellenari Beastmaster", 3);
	gAIPlayer.addToDeck("Bamboo Watch Tower", 4);
	gAIPlayer.addToDeck("Tree Mother", 5);
	gAIPlayer.addToDeck("Great Oak", 6);
	gAIPlayer.addToDeck("Treeherd", 7);
	gAIPlayer.addToDeck("Thistle Falcon", 8);
	gAIPlayer.addToDeck("Bindweed Poultice", 9);
	gAIPlayer.addToDeck("Tree Mother", 10);
	gAIPlayer.addToDeck("Emerald Spring", 11);
	gAIPlayer.addToDeck("The Coldstream Guard", 12);
	gAIPlayer.addToDeck("Dellenari Beastmaster", 13);
	gAIPlayer.addToDeck("Entangle", 14);

	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) < 8)
			saveData(gHumanPlayer, 0, 8);
		gFinished = true;
		endGame(gHumanPlayer);

		DlgBox box = createDialog("Victory!", "Congratulations, you passed the last mission. Claim your prize!");
		box.addOption("Play Again", "", 3);
		box.addOption("Finish", "", 4);
		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);

	return (NUM_BLERBS - 1); // nothing
}

void showInfo()
{
	//statusMsg(nullPlayer,"showInfo");
	int index = getNextDialog();
	gShown[index] = true;
	switch (index)
	{
	case 0:
	{
		string msg = "This is the final Mountain Folk mission. Do your best to win.";
		infoBox("Mission 8.", msg , true, nullEntity, nullCard, nullLocation, nullPlayer, false, 0);
	}
	break;
	}
}