/*
 * Firetech Playing Game
 * Made in february/march 2006 by Jocke "Firetech" Andersson
 *
 * I KNOW that this game doesn't really follow "RPG rules", but that's my intention...
 *
 * Windows: Compile as usual
 * *nix: Define UNIX (either while compiling (using -D) or in OSspec.cpp, the Makefile does the -D way automatically.)
 */
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
#include "OSspec.h"
#include "Player.h"
#include "random.h"

int main()
{
	srand(time(0));
	bool exit = false;
	int event;
	while (!exit) {
		clrScr();
		cout << "Welcome to FPG (the Firetech Playing Game) v3.5" << endl;
		cout << "===============================================" << endl << endl;
		cout << "You walk out into the woods..." << endl << endl;
		cout << "------- ------ ----- ---- --- -- -" << endl << endl;
		Player * you = new Player();
		while ((you->getHealth() > 0) && (!exit)) {
			you->printData();
			event = random(1,6);
			switch (event) {
				case 1:
				case 2:
					cout << "You don't find anything in this grove.";
					break;
				case 3:
					you->findTrainer();
					break;
				case 4:
					you->findItem();
					break;
				case 5:
				case 6:
					you->findMonster();
					break;
			}
			if (you->getHealth() > 0) {
				cout << endl << endl << "You continue your walk... (Press any key to continue, or Q to exit.)";
				if (tolower(inputCh(false)) == 'q') {
					exit = true;
				} else {
					cout << endl << endl << "------- ------ ----- ---- --- -- -" << endl << endl;
				}
			}
		}
		if (!exit) {
			delete you;
			cout << endl << endl << "New game [Y/n]? ";
			char ans = inputCh();
			if (tolower(ans) == 'n') {
				exit = true;
			}
		}
	}
	cout << endl;
    return 0;
}

