Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.12 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <time.h>
  6. #include <string>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12. int food;
  13. int water;
  14. int health;
  15. int money;
  16. int day = 1;
  17. int gen;
  18. string choice;
  19. int condition;
  20. string difficulty;
  21. string name;
  22. int infected = 0;
  23. int score;
  24. bool repeat = true;
  25.  
  26. system("Color 1B");
  27.  
  28. cout << "What is your name? \n";
  29. cin >> name;
  30. cout << "\n";
  31. 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";
  32. cout << "What difficulty do you choose? \n";
  33. cin >> difficulty;
  34. cout << "\n";
  35.  
  36.  
  37. if ( difficulty == "dummy" ) { food = 150; }; if ( difficulty == "manly" ) { food = 100; }; if ( difficulty == "canadian" ) { food = 50; };
  38. if ( difficulty == "very_hard" ) { food = 20; };
  39. if ( difficulty == "dummy" ) { water = 150; }; if ( difficulty == "manly" ) { water = 100; }; if ( difficulty == "canadian" ) { water = 50; };
  40. if ( difficulty == "very_hard" ) { water = 20; };
  41. health = 100;
  42. if ( difficulty == "dummy" ) { money = 100; }; if ( difficulty == "manly" ) { money = 50; }; if ( difficulty == "canadian" ) { money = 20; };
  43. if ( difficulty == "very_hard" ) { money = 0; };
  44. condition = true;
  45.  
  46. score = 0;
  47.  
  48. cout << "You can always check your game progress and additional information typing 'stats'. Good game ;)" << "\n" << "\n";
  49.  
  50. do
  51. {
  52.  
  53. repeat = false;
  54. if ( food < 1 ) {
  55. food = 0;
  56. health -= 30;
  57. }
  58. if ( water < 1 ) {
  59. water = 0;
  60. health -= 30;
  61. }
  62. if ( money < 1 ) {
  63. money = 0;
  64. }
  65. if ( health < 1 ) {
  66. health = 0;
  67. }
  68.  
  69.  
  70. cout << "Food: " << food << " Water: " << water << " Health: " << health << " Money: " << money << " Day " << day << "\n";
  71.  
  72.  
  73.  
  74. if ( health == 0 ) {
  75. cout << "YOU DIED! YOU SURVIVED A TOTAL OF " << day << " DAYS. THANKS FOR PLAYING!";
  76. return 0;
  77. }
  78. if ( infected == 1 && difficulty == "manly" ) {
  79. health -= 5;
  80. water -= 5;
  81. }
  82. if ( infected == 1 && difficulty == "canadian" ) {
  83. health -= 10;
  84. water -= 10;
  85. }
  86. if ( infected == 1 && difficulty == "very hard" ) {
  87. health -= 20;
  88. water -= 20;
  89. food -= 20;
  90. }
  91.  
  92. srand (time(NULL));
  93. gen = rand() % 13;
  94. switch ( gen ) {
  95. case 0: ///ZOMBIE!!
  96. cout << "You encountered a zombie! What do you do? \n -Fight \n -Retreat \n -Deal \n";
  97. cin >> choice;
  98. cout << "\n";
  99. repeat = false;
  100. if ( choice == "fight") {
  101. health -= rand() % 35;
  102. food += rand() % 20;
  103. money += rand() % 20;
  104. water += rand() % 20;
  105. day += 1;
  106. }
  107. if ( choice == "retreat" ) {
  108. food -= rand() % 20;
  109. water -= rand() % 20;
  110. health -= rand() % 7;
  111. day += 1;
  112. if ( infected == 1 ) {
  113. health -= 5;
  114. water -= 5;
  115. }
  116. }
  117. if ( choice == "deal" ) {
  118. water += rand() % 20;
  119. health -= rand() % 15;
  120. money += rand() % 10;
  121. day += 1;
  122. }
  123. if ( choice == "stats" ) {
  124. cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
  125. }
  126.  
  127. break;
  128.  
  129. case 1: ///SHOP
  130. cout << "There is a shop near. \n -Buy \n -Proceed \n";
  131. cin >> choice;
  132. cout << "\n";
  133. repeat = false;
  134. if ( choice == "buy" && money > 19 ) {
  135. water += rand() % 20;
  136. food += rand() % 20;
  137. money -= 20;
  138. health += 15;
  139. day += 1;
  140. }
  141.  
  142. if ( choice == "proceed" ) {
  143. water -= rand() % 20;
  144. food -= rand() % 20;
  145. day += 1;
  146. if ( infected == 1 ) {
  147. health -= 5;
  148. water -= 5;
  149. }
  150. }
  151. if ( choice == "stats" ) {
  152. cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
  153. }
  154. break;
  155.  
  156. case 2: ///SURVIVOR
  157. cout << "A survivor is in sight. \n -Proceed \n -Kill \n -Deal \n";
  158. cin >> choice;
  159. cout << "\n";
  160. repeat = false;
  161. if ( choice == "kill" ) {
  162. water += rand() % 30;
  163. food += rand() % 30;
  164. money += 35;
  165. health -= 70;
  166. day += 1;
  167. }
  168.  
  169. if ( choice == "proceed" ) {
  170. water -= rand() % 20;
  171. food -= rand() % 20;
  172. day += 1;
  173. if ( infected == 1 ) {
  174. health -= 5;
  175. water -= 5;
  176. }
  177. }
  178.  
  179. if ( choice == "deal" ) {
  180. water -= rand() % 20;
  181. food -= rand() % 20;
  182. money -= rand() % 10;
  183. health += rand() % 30;
  184. day += 1;
  185. }
  186. if ( choice == "stats" ) {
  187. cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
  188. }
  189. break;
  190.  
  191.  
  192. case 3: ///LAKE
  193. cout << "There is a lake over there. \n -Get water (type 'get') \n -Proceed \n";
  194. cin >> choice;
  195. cout << "\n";
  196. repeat = false;
  197. if ( choice == "get" ) {
  198. water += 30;
  199. health -= rand() % 10;
  200. food -= rand() % 20;
  201. day += 1;
  202. infected = rand() % 2;
  203. }
  204.  
  205. if ( choice == "proceed" ) {
  206. water -= rand() % 5;
  207. food -= rand() % 20;
  208. day += 1;
  209. if ( infected == 1 ) {
  210. health -= 5;
  211. water -= 5;
  212. }
  213. }
  214. if ( choice == "stats" ) {
  215. cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
  216. }
  217. break;
  218.  
  219.  
  220. case 4: ///TREES
  221. cout << "There are some trees around, with wood you can do a campfire. \n -Chop wood \n -proceed \n";
  222. cin >> choice;
  223. cout << "\n";
  224. repeat = false;
  225. if ( choice == "chop" ) {
  226. water -= rand() % 30;
  227. food -= rand() % 30;
  228. health += 30;
  229. day += 2;
  230. if ( infected == 1 ) {
  231. health -= 5;
  232. water -= 5;
  233. }
  234. }
  235. if ( choice == "proceed" ) {
  236. water -= rand() % 20;
  237. food -= rand() % 20;
  238. day += 1;
  239. }
  240. if ( choice == "stats" ) {
  241. cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
  242. }
  243. break;
  244.  
  245. case 5: ///Case 5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% COTTAGE
  246. cout << "There is a cottage near. \n -Rest \n -Prey \n -Proceed \n";
  247. cin >> choice;
  248. cout << "\n";
  249. repeat = false;
  250. if ( choice == "rest" ) {
  251. water -= rand() % 30;
  252. food -= rand() % 30;
  253. health += 30;
  254. day += rand() % 3;
  255. if ( infected == 1 ) {
  256. health -= 5;
  257. water -= 5;
  258. }
  259. }
  260.  
  261. if ( choice == "proceed" ) {
  262. water -= rand() % 10;
  263. food -= rand() % 10;
  264. day += 1;
  265. }
  266.  
  267. if ( choice == "prey" ) {
  268. water += rand() % 15;
  269. food += rand() % 15;
  270. money += rand() % 7;
  271. health -= rand() % 25;
  272. day += 1;
  273. }
  274. if ( choice == "stats" ) {
  275. cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
  276. }
  277. break;
  278.  
  279. case 6: ///Case 6 --------------------------------------------------- SWAMP
  280. cout << "There is a swamp, what do you do? \n -Cross \n -Go around \n";
  281. cin >> choice;
  282. cout << "\n";
  283. repeat = false;
  284. if ( choice == "cross" ) {
  285. water -= rand() % 10;
  286. food -= rand() % 10;
  287. health -= 30;
  288. day += 1;
  289. infected = rand() % 2;
  290. }
  291.  
  292. if ( choice == "go around" ) {
  293. water -= rand() % 20;
  294. food -= rand() % 20;
  295. day += 2;
  296. }
  297. if ( choice == "stats" ) {
  298. cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
  299. }
  300. break;
  301.  
  302. case 7: ///DEAL
  303. cout << "A man searches for food. He offers money. \n -Accept \n -Deny \n";
  304. cin >> choice;
  305. cout << "\n";
  306. repeat = false;
  307. if ( choice == "accept" ) {
  308. money += rand() % 40;
  309. food -= rand() % 40;
  310. day += 1;
  311. }
  312.  
  313. if ( choice == "deny" ) {
  314. water -= rand() % 20;
  315. food -= rand() % 20;
  316. day += 2;
  317. }
  318. if ( choice == "stats" ) {
  319. cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
  320. }
  321. break;
  322.  
  323. case 8: ///MEDIKITS
  324. cout << "You found a medical packet. \n -Use \n -Throw it away \n";
  325. cin >> choice;
  326. cout << "\n";
  327. repeat = false;
  328. if ( choice == "use" ) {
  329. health += rand() % 30 + 15;
  330. food -= 20;
  331. water -= 20;
  332. day += 1;
  333. infected = rand() % 2;
  334. }
  335.  
  336. if ( choice == "throw" ) {
  337. water -= rand() % 20;
  338. food -= rand() % 20;
  339. day += 1;
  340. }
  341. if ( choice == "stats" ) {
  342. cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
  343. }
  344. break;
  345.  
  346. case 9: ///GROUP OF INFECTED
  347. cout << "You see a group of infected people. \n -Fight \n -Help them \n -Ignore \n";
  348. cin >> choice;
  349. cout << "\n";
  350. repeat = false;
  351. if ( choice == "fight" ) {
  352. water += rand() % 50 + 30;
  353. food += rand() % 50 + 30;
  354. money += 50;
  355. health -= 90;
  356. day += 1;
  357. }
  358.  
  359. if ( choice == "help" ) {
  360. water -= rand() % 20;
  361. food -= rand() % 20;
  362. health += rand() % 50;
  363. money += rand() % 25;
  364. day += 1;
  365. infected = 1;
  366. }
  367.  
  368. if ( choice == "ignore" ) {
  369. water -= rand() % 20;
  370. food -= rand() % 20;
  371. day += 1;
  372. }
  373. if ( choice == "stats" ) {
  374. cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
  375. }
  376. break;
  377.  
  378. case 10: ///DEER
  379. cout << "There is a deer in distance. \n -Hunt \n -Proceed \n";
  380. cin >> choice;
  381. cout << "\n";
  382. repeat = false;
  383. if ( choice == "hunt" ) {
  384. food += rand() % 50 + 35;
  385. water -= rand() % 20;
  386. health -= rand() % 20 + 10;
  387. day += 1;
  388. infected = rand() % 2;
  389. }
  390.  
  391. if ( choice == "proceed" ) {
  392. water -= rand() % 20;
  393. food -= rand() % 20;
  394. day += 1;
  395. }
  396. if ( choice == "stats" ) {
  397. cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
  398. }
  399. break;
  400.  
  401. case 11: ///FARM
  402. cout << "An abandoned farm is near. \n -Prey food (type 'preyf') \n -Prey water (type 'preyw) \n -Proceed \n";
  403. cin >> choice;
  404. cout << "\n";
  405. repeat = false;
  406. if ( choice == "preyf" ) {
  407. food += rand() % 30 + 15;
  408. water -= rand() % 20;
  409. day += 1;
  410. infected = rand() % 2;
  411. }
  412.  
  413. if ( choice == "preyw" ) {
  414. water += rand() % 30 + 20;
  415. food -= rand() % 20;
  416. infected = rand() % 2;
  417. day += 1;
  418. }
  419.  
  420. if ( choice == "proceed" ) {
  421. water -= rand() % 20;
  422. food -= rand() % 20;
  423. day += 1;
  424. }
  425. if ( choice == "stats" ) {
  426. cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
  427. }
  428. break;
  429.  
  430. case 12: ///CITADEL
  431. 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";
  432. cin >> choice;
  433. cout << "\n";
  434. repeat = false;
  435. if ( choice == "refuge" ) {
  436. food -= rand() % 20;
  437. water -= rand() % 20;
  438. health += 10;
  439. day += 2;
  440. }
  441.  
  442. if ( choice == "search" ) {
  443. water += rand() % 30;
  444. food += rand() % 30;
  445. health -= rand() % 50 + 35;
  446. day += 1;
  447. }
  448.  
  449. if ( choice == "rob" ) {
  450. water -= rand() % 20;
  451. food -= rand() % 20;
  452. health -= 40;
  453. money += rand() % 50 + 30;
  454. day += 1;
  455. }
  456.  
  457. if ( choice == "avoid" ) {
  458. water -= rand() % 20;
  459. food -= rand() % 20;
  460. day += 1;
  461. }
  462. if ( choice == "stats" ) {
  463. cout << "PLAYER NAME: " << name << " DIFFICULTY: " << difficulty << "\n" << "TOTAL SCORE: " << score << " DAYS SURVIVED: " << day << "\n" << "INFECTED: " << infected << "\n";
  464. }
  465. break;
  466. }
  467. if ( health == 0 ) {
  468. cout << "\n" << "YOU DIED! YOU SURVIVED A TOTAL OF " << day << " DAYS. THANKS FOR PLAYING!" << " FINAL SCORE: " << score << "\n";
  469. cin.get();
  470. system("pause");
  471. return 0;
  472. }
  473. if ( infected == 1 && difficulty == "manly" ) {
  474. health -= 5;
  475. water -= 5;
  476. }
  477. if ( infected == 1 && difficulty == "canadian" ) {
  478. health -= 10;
  479. water -= 10;
  480. }
  481. if ( infected == 1 && difficulty == "very hard" ) {
  482. health -= 20;
  483. water -= 20;
  484. food -= 20;
  485. }
  486.  
  487. score += food+health/money;
  488. repeat = true;
  489. } while (repeat);
  490.  
  491.  
  492. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement