Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Text-Based-Game-Project/mainpart2.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
80 lines (72 sloc)
2.19 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Survival Simulation Module | |
#include "Encounters.h" | |
using namespace std; | |
int main() { | |
string Name = "Bob"; | |
string Dialogue; | |
string PreDest = "Get From Ami's Map Module"; | |
string NexDest = "Get From Ami's Map Module"; | |
string Luck; | |
string Type; | |
bool inTransit = false; | |
bool Death = false; | |
int Health = 100; | |
int Hunger = 0; | |
int hungerRate = 10; | |
int encounters = 0; | |
int pathway; | |
int dice_roll = rand() % 4 + 1; | |
int dice_roll2 = rand() % dice_roll + 1; | |
cout << endl << "You start with Health: " << Health << " and Hunger: " << Hunger << "\n"; | |
cout << endl << "As you leave " << PreDest << " You are presented with a road that seperates" << | |
" into three paths which one will you choose? "; | |
cin >> pathway; | |
std::this_thread::sleep_for(std::chrono::seconds(10)); | |
Encounters Encounter1(Name, Dialogue, Luck, Type, NexDest, inTransit, Death, Health, Hunger, hungerRate, encounters); | |
Encounter1.setInTransit(true); | |
cout << endl << Encounter1.getName() << " welcome to the road!" << endl; | |
while (inTransit = true) { | |
Encounter1.setDeath(Health, Hunger, Death); | |
if (Death == true) | |
{ | |
cout << endl << "I'm sorry player " << NexDest << " Is to far" << "\n" << "Game Over!" << endl; | |
abort(); | |
} | |
Encounter1.setEncounters(encounters); | |
if (encounters >= 2) { | |
cout << endl << "You've made it to " + NexDest << endl; | |
inTransit = false; | |
} | |
Encounter1.setType(Type); | |
if (Type == "Health") { | |
if (Encounter1.getLuck() == "Good") { | |
cout << endl << Encounter1.getDialogue << endl; | |
Encounter1.setHealth; | |
} | |
else { | |
cout << endl << Encounter1.getDialogue << endl; | |
Encounter1.setHealth; | |
} | |
} | |
if (Type == "Hunger") { | |
if (Encounter1.getLuck() == "Good") { | |
cout << endl << Encounter1.getDialogue << endl; | |
Encounter1.setHungerRate; | |
} | |
else { | |
cout << endl << Encounter1.getDialogue << endl; | |
Encounter1.setHungerRate; | |
} | |
} | |
if (Type == "Map") { | |
if (Encounter1.getLuck() == "Good") { | |
cout << endl << Encounter1.getDialogue << endl; | |
Encounter1.setNexDest; | |
} | |
else { | |
cout << endl << Encounter1.getDialogue << endl; | |
Encounter1.setNexDest; | |
} | |
} | |
} | |
} |