Esempio n. 1
0
/*******************************************************************************************************
* HUMAN STATS - returns the vital statistics for the human player
*******************************************************************************************************/
void HumanStats(Human & HumanObj)
{
	std::cout << "\n   *------------------------------------------------------------*" << std::endl;
	std::cout << "   | Status for the human named * " << HumanObj.GetName() << " *" << std::endl;
	std::cout << "   *------------------------------------------------------------*" << std::endl;
	std::cout << "   |  - Health:       " << HumanObj.GetHealth() << std::endl;
	std::cout << "   |  - Strength:     " << HumanObj.GetStrength() << std::endl;
	std::cout << "   |  - Luck:         " << HumanObj.GetLuck() << std::endl;
	std::cout << "   |  - Intelligence: " << HumanObj.GetIntelligence() << std::endl;
	std::cout << "   *------------------------------------------------------------*" << std::endl;
}
Esempio n. 2
0
/*******************************************************************************************************
* COMBAT - called when a physical challenge is actioned
*******************************************************************************************************/
void Combat(Human & HumanObj, Enemy * EnemyObj)
{
	// enemy variables
	const char * enemyName = EnemyObj->GetName();
	int enemyHealth = EnemyObj->GetHealth();
	int enemyStrength = EnemyObj->GetStrength();
	int enemyLuck = EnemyObj->GetLuck();

	// conditional block to determine outcome of confrontations
	if (HumanObj.GetStrength() >= enemyStrength && HumanObj.GetLuck() >= enemyLuck)
	{
		// wins hands down
		if (BestOfThree())
		{
			std::cout << "^^ You are a formidable foe, you fight " << enemyName << " and win easily \n   You feast on the still beating heart of your foe...\n   You gain health and strength. \n";
			HumanObj.SetHealth(HumanObj.GetHealth() + 10);
			HumanObj.SetStrength(HumanObj.GetStrength() + 2);
			HumanStats(HumanObj);
		}
		else
		{
			std::cout << "^^ You are a formidable foe, you fight " << enemyName << " and win easily \n   However, you took a hit that is but a flesh wound...\n   Your health is tarnished but a bit. \n";
			HumanObj.SetHealth(HumanObj.GetHealth() - 5);
			HumanStats(HumanObj);
		}
		Pause();
	}
	else if (HumanObj.GetHealth() >= enemyHealth && HumanObj.GetLuck() >= enemyLuck)
	{
		// player gets lucky takes a few but wins
		if (BestOfThree())
		{

			std::cout << "^^ Your enemy is your equal, you fight " << enemyName << " and get lucky \n   You feast on the still beating heart of your foe...\n   You gain health and luck. \n";
			HumanObj.SetHealth(HumanObj.GetHealth() + 10);
			HumanObj.SetLuck(HumanObj.GetLuck() + 2);
			HumanStats(HumanObj);
		}
		else
		{

			std::cout << "^^ Your enemy is your equal, you fight " << enemyName << " and get lucky \n   However, you took a hit that is but a flesh wound...\n   Your health is tarnished but a bit. \n";
			HumanObj.SetHealth(HumanObj.GetHealth() - 5);
			HumanObj.SetLuck(HumanObj.GetLuck() + 2);
			HumanStats(HumanObj);
		}
		Pause();
	}
	else if (HumanObj.GetHealth() < enemyHealth && HumanObj.GetLuck() >= enemyLuck)
	{
		// player gets lucky
		if (BestOfThree())
		{
			std::cout << "^^ Your enemy is healthier than you, you fight " << enemyName << " and get lucky \n   You feast on the still beating heart of your foe...\n   You gain health and luck. \n";
			HumanObj.SetHealth(HumanObj.GetHealth() + 10);
			HumanObj.SetLuck(HumanObj.GetLuck() + 2);
			HumanStats(HumanObj);
		}
		else
		{
			std::cout << "^^ Your enemy is healthier than you, you fight " << enemyName << " and get lucky \n   However, you took a hit that is but a flesh wound...\n   Your health is tarnished but a bit. \n";
			HumanObj.SetHealth(HumanObj.GetHealth() - 5);
			HumanObj.SetLuck(HumanObj.GetLuck() + 2);
			HumanStats(HumanObj);
		}
		Pause();
	}
	else
	{
		// player loses takes some damage
		std::cout << "^^ Your enemy is stronger, healthier and luckier than you.\n   You fight " << enemyName << " and you lose and flee... \n   You took several big hits...\n    Your health, strength are drained and you lost a lucky charm. \n";
		HumanObj.SetHealth(HumanObj.GetHealth() - 20);
		HumanObj.SetStrength(HumanObj.GetStrength() - 2);
		HumanObj.SetLuck(HumanObj.GetLuck() - 2);
		HumanStats(HumanObj);
		Pause();
	}
}
Esempio n. 3
0
/*******************************************************************************************************
* APPLY CHALLENGE - for the users chosen path, action the challenge for that direction
*******************************************************************************************************/
void ApplyChallenge(Challenge * ChallengePtr, Human & HumanObj, Enemy *Enemies[])
{
	//metal challenge variables
	bool incorrect = true;
	int count = 0;
	const int userInputLimit = 25;
	char userInput[userInputLimit] = {};
	StringOO userAnswer;
	StringOO actualAnswer;
	// points
	int points = ChallengePtr->GetDifficulty() + HumanObj.GetLocation();
	// if the challenge is of type FLEE
	if (ChallengePtr->GetType() == "flee")
	{
		std::cout << ">> To proceed in this direction we shall find out first if you can... \n";
		std::cout << ChallengePtr->GetDescription() << std::endl;
		Pause();
		if (BestOfThree())
		{
			std::cout << "+> Turns out yes, yes you can...you're free to pass! \n";
			HumanStats(HumanObj);
		}
		else
		{
			std::cout << "-> Nope, you can't as it turns out... \n   Someone had to come in and save you from yourself...\n   and further embarrassment...\n   Your fumbling has cost you health, strength, luck and intelligence." << std::endl;
			HumanObj.SetHealth(HumanObj.GetHealth() - points);
			HumanObj.SetStrength(HumanObj.GetStrength() - 2);
			HumanObj.SetLuck(HumanObj.GetLuck() - 2);
			HumanObj.SetIntelligence(HumanObj.GetIntelligence() - 1);
			HumanStats(HumanObj);
		}
		Pause();
	}
	// if the challenge is of type MENTAL
	else if (ChallengePtr->GetType() == "mental")
	{
		actualAnswer = ChallengePtr->GetAnswer();
		std::cout << ">> To proceed in this direction you must answer a question correctly... \n";
		std::cout << ChallengePtr->GetQuestion() << std::endl;
		while (incorrect)
		{
			std::cout << std::endl << "+ ";
			std::cin.getline(userInput, userInputLimit);
			userAnswer = userInput;
			if (userAnswer.StringCompare(actualAnswer) && count == 0)
			{
				std::cout << "\n+> Correct, please pass GO...Umm? but there is no $200 for you to collect... \n   At least you have your health ;-)" << std::endl;
				Pause();
				HumanStats(HumanObj);
				incorrect = false;
			}
			else if (userAnswer.StringCompare(actualAnswer) && count > 0)
			{
				std::cout << "-> Really? " << count << " guesses! Stop drinking the Coolade!, don't pass GO...! \n"; 
				points += count;
				std::cout << "   And give me " << points << " points of your best health and " << count << " of your intelligences... \n " << std::endl;
				Pause();
				HumanObj.SetHealth(HumanObj.GetHealth() - points);
				HumanObj.SetIntelligence(HumanObj.GetIntelligence() - count);
				HumanStats(HumanObj);
				incorrect = false;
			}
			else if (!userAnswer.StringCompare(actualAnswer) && count != 4)
			{
				std::cout << "\n   NOPE!! Try again...\n";
				count++;
			}
			else
			{
				std::this_thread::sleep_for(std::chrono::seconds(1));
				std::cout << "\n-> STOP!!...  <- \n             I think thats enough don't you?! \n";
				points += count;
				std::cout << "   For that you can give me...\n   - " << points << " points of your best health and...\n   - " << count << " of your intelligences... \n " << std::endl;
				Pause();
				HumanObj.SetHealth(HumanObj.GetHealth() - points);
				HumanObj.SetIntelligence(HumanObj.GetIntelligence() - count);
				HumanStats(HumanObj);
				incorrect = false;
			}
		}

	}
	// if the challenge is of type PHYSICAL
	else if (ChallengePtr->GetType() == "physical")
	{
		std::cout << ChallengePtr->GetDescription() << std::endl;
		Pause();
		Combat(HumanObj, Enemies[ChallengePtr->GetEnemy()]);
	}
	// if the challenge has no type
	else
	{
		std::cout << "   AND...\n" << std::endl;
		std::this_thread::sleep_for(std::chrono::seconds(3));
		std::cout << "           ...NOTHING HAPPENED!! \n" << std::endl;
		std::cout << "   Get out of Gaol Free or Just Visiting, either way your free to pass!! \n" << std::endl;
		Pause();
		HumanStats(HumanObj);
	}
}