MF7

//Axe Captain Hero
#include 159

int gInfoIndex;
int NUM_BLERBS = 11;
bool[] gShown(NUM_BLERBS);
bool gotUnit;
void reset()
{
	gNextScript = 426;
	commonReset();
	setMapSeed(2497);
	gotUnit = false;

	gHumanPlayer.addToHand("Dwarven Hall");
	gHumanPlayer.addToHand("Ord Stone");
	gHumanPlayer.addToHand("Axe Captain");
	gHumanPlayer.addToHand("Craig Scout");
	gHumanPlayer.addToHand("Avalanche");
	gHumanPlayer.addToHand("Mountain Blessing");

	gHumanPlayer.addToDeck("Dwarven Hall", 1);
	gHumanPlayer.addToDeck("Avalanche", 2);
	gHumanPlayer.addToDeck("Dwarven Hall", 3);
	gHumanPlayer.addToDeck("Volcano", 4);
	gHumanPlayer.addToDeck("Earthworks", 5);
	gHumanPlayer.addToDeck("Dwarven Hall", 6);
	gHumanPlayer.addToDeck("Iron Gate", 7);
	gHumanPlayer.addToDeck("Walled Outpost", 8);

	gAIPlayer.addToHand("Graveyard");
	gAIPlayer.addToHand("Red Imp");
	gAIPlayer.addToHand("Gather Spirits");
	gAIPlayer.addToHand("Hell Cat");
	gAIPlayer.addToHand("Dank Pit");
	gAIPlayer.addToHand("Soul Broker");
	gAIPlayer.addToDeck("Graveyard", 1);
	gAIPlayer.addToDeck("Soul Broker", 2);
	gAIPlayer.addToDeck("Zombie", 3);
	gAIPlayer.addToDeck("Medium of the 3rd Circle", 4);
	gAIPlayer.addToDeck("Lysis", 5);
	gAIPlayer.addToDeck("Graveyard", 6);
	gAIPlayer.addToDeck("Hell Cat", 7);
	gAIPlayer.addToDeck("Demonic Surge", 8);
	gAIPlayer.addToDeck("Possession", 9);
	gAIPlayer.addToDeck("Medium of the 3rd Circle", 10);

	createEntity("Hell Cat", 10, 1, gAIPlayer);

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

		DlgBox box = createDialog("Victory!", "Congratulations, you passed the seventh 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 (gHumanPlayer.canSee(createLocation(5, 6)) && !gotUnit)
	{
		createEntity("Earthworks", 5, 6, gHumanPlayer);
		createEntity("Graveyard", 10, 2, gAIPlayer);
		gotUnit = true;
		showInfo();
	}
	if (player == gHumanPlayer)
		showInfo();
}

int getNextDialog()
{
	if (!gShown[0]) return (0);
	if (!gShown[1]) return (1);
	if (!gShown[2] && gHumanPlayer.canSee(createLocation(5, 6))) 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 only 2 creatures in your deck - {C,Craig Scout} and {C,Axe Captain}.";
		infoBox("Mission 6.", msg , true, nullEntity, nullCard, nullLocation, nullPlayer, false, 0);
	}
	break;
	case 1:
	{
		string msg = "Keep them alive as long as possible.";
		infoBox("", msg, false, nullEntity, nullCard, nullLocation, nullPlayer, false, 0);
	}
	break;
	case 2:
	{
		string msg = "Protect this {C,Earthworks} and victory is yours.";
		infoBox("", msg, false, nullEntity, nullCard, createLocation(5, 6), nullPlayer, false, 0);
	}
	break;
	}
}