示例#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;
}
示例#2
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);
	}
}