MF5

//fear cat
#include 159

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

void reset()
{
	gNextScript = 424;
	commonReset();
	setMapSeed(25820);

	gHellCat = createEntity("Hell Cat", 8, 2, gAIPlayer);
	enchantEntity(gHellCat , "Fear", gAIPlayer);

	gHumanPlayer.addToHand("Dwarven Hall");
	gHumanPlayer.addToHand("Rune of Shielding");
	gHumanPlayer.addToHand("Dwarven Warrior");
	gHumanPlayer.addToHand("Craig Scout");
	gHumanPlayer.addToHand("Disenchant");
	gHumanPlayer.addToHand("Shield Warrior");

	gHumanPlayer.addToDeck("Dwarven Hall", 1);
	gHumanPlayer.addToDeck("Clay Ram", 2);
	gHumanPlayer.addToDeck("Horns to Hide", 3);
	gHumanPlayer.addToDeck("Shield Warrior", 4);
	gHumanPlayer.addToDeck("Disenchant", 5);
	gHumanPlayer.addToDeck("Dwarven Hall", 6);
	gHumanPlayer.addToDeck("Axe Captain", 7);
	gHumanPlayer.addToDeck("Horns to Hide", 8);
	gHumanPlayer.addToDeck("Shield Warrior", 9);
	gHumanPlayer.addToDeck("Craig Scout", 10);

	gAIPlayer.addToHand("Graveyard");
	gAIPlayer.addToHand("Red Imp");
	gAIPlayer.addToHand("Black Plague");
	gAIPlayer.addToHand("Demonic Surge");
	gAIPlayer.addToHand("Dank Pit");
	gAIPlayer.addToHand("Soul Broker");
	gAIPlayer.addToDeck("Graveyard", 1);
	gAIPlayer.addToDeck("Soul Broker", 2);
	gAIPlayer.addToDeck("Demonic Surge", 3);
	gAIPlayer.addToDeck("Medium of the 3rd Circle", 4);
	gAIPlayer.addToDeck("Medium of the 3rd Circle", 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("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() + 7);
	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) < 5)
			saveData(gHumanPlayer, 0, 5);
		gFinished = true;

		DlgBox box = createDialog("Victory!", "Congratulations, you passed the fifth 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] && gHumanPlayer.canSee(gHellCat.getLoc()))	return (1);
	return (NUM_BLERBS - 1); // nothing
}

void showInfo()
{
	//statusMsg(nullPlayer,"showInfo");
	int index = getNextDialog();
	gShown[index] = true;
	switch (index)
	{
	case 0:
	{
		Card card = gHumanPlayer.getHandCard(5);
		string msg = "{C,Shield Warrior} will help you to withstand against Dark Legion forces.";
		infoBox("Mission 5.", msg , true, nullEntity, card, nullLocation, nullPlayer, false, 0);
	}
	break;
	case 1:
	{
		string msg = "This {C,Hell Cat} is enchanted with {C,Fear} so you can't move close to it to attack, but you can use {C,Disenchant} to remove Fear.";
		infoBox("", msg, false, nullEntity, nullCard, gHellCat.getLoc(), nullPlayer, false, 0);
	}
	break;
	}
}