Tutorial Game

This scenario is for newer players to help them learn some of the strategy of the game. To learn how to play try the first mission campaign.

#include 191

Player aiPlayer;
Player P1;
Entity nullEntity; 
Player nullPlayer; 
Card nullCard; 
Location nullLocation; 
int selection;
int catchSevenCards = 1;
int catchUndimmed = 1;
int catchTargeting = 1;
int catchRemoval = 1;
int catchConstruction = 2;
//int catchUnspent = 1;
//int catchFlyMelee = 1;
//int catchSpells = 1;
bool callPass;
bool hasStarter = false;
int undimmed = 0;

void callback(int c){
	selection = c;
	forEachEntity();
}

void configGame(){
	setNumPlayers(2); 
	addAIPlayer("Renegade Dwarf","Crypt Doctor",0); 
	dontNeedDecks(); 
	setTurnTime(181);
} 

void beforeStart(){ 
	aiPlayer=getAIPlayer(0); 
	P1 = getHumanPlayer(0);
	
	removeDeck(aiPlayer);
	removeDeck(P1);
	
	addMultiple(aiPlayer,"Attrition",1);
	addMultiple(aiPlayer,"Axe Captian",3);
	addMultiple(aiPlayer,"Blunderbuss Squad",3);
	addMultiple(aiPlayer,"Craig Scout",3);
	addMultiple(aiPlayer,"Dire Cave Cricket",3);
	addMultiple(aiPlayer,"Dwarven Hall",2);
	addMultiple(aiPlayer,"Dwarven Warrior",3);
	addMultiple(aiPlayer,"Earthworks",2);
	addMultiple(aiPlayer,"Epic Vetran",2);
	addMultiple(aiPlayer,"Hadarck's Fort",2);
	addMultiple(aiPlayer,"Hadth, Drill Sergeant",2);
	addMultiple(aiPlayer,"Hadarck's Throne",2);
	addMultiple(aiPlayer,"Ord Stone",3);
	addMultiple(aiPlayer,"Manipulation",2);
	addMultiple(aiPlayer,"Stone Mauler",3);
	addMultiple(aiPlayer,"Volcano",3);
	
	addMultiple(P1,"Astridian Forum",3);
	addMultiple(P1,"Bouyancy",1);
	//addMultiple(P1,"Cloudburst",0);
	addMultiple(P1,"Dew Mogi",3);
	addMultiple(P1,"Dirt Bully",2);
	addMultiple(P1,"Form of Vigor",2);
	addMultiple(P1,"Flame Ent",3);
	addMultiple(P1,"Icy Encasement",3);
	addMultiple(P1,"Kaikias",2);
	addMultiple(P1,"Lesser Anemoi",2);
	addMultiple(P1,"Magma Chamber",2);
	addMultiple(P1,"Mogi Nest",2);
	addMultiple(P1,"Reform",1);
	addMultiple(P1,"Sadathian Mercenaries",1);
	addMultiple(P1,"Scorched Horizons",1);
	addMultiple(P1,"Sleet Mogi",3);
	addMultiple(P1,"Stone Mauler",3);
	addMultiple(P1,"Sunburst",3);
	addMultiple(P1,"Thunderhead Reach",1);
	addMultiple(P1,"Weather Vane",2);
}

void afterStart(){
	Card hc;
	string cName;
	for( int i = 0; i < 7; i++ )
	{
		hc = P1.getHandCard(i);
		cName = hc.getName();
		if(cName == "Dew Mogi" || cName == "Dirt Bully" || cName == "Sleet Mogi" || cName == "Lesser Anemoi"){
			hasStarter = true;
		}
	}
	if(!hasStarter){
		infoBox("","Since your starting hand doesn't have an early creature you can play it is pobably a good idea to mulligan this hand.");
	}
}

void onNewRound(){
	if(catchUndimmed == 2){
		catchUndimmed = 1;
	}
	if(catchSevenCards == 2){
		catchSevenCards = 1;
	}
	if(catchTargeting ==2){
		catchTargeting = 1;
	}
	if(catchRemoval == 2){
		catchRemoval = 1;
	}
	if(catchConstruction == 2){
		catchConstruction = 1;
	}

}



bool entityCallback(Entity ent){
	switch(selection)
	{
	case 1:
		if(ent.isType(1) && (ent.getController() == P1) && !ent.isDim()){
			infoBox("","",true,nullEntity,nullCard,ent.getLoc(),nullPlayer,false,0); 
			DlgBox box = createDialog("Your creature is undimmed","It is usually a good idea to move all your creatures before you end the turn.");
			box.addOption("Undo","",1);
			box.addOption("Skip","",3);
			box.addOption("Ignore","",4);
			box.show(P1);
			callPass = false;
			return false;
			}
	case 2:
		if(ent.getController() == aiPlayer && ent.isType(1) && !ent.isDim()){
			undimmed++;
		}
		if(ent.getName() == "Icy Encasement"){
			undimmed--;
		}
	}
	
	callPass = true;
	return true;
}

bool canPass(Player player){
	if(player == P1){
		if((catchSevenCards == 1) && (P1.handSize() == 7))
		{
			catchSevenCards = 2;
			DlgBox box = createDialog("You have 7 cards","You won't draw a card next turn unless you discard or play something.  It is almost always a good idea to discard your worst card if you can't play anthing.  Don't discard domain card though, since you will automatically draw more if you don't have any in your hand");
			box.addOption("Undo","",1);
			box.addOption("Ignore","",2);
			box.show(P1);
			return false;
		}
		if(catchUndimmed == 1){
			undimmed = 0;
			callback(2);
			if(undimmed == 0){
				callback(1);
				if(!callPass){
					return false;
				}
			}
		}
	}
	return true;
}

bool canAct(Player player,Action action){
	if(player == P1){
		Card actor = action.getCardActor();
		Entity target = action.getEntityTarget(0);
		Location spot = action.getLocTarget(0);
		if(catchTargeting == 1){
			if(actor.getName() == "Bouyancy" && target.getController() == aiPlayer){
				catchTargeting = 2;
				DlgBox box = createDialog("That's the enemy","It't not a good idea to play Bouyancy on your opponents creatures");
				box.addOption("Undo","",1);
				box.addOption("Ignore","",5);
				box.show(P1);
				return false;
			}
			if((actor.getName() == "Sunburst" || actor.getName() == "Icy Encasement") && target.getController() == P1){
				catchTargeting = 2;
				DlgBox box = createDialog("That's your creature","It't not a good idea to play that on your own creatures");
				box.addOption("Undo","",1);
				box.addOption("Ignore","",5);
				box.show(P1);
				return false;
			}
		}
		if(catchRemoval == 1){
			if(actor.getName() == "Sunburst" && target.getCurHealth() > 4){
				catchRemoval = 2;
				DlgBox box = createDialog("Are you sure?","Sunburst won't kill that creature.  You should probably wait until you have damaged it more. ");
				box.addOption("Undo","",1);
				box.addOption("Ignore","",6);
				box.show(P1);
				return false;
			}
			if(actor.getName() == "Icy Encasement" && (target.getName() == "Dwarven Warrior" || target.getName() == "Craig Scout")){
				catchRemoval = 2;
				DlgBox box = createDialog("Are you sure?","Icy Encasement can deal with any creature.  You may want to save it for a more dangerous creature.");
				box.addOption("Undo","",1);
				box.addOption("Ignore","",6);
				box.show(P1);
				return false;
			}
		}
		if(catchConstruction == 1){
			if(actor.getName() == "Magma Chamber" && spot.getController() != P1){
				catchConstruction = 2;
				DlgBox box = createDialog("That is dangerous","Casting a base a construction site is dangerous; it's usually better to play bases in areas you control and other buildings as construction sites");
				box.addOption("Undo","",1);
				box.addOption("Ignore","",7);
				box.show(P1);
				return false;
			}
			if((actor.getName() == "Astridian Forum" || actor.getName() == "Mogi Nest") && spot.getController() == P1){
				catchConstruction = 2;
				DlgBox box = createDialog("Are you sure","It's usually better to play that building as a construction site adjacent to a flux well.  It won't help as much in an area you control. ");
				box.addOption("Undo","",1);
				box.addOption("Ignore","",7);
				box.show(P1);
				return false;
			}
		}
	}
	return true;
}

void onDialogResponse(Player player,int resp){
	switch(resp)
	{
	case 1:
		break;
	case 2:
		catchSevenCards = 0;
		break;
	case 3:
		catchUndimmed = 2;
		break;
	case 4:
		catchUndimmed = 0;
		break;
	case 5:
		catchTargeting = 0;
		break;
	case 6:
		catchRemoval = 0;
		break;
	case 7:
		catchConstruction = 0;
		break;
	}
}