本文整理汇总了C++中Human::GetLocation方法的典型用法代码示例。如果您正苦于以下问题:C++ Human::GetLocation方法的具体用法?C++ Human::GetLocation怎么用?C++ Human::GetLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Human
的用法示例。
在下文中一共展示了Human::GetLocation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ApplyChallenge
/*******************************************************************************************************
* 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();
//.........这里部分代码省略.........