Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #include <string>
- using namespace std;
- int main()
- {
- int food;
- int water;
- int health;
- int money;
- int day = 1;
- int gen;
- string choice;
- int condition;
- string difficulty;
- string name;
- int infected = 0;
- int score;
- bool repeat = true;
- system("Color 1B");
- cout << "What is your name? \n";
- cin >> name;
- cout << "\n";
- cout << "Choose your difficulty on playing this game: \n -dummy (easy) \n -manly (normal) \n -canadian (as brutal as a canadian) \n -very hard (type 'very_hard') \n";
- cout << "What difficulty do you choose? \n";
- cin >> difficulty;
- cout << "\n";
- if ( difficulty == "dummy" ) { food = 150; }; if ( difficulty == "manly" ) { food = 100; }; if ( difficulty == "canadian" ) { food = 50; };
- if ( difficulty == "very_hard" ) { food = 20; };
- if ( difficulty == "dummy" ) { water = 150; }; if ( difficulty == "manly" ) { water = 100; }; if ( difficulty == "canadian" ) { water = 50; };
- if ( difficulty == "very_hard" ) { water = 20; };
- health = 100;
- if ( difficulty == "dummy" ) { money = 100; }; if ( difficulty == "manly" ) { money = 50; }; if ( difficulty == "canadian" ) { money = 20; };
- if ( difficulty == "very_hard" ) { money = 0; };
- condition = true;
- score = 0;
- cout << "You can always check your game progress and additional information typing 'stats'. Good game ;)" << "\n" << "\n";
- do
- {
- repeat = false;
- if ( food < 1 ) {
- food = 0;
- health -= 30;
- }
- if ( water < 1 ) {
- water = 0;
- health -= 30;
- }
- if ( money < 1 ) {
- money = 0;
- }
- if ( health < 1 ) {
- health = 0;
- }
- cout << "Food: " << food << " Water: " << water << " Health: " << health << " Money: " << money << " Day " << day << "\n";
- if ( health == 0 ) {
- cout << "YOU DIED! YOU SURVIVED A TOTAL OF " << day << " DAYS. THANKS FOR PLAYING!";
- return 0;
- }
- if ( infected == 1 && difficulty == "manly" ) {
- health -= 5;
- water -= 5;
- }
- if ( infected == 1 && difficulty == "canadian" ) {
- health -= 10;
- water -= 10;
- }
- if ( infected == 1 && difficulty == "very hard" ) {
- health -= 20;
- water -= 20;
- food -= 20;
- }
- srand (time(NULL));
- gen = rand() % 13;
- switch ( gen ) {
- case 0: ///ZOMBIE!!
- cout << "You encountered a zombie! What do you do? \n -Fight \n -Retreat \n -Deal \n";
- cin >> choice;
- cout << "\n";
- repeat = false;
- if ( choice == "fight") {
- health -= rand() % 35;
- food += rand() % 20;
- money += rand() % 20;
- water += rand() % 20;
- day += 1;
- }
- if ( choice == "retreat" ) {
- food -= rand() % 20;
- water -= rand() % 20;
- health -= rand() % 7;
- day += 1;
- if ( infected == 1 ) {
- health -= 5;
- water -= 5;
- }
- }
- if ( choice == "deal" ) {
- water += rand() % 20;
- health -= rand() % 15;
- money += rand() % 10;
- day += 1;
- }
- if ( choice == "stats" ) {
- cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
- }
- break;
- case 1: ///SHOP
- cout << "There is a shop near. \n -Buy \n -Proceed \n";
- cin >> choice;
- cout << "\n";
- repeat = false;
- if ( choice == "buy" && money > 19 ) {
- water += rand() % 20;
- food += rand() % 20;
- money -= 20;
- health += 15;
- day += 1;
- }
- if ( choice == "proceed" ) {
- water -= rand() % 20;
- food -= rand() % 20;
- day += 1;
- if ( infected == 1 ) {
- health -= 5;
- water -= 5;
- }
- }
- if ( choice == "stats" ) {
- cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
- }
- break;
- case 2: ///SURVIVOR
- cout << "A survivor is in sight. \n -Proceed \n -Kill \n -Deal \n";
- cin >> choice;
- cout << "\n";
- repeat = false;
- if ( choice == "kill" ) {
- water += rand() % 30;
- food += rand() % 30;
- money += 35;
- health -= 70;
- day += 1;
- }
- if ( choice == "proceed" ) {
- water -= rand() % 20;
- food -= rand() % 20;
- day += 1;
- if ( infected == 1 ) {
- health -= 5;
- water -= 5;
- }
- }
- if ( choice == "deal" ) {
- water -= rand() % 20;
- food -= rand() % 20;
- money -= rand() % 10;
- health += rand() % 30;
- day += 1;
- }
- if ( choice == "stats" ) {
- cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
- }
- break;
- case 3: ///LAKE
- cout << "There is a lake over there. \n -Get water (type 'get') \n -Proceed \n";
- cin >> choice;
- cout << "\n";
- repeat = false;
- if ( choice == "get" ) {
- water += 30;
- health -= rand() % 10;
- food -= rand() % 20;
- day += 1;
- infected = rand() % 2;
- }
- if ( choice == "proceed" ) {
- water -= rand() % 5;
- food -= rand() % 20;
- day += 1;
- if ( infected == 1 ) {
- health -= 5;
- water -= 5;
- }
- }
- if ( choice == "stats" ) {
- cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
- }
- break;
- case 4: ///TREES
- cout << "There are some trees around, with wood you can do a campfire. \n -Chop wood \n -proceed \n";
- cin >> choice;
- cout << "\n";
- repeat = false;
- if ( choice == "chop" ) {
- water -= rand() % 30;
- food -= rand() % 30;
- health += 30;
- day += 2;
- if ( infected == 1 ) {
- health -= 5;
- water -= 5;
- }
- }
- if ( choice == "proceed" ) {
- water -= rand() % 20;
- food -= rand() % 20;
- day += 1;
- }
- if ( choice == "stats" ) {
- cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
- }
- break;
- case 5: ///Case 5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% COTTAGE
- cout << "There is a cottage near. \n -Rest \n -Prey \n -Proceed \n";
- cin >> choice;
- cout << "\n";
- repeat = false;
- if ( choice == "rest" ) {
- water -= rand() % 30;
- food -= rand() % 30;
- health += 30;
- day += rand() % 3;
- if ( infected == 1 ) {
- health -= 5;
- water -= 5;
- }
- }
- if ( choice == "proceed" ) {
- water -= rand() % 10;
- food -= rand() % 10;
- day += 1;
- }
- if ( choice == "prey" ) {
- water += rand() % 15;
- food += rand() % 15;
- money += rand() % 7;
- health -= rand() % 25;
- day += 1;
- }
- if ( choice == "stats" ) {
- cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
- }
- break;
- case 6: ///Case 6 --------------------------------------------------- SWAMP
- cout << "There is a swamp, what do you do? \n -Cross \n -Go around \n";
- cin >> choice;
- cout << "\n";
- repeat = false;
- if ( choice == "cross" ) {
- water -= rand() % 10;
- food -= rand() % 10;
- health -= 30;
- day += 1;
- infected = rand() % 2;
- }
- if ( choice == "go around" ) {
- water -= rand() % 20;
- food -= rand() % 20;
- day += 2;
- }
- if ( choice == "stats" ) {
- cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
- }
- break;
- case 7: ///DEAL
- cout << "A man searches for food. He offers money. \n -Accept \n -Deny \n";
- cin >> choice;
- cout << "\n";
- repeat = false;
- if ( choice == "accept" ) {
- money += rand() % 40;
- food -= rand() % 40;
- day += 1;
- }
- if ( choice == "deny" ) {
- water -= rand() % 20;
- food -= rand() % 20;
- day += 2;
- }
- if ( choice == "stats" ) {
- cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
- }
- break;
- case 8: ///MEDIKITS
- cout << "You found a medical packet. \n -Use \n -Throw it away \n";
- cin >> choice;
- cout << "\n";
- repeat = false;
- if ( choice == "use" ) {
- health += rand() % 30 + 15;
- food -= 20;
- water -= 20;
- day += 1;
- infected = rand() % 2;
- }
- if ( choice == "throw" ) {
- water -= rand() % 20;
- food -= rand() % 20;
- day += 1;
- }
- if ( choice == "stats" ) {
- cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
- }
- break;
- case 9: ///GROUP OF INFECTED
- cout << "You see a group of infected people. \n -Fight \n -Help them \n -Ignore \n";
- cin >> choice;
- cout << "\n";
- repeat = false;
- if ( choice == "fight" ) {
- water += rand() % 50 + 30;
- food += rand() % 50 + 30;
- money += 50;
- health -= 90;
- day += 1;
- }
- if ( choice == "help" ) {
- water -= rand() % 20;
- food -= rand() % 20;
- health += rand() % 50;
- money += rand() % 25;
- day += 1;
- infected = 1;
- }
- if ( choice == "ignore" ) {
- water -= rand() % 20;
- food -= rand() % 20;
- day += 1;
- }
- if ( choice == "stats" ) {
- cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
- }
- break;
- case 10: ///DEER
- cout << "There is a deer in distance. \n -Hunt \n -Proceed \n";
- cin >> choice;
- cout << "\n";
- repeat = false;
- if ( choice == "hunt" ) {
- food += rand() % 50 + 35;
- water -= rand() % 20;
- health -= rand() % 20 + 10;
- day += 1;
- infected = rand() % 2;
- }
- if ( choice == "proceed" ) {
- water -= rand() % 20;
- food -= rand() % 20;
- day += 1;
- }
- if ( choice == "stats" ) {
- cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
- }
- break;
- case 11: ///FARM
- cout << "An abandoned farm is near. \n -Prey food (type 'preyf') \n -Prey water (type 'preyw) \n -Proceed \n";
- cin >> choice;
- cout << "\n";
- repeat = false;
- if ( choice == "preyf" ) {
- food += rand() % 30 + 15;
- water -= rand() % 20;
- day += 1;
- infected = rand() % 2;
- }
- if ( choice == "preyw" ) {
- water += rand() % 30 + 20;
- food -= rand() % 20;
- infected = rand() % 2;
- day += 1;
- }
- if ( choice == "proceed" ) {
- water -= rand() % 20;
- food -= rand() % 20;
- day += 1;
- }
- if ( choice == "stats" ) {
- cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
- }
- break;
- case 12: ///CITADEL
- cout << "A citadel is in sight. It may be very dangerous. \n -Avoid \n -Find a refuge (type 'refuge') \n -Search for food/water \n -Rob money \n";
- cin >> choice;
- cout << "\n";
- repeat = false;
- if ( choice == "refuge" ) {
- food -= rand() % 20;
- water -= rand() % 20;
- health += 10;
- day += 2;
- }
- if ( choice == "search" ) {
- water += rand() % 30;
- food += rand() % 30;
- health -= rand() % 50 + 35;
- day += 1;
- }
- if ( choice == "rob" ) {
- water -= rand() % 20;
- food -= rand() % 20;
- health -= 40;
- money += rand() % 50 + 30;
- day += 1;
- }
- if ( choice == "avoid" ) {
- water -= rand() % 20;
- food -= rand() % 20;
- day += 1;
- }
- if ( choice == "stats" ) {
- cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
- }
- break;
- }
- if ( health == 0 ) {
- cout << "\n" << "YOU DIED! YOU SURVIVED A TOTAL OF " << day << " DAYS. THANKS FOR PLAYING!" << " FINAL SCORE: " << score << "\n";
- cin.get();
- system("pause");
- return 0;
- }
- if ( infected == 1 && difficulty == "manly" ) {
- health -= 5;
- water -= 5;
- }
- if ( infected == 1 && difficulty == "canadian" ) {
- health -= 10;
- water -= 10;
- }
- if ( infected == 1 && difficulty == "very hard" ) {
- health -= 20;
- water -= 20;
- food -= 20;
- }
- score += food+health/money;
- repeat = true;
- } while (repeat);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement