Skip to content

Commit

Permalink
- info in description
Browse files Browse the repository at this point in the history
Added Wizardry university course
Made jobs menu and shops menu use the class variables more to make the program easier to edit
  • Loading branch information
phoebe-leong authored May 28, 2021
1 parent 253c19b commit 87002b2
Showing 1 changed file with 50 additions and 29 deletions.
79 changes: 50 additions & 29 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ void init() {
jobs.teachingDegreeFinished = false;
jobs.cookingDegreeFinished = false;
jobs.talkingDegreeFinished = false;
jobs.wizardryDegreeFinished = false;

jobs.programmer = 1000;
jobs.chef = 200;
Expand All @@ -94,6 +95,7 @@ void init() {
uni.course2 = "Teaching";
uni.course3 = "Cooking";
uni.course4 = "Talking";
uni.course5 = "Wizardry";

shop.shopItem1 = "Quantum Computer";
shop.shopItem2 = "Big house";
Expand Down Expand Up @@ -152,6 +154,7 @@ void difficulty() {
std::cout << "Choose a difficulty: Easy, Normal, Impossible\n";
std::cin >> difficultyLvl;

// pretty dumb way of doing it but other ways don't work
if (difficultyLvl == "Easy") {
init();
mainMenu();
Expand Down Expand Up @@ -186,13 +189,10 @@ void difficulty() {

int close() {

std::string creditsStr = std::to_string(usr.credits);

file.open("data.txt");
file << usr.username << "\n";
file << jobs.currentJobStatus << "\n";
file << difficultyLvl << "\n";
file << creditsStr;
file << difficultyLvl;
file.close();

system("clear");
Expand All @@ -213,47 +213,55 @@ void uniMenu() {

if (jobs.csDegreeFinished == false) {
if (shop.hasItem1 == true) {
std::cout << "Computer Science - Requires a previous degree in another field\n";
std::cout << uni.course1 << " - Requires a previous degree in another field\n";
} else if (uni.numOfDegrees >= 1) {
std::cout << "Computer Science - Requires 'Quantum Computer'\n";
std::cout << uni.course1 << " - Requires 'Quantum Computer'\n";
} else if (uni.numOfDegrees >= 1 && shop.hasItem1 == true) {
std::cout << "Computer Science - Gives access to 'Programmer' job\n";
std::cout << uni.course1 << " - Gives access to 'Programmer' job\n";
}
}

if (jobs.teachingDegreeFinished == false) {
std::cout << "Teaching - Gives access to 'Teaching' job\n";
std::cout << uni.course2 << " - Gives access to '" << uni.course2 << "' job\n";
}

if (jobs.teachingDegreeFinished == false) {
std::cout << "Talking - Requires 'Teaching' degree\n";
std::cout << uni.course4 << " - Requires '" << uni.course2 << "' degree\n";
} else {
std::cout << "Talking - Gives access to 'Lecturer' job\n";
std::cout << uni.course4 << " - Gives access to 'Lecturer' job\n";
}

if (jobs.cookingDegreeFinished == false) {
std::cout << "Cooking - Gives access to 'Chef' job\n";
std::cout << uni.course3 << " - Gives access to 'Chef' job\n";
}

if (jobs.wizardryDegreeFinished == false) {
std::cout << uni.course5 << " - Gives access to Powerups and Upgrades\n";
}

std::cout << "\n";
std::cout << "Commands\n";

if (jobs.csDegreeFinished == false) {
if (uni.numOfDegrees >= 1 && shop.hasItem1 == true) {
std::cout << "'cs' to choose the Computer Science degree\n";
std::cout << "'cs' to choose the " << uni.course1 << " degree\n";
}
}

if (jobs.teachingDegreeFinished == false) {
std::cout << "'teaching' to choose the Teaching degree\n";
std::cout << "'teaching' to choose the " << uni.course2 << " degree\n";
}

if (jobs.teachingDegreeFinished == true && jobs.talkingDegreeFinished == false) {
std::cout << "'talking' to choose the Talking degree\n";
std::cout << "'talking' to choose the " << uni.course4 << " degree\n";
}

if (jobs.cookingDegreeFinished == false) {
std::cout << "'cooking' to choose the Cooking degree\n";
std::cout << "'cooking' to choose the " << uni.course3 << " degree\n";
}

if (jobs.wizardryDegreeFinished == false) {
std::cout << "'wizard' to choose the " << uni.course5 << " degree\n";
}

std::cout << "'exit' to exit the university menu\n";
Expand Down Expand Up @@ -297,6 +305,13 @@ void uniMenu() {
mainMenu();
}

if (jobs.wizardryDegreeFinished == false && input == "wizard") {
usr.credits -= uni.UniFee;
jobs.wizardryDegreeFinished = true;
system("clear");
mainMenu();
}

if (input == "exit") {
system("clear");
mainMenu();
Expand Down Expand Up @@ -389,7 +404,6 @@ void mainMenu() {

std::cout << "Commands:\n";
std::cout << "'jobs' to go to the job list\n";
// Find a way to find the file and display this only if the file exists
std::cout << "'erase' to erase all your user data\n";
std::cout << "'shop' to go to the shop\n";

Expand All @@ -416,12 +430,12 @@ void mainMenu() {

std::string input;
std::cin >> input;
std::cin.ignore();

if (input == "exit") {
system("clear");
close();
} else if (input == "erase") {
std::cin.ignore();
system("clear");

std::cout << "Are you sure you want to start over? [y/n] \n";
Expand All @@ -445,16 +459,20 @@ void mainMenu() {
}

} else if (input == "jobs" || input == "job") {
std::cin.ignore();
system("clear");
jobMenu();
} else if (input == "uni") {
std::cin.ignore();
system("clear");
uniMenu();
} else if (input == "shop") {
std::cin.ignore();
system("clear");
shopMenu();
} else if (jobs.currentJobStatus != "Unemployed") {
if (jobs.currentJobStatus == "Taxi Driver" && input == "drive") {
std::cin.ignore();
if (pwrUps.pwrUpActive == true) {
usr.credits += startingJobs.taxiDriver * pwrUps.powerUpMultiplier;
pwrUps.powerUpCommandNum++;
Expand All @@ -464,6 +482,7 @@ void mainMenu() {
system("clear");
mainMenu();
} else if (jobs.currentJobStatus == "Waiter" && input == "serve") {
std::cin.ignore();
if (pwrUps.pwrUpActive == true) {
usr.credits += startingJobs.waiter * pwrUps.powerUpMultiplier;
pwrUps.powerUpCommandNum++;
Expand All @@ -473,6 +492,7 @@ void mainMenu() {
system("clear");
mainMenu();
} else if (jobs.currentJobStatus == "Teacher" && input == "teach") {
std::cin.ignore();
if (pwrUps.pwrUpActive == true) {
usr.credits += startingJobs.teacher * pwrUps.powerUpMultiplier;
pwrUps.powerUpCommandNum++;
Expand All @@ -482,6 +502,7 @@ void mainMenu() {
system("clear");
mainMenu();
} else if (jobs.currentJobStatus == "Programmer" && input == "code") {
std::cin.ignore();
if (pwrUps.pwrUpActive == true) {
usr.credits += jobs.programmer * pwrUps.powerUpMultiplier;
pwrUps.powerUpCommandNum++;
Expand All @@ -491,6 +512,7 @@ void mainMenu() {
system("clear");
mainMenu();
} else if (jobs.currentJobStatus == "Lecturer" && input == "talk") {
std::cin.ignore();
if (pwrUps.pwrUpActive == true) {
usr.credits += jobs.lecturer * pwrUps.powerUpMultiplier;
pwrUps.powerUpCommandNum++;
Expand All @@ -500,6 +522,7 @@ void mainMenu() {
system("clear");
mainMenu();
} else if (jobs.currentJobStatus == "Chef" && input == "cook") {
std::cin.ignore();
if (pwrUps.pwrUpActive == true) {
usr.credits += jobs.chef * pwrUps.powerUpMultiplier;
pwrUps.powerUpCommandNum++;
Expand Down Expand Up @@ -549,10 +572,6 @@ void jobMenu() {

std::cout << "Waiter / Waitress - $" << startingJobs.waiter << "\n";

if (jobs.teachingDegreeFinished == false) {
std::cout << "Teacher - Requires University Degree in Teaching - $" << startingJobs.teacher << "\n";
}

// Shows university jobs
if (uni.numOfDegrees >= 1) {
std::cout << "Taxi Driver - $" << startingJobs.taxiDriver << "\n";
Expand Down Expand Up @@ -595,9 +614,11 @@ void jobMenu() {
}

} else {
std::cout << "Taxi Driver - $" << startingJobs.taxiDriver << "\n\n";
std::cout << "Taxi Driver - $" << startingJobs.taxiDriver;
}

std::cout << "\n\nMore jobs can be found in the university menu.\n\n";

std::cout << "Commands:\n";
std::cout << "'taxi' to select taxi job\n";
std::cout << "'waiter' to select waiter / waitress job\n";
Expand Down Expand Up @@ -684,12 +705,12 @@ void shopMenu() {
std::cout << shop.shopItem1 << " - $" << shop.shopItem1Price << "\n";
std::cout << shop.shopItem2 << " - $" << shop.shopItem2Price << "\n";
std::cout << shop.shopItem3 << " - $" << shop.shopItem3Price << "\n";

if (pwrUps.pwrUpActive == false) {
std::cout << shop.shopItem4 << " - $" << shop.shopItem4Price << "\n";
std::cout << shop.shopItem5 << " - $" << shop.shopItem5Price << "\n\n";
} else {
std::cout << shop.shopItem4 << " - $" << shop.shopItem4Price << "\n\n";

if (pwrUps.pwrUpActive == false && jobs.wizardryDegreeFinished == true) {
std::cout << shop.shopItem5 << " - $" << shop.shopItem5Price << "\n\n";
} else if (pwrUps.pwrUpActive == false && jobs.wizardryDegreeFinished == false) {
std::cout << shop.shopItem5 << " - Requires '" << uni.course5 << "' degree - $" << shop.shopItem5Price << "\n\n";
}

std::cout << "Commands:\n";
Expand All @@ -698,7 +719,7 @@ void shopMenu() {
std::cout << "'board' to buy the " << shop.shopItem3 << "\n";
std::cout << "'cat' to buy the " << shop.shopItem4 << "\n";

if (pwrUps.pwrUpActive == false) {
if (pwrUps.pwrUpActive == false && jobs.wizardryDegreeFinished == true) {
std::cout << "'power' to buy the " << shop.shopItem5 << "\n";
}

Expand Down Expand Up @@ -786,7 +807,7 @@ void shopMenu() {
std::cin.ignore();
InsufficientFunds();
}
} else if (input == "power" && pwrUps.pwrUpActive == false) {
} else if (input == "power" && pwrUps.pwrUpActive == false && jobs.wizardryDegreeFinished == true) {
if (usr.credits >= shop.shopItem5Price) {
usr.credits -= shop.shopItem5Price;
pwrUps.pwrUpActive = true;
Expand Down

0 comments on commit 87002b2

Please sign in to comment.