Advertisement
zhalpern

V6

Dec 12th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.60 KB | None | 0 0
  1. #include<iostream>
  2. #include <cstdio>
  3. using namespace std;
  4.  
  5. class Pirate {
  6. public:
  7. int health;
  8. int coin;
  9. int damage;
  10. Pirate() {
  11. health = 10;
  12. coin = 0;
  13. }
  14. void getHealth() {
  15. int input;
  16. char choice;
  17. cout << "Do you have a health pack? (y/n)" << endl;
  18. cin >> choice; {
  19. if (choice == 'y')
  20. cout << "What level is your health pack?" << endl;
  21. cin >> input; {
  22. if (input == 1) {
  23. if (health <= 90) {
  24. health = health + 10;
  25. cout << "Your health: " << health << endl;
  26. }
  27. }
  28. else {
  29. cout << "Cannot use health pack." << endl;
  30. }
  31. if (input == 2) {
  32. if (health <= 80) {
  33. health = health + 20;
  34. cout << "Your health: " << health << endl;
  35. }
  36. }
  37. else {
  38. cout << "Cannot use health pack." << endl;
  39. }
  40. if (input == 3) {
  41. if (health <= 50) {
  42. health = health + 50;
  43. cout << "Your health: " << health << endl;
  44. }
  45. }
  46. else {
  47. cout << "Cannot use health pack." << endl;
  48. }
  49. }
  50. }
  51. }
  52.  
  53. void damageImpactOne() {
  54. int input;
  55. cout << "Choose a number one through five, but choose carefully." << endl;
  56. cin >> input; {
  57. if (input == 1) {
  58. health = health - 20;
  59. cout << "Damage! Your new health: " << health << endl;
  60. }
  61. if (input == 2) {
  62. health = health - 0;
  63. cout << "Lucky Punk! No damage. Current health: " << health << endl;
  64. }
  65. if (input == 3) {
  66. health = health - 10;
  67. cout << "Damage! Your new health: " << health << endl;
  68. }
  69. if (input == 4) {
  70. health = health - 50;
  71. cout << "Damage! Your new health: " << health << endl;
  72. }
  73. if (input == 5) {
  74. cout << "Critical damage! You will not make it." << endl;
  75. }
  76. }
  77.  
  78. }
  79.  
  80. void damageImpactTwo() {
  81. int input;
  82. cout << "Choose a number one through five, but choose carefully." << endl;
  83. cin >> input; {
  84. if (input == 3) {
  85. health = health - 20;
  86. cout << "Damage! Your new health: " << health << endl;
  87. }
  88. if (input == 1) {
  89. health = health - 0;
  90. cout << "Lucky Punk! No damage. Current health: " << health << endl;
  91. }
  92. if (input == 2) {
  93. health = health - 10;
  94. cout << "Damage! Your new health: " << health << endl;
  95. }
  96. if (input == 5) {
  97. health = health - 50;
  98. cout << "Damage! Your new health: " << health << endl;
  99. }
  100. if (input == 4) {
  101. cout << "Critical damage! You will not make it." << endl;
  102. }
  103. }
  104. }
  105.  
  106. void findTreasure() {
  107. char O;
  108. cout << "Check this out. You have a chest. Let's see what's inside." << endl;
  109. cout << "Press 'O' to open the chest. Capitalize!" << endl;
  110. cin >> O;
  111. if (health <= 80) {
  112. health = health + 20;
  113. cout << "Your health: " << health << endl;
  114. }
  115. }
  116.  
  117. void findTreasureTwo() {
  118. char O;
  119. cout << "Check this out. You have a chest. Let's see what's inside." << endl;
  120. cout << "Press 'O' to open the chest. Capitalize!" << endl;
  121. cin >> O;
  122. if (health <= 50) {
  123. health = health + 50;
  124. cout << "Your health: " << health << endl;
  125. }
  126. }
  127.  
  128. void findExplosive() {
  129. cout << "Watch out!!!!" << endl;
  130. cout << "Boom." << endl;
  131. cout << "What did I just say? Your health has decreased. Great job!" << endl;
  132. health = health - 20;
  133. cout << "Health: " << health << endl;
  134. }
  135.  
  136. void findExplosiveTwo() {
  137. cout << "Uh oh." << endl;
  138. cout << "Pfft." << endl;
  139. health = health - 10;
  140. cout << "Think of it this way. You're not dead." << endl;
  141. cout << "Your health: " << health << endl;
  142. }
  143.  
  144. void advertisementPBP() {
  145. cout << "What's poppin?" << endl;
  146. cout << "Pirate's Booty! That's what's poppin!" << endl;
  147. cout << "Try our new Pirate's Booty Aged White Cheddar Popcorn....Available at your nearest convenience store." << endl;
  148. health = health + 10;
  149. cout << "Thanks for watching the ad, heres your last 10 health" << health << endl;
  150.  
  151. }
  152.  
  153. void advertisementMCD() {
  154. cout << "Feeling hungry? Try the McDonald's dollar menu! Now with lettuce!" << endl;
  155. cout << "Badabababa. I'm loving it!" << endl;
  156. }
  157.  
  158. void stopAds() {
  159. cout << "Would you like to stop ads?" << endl;
  160. cout << "Well, I'd love to help, but you bought a Pirated Game." << endl;
  161. cout << "LOL. Rest in peace." << endl;
  162. }
  163.  
  164. void cannonThreat() {
  165. char input, IDKTPSWD;
  166. cout << "Ahoy MATEy! Welcome to Australia! There are lots of cannon threats here. To make sure it's you, enter the password. (IDKTPSWD) " << endl;
  167. cin >> input;
  168. if (input == IDKTPSWD) {
  169. cout << "Great! Proceed to the red x in the cave." << endl;
  170. }
  171. }
  172.  
  173. void thePriceisRight() {
  174. int input;
  175. cout << "Welcome to the Price is Right! If you can guess within $2, you get a level 2 health pack!" << endl;
  176. cout << "Here, you can see a loaf of bread. Isn't that Wonderful? It is pre-sliced and picked up at the nearest supermarket. How much does this loaf of bread cost?" << endl;
  177. cin >> input;
  178. if (input <= 5 && input >= 2) {
  179. cout << "You now have a level 2 health pack! " << endl;
  180. }
  181. }
  182.  
  183. void attackOtherSwing() {
  184. char input, duck, swing;
  185. cout << "There is someone coming behind you! And he has a sword! Duck!" << endl;
  186. cin >> input;
  187. if (input == duck) {
  188. cout << "He missed! Swing your sword!" << endl;
  189. cin >> input;
  190. if (input == swing) {
  191. cout << "You killed him! Shame on you! You have recieved one coin." << endl;
  192. coin++;
  193. }
  194. }
  195. else {
  196. cout << "He hit you. -20 health." << endl;
  197. health = health - 20;
  198. cout << "Health: " << health << endl;
  199. }
  200. }
  201.  
  202. void cannonAttack() {
  203. float input, S;
  204. cout << "You're under attack! Someone is shooting you with their cannon!" << endl;
  205. cout << "Boom!" << endl;
  206. health = health - 20;
  207. cout << "Health: " << health << endl;
  208. cout << "Shoot your cannon! Type S for shoot!" << endl;
  209. cin >> input;
  210. if (input == S) {
  211. cout << "You won! The enemy is destroyed!" << endl;
  212. cout << "You have recieved one coin!" << endl;
  213. coin++;
  214. }
  215. else {
  216. cout << "You've been hit! Critical damage!" << endl;
  217. health = health / 2;
  218. cout << "Health:" << health << endl;
  219. getHealth();
  220.  
  221. }
  222. }
  223.  
  224. void printCredits() {
  225. float input;
  226. float p, c;
  227. cout << "Ahoy! Press p to play the game. Press c to see the credits!" << endl;
  228. cin >> input;
  229. if (input == p) {
  230. cout << "Welcome to the Pirated Game!" << endl;
  231. }
  232. if (input == c) {
  233. cout << "Built by: Benjamin Parma and Zachary Halpern. Gotta give us credit!" << endl;
  234. }
  235.  
  236. }
  237.  
  238. void encounterEnemy() {
  239. char input;
  240. float L, F;
  241. float hisHealth;
  242. hisHealth = 100;
  243. cout << "You've encountered another ship! Press L to load your cannon!" << endl;
  244. cin >> input;
  245.  
  246.  
  247. if (input = 'L') {
  248. cout << "Cannon loaded! Press F to fire." << endl;
  249.  
  250. cin >> input;
  251.  
  252. if (input = 'F') {
  253. hisHealth = hisHealth - 100;
  254. cout << "His ship was hit! His health: " << hisHealth << endl;
  255. }
  256. else {
  257. health = health - 20;
  258. cout << "You've been hit! Your health: " << health << endl;
  259. }
  260. }
  261. else {
  262. health = health - 20;
  263. cout << "Too slow! You've been hit! Health: " << health << endl;
  264. }
  265.  
  266. if (hisHealth = 0)
  267. {
  268. cout << "congrats" << endl;
  269. cout << "you killed your fellow man" << endl;
  270. cout << "you have gained 10 coins for sinking his merchant ship" << endl;
  271. }
  272. }
  273.  
  274. void encounterHelp() {
  275. cout << "Captain! I found you some aid. These leaves are healing. Here, apply them to your wounds." << endl;
  276. if (health <= 80) {
  277. health = health + 20;
  278. cout << "Your health: " << health << endl;
  279. }
  280. else {
  281. cout << "You have recieved a level 2 health pack." << endl;
  282. }
  283. }
  284.  
  285. void encounterSink() {
  286. float input;
  287. cout << "Arrrg, Captain! The ship is sinking. We need to patch the hole!" << endl;
  288. cout << "Solve this problem to repair the ship! 12 X 4 = ? " << endl;
  289. cin >> input;
  290. if (input == 48) {
  291. cout << "The boat has been repaired! Great job!" << endl;
  292. }
  293. else {
  294. float input, plane, airplane, bb;
  295. cout << "You're starting to drown!" << endl;
  296. health = health - 10;
  297. cout << "Health: " << health << endl;
  298. cout << "Solve this riddle to save yourself! What has 4 wheels and flies?" << endl;
  299. cin >> input;
  300. if (input == plane || airplane) {
  301. cout << "You're saved!" << endl;
  302. }
  303. else {
  304. cout << "Crtitical damage!" << endl;
  305. health = health - 50;
  306. cout << "Health: " << health << endl;
  307. cout << "Solve this pattern. aabbaabbaabbaa__." << endl;
  308. cin >> input;
  309. if (input == bb) {
  310. cout << "You're saved!" << endl;
  311. }
  312. else {
  313. cout << "You have died." << endl;
  314. }
  315. }
  316.  
  317. }
  318. }
  319. void attackEnemy() {
  320. float L, F;
  321. float input;
  322. cout << "You've spotted an enemy! Press L to load!" << endl;
  323. cin >> input;
  324. if (input == L) {
  325. cout << "Loaded! Press F to fire!" << endl;
  326. cin >> input;
  327. if (input == F) {
  328. cout << "You killed the enemy! Great job. You've earned one coin." << endl;
  329. coin++;
  330. }
  331. else {
  332. cout << "He spotted you first!" << endl;
  333. cout << "Pow!" << endl;
  334. cout << "You've been hit." << endl;
  335. health = health - 20;
  336. cout << "Health: " << endl;
  337. cout << "Press F to fire!" << endl;
  338. cin >> input;
  339. if (input == F) {
  340. cout << "You killed the enemy! Great job. You've earned one coin." << endl;
  341. coin++;
  342. }
  343. }
  344. }
  345. else {
  346. cout << "I don't really know why you couldn't follow directions. Sorry, son. You're dead." << endl;
  347. }
  348. }
  349.  
  350. void storm() {
  351. float input, C;
  352. cout << "The Island Weather Service has issued a storm warning for this area. Take cover immediately." << endl;
  353. cout << "Press C for cover." << endl;
  354. cin >> input;
  355. if (input == C) {
  356. cout << "Great job! You avoided a tree falling on your face!" << endl;
  357. }
  358. else {
  359. cout << "Bet you didn't like that nail poking your eye out, did you? I told you to take cover." << endl;
  360. health = health - 10;
  361. cout << "Health: " << endl;
  362. cout << "Your incompetance is unbelievable." << endl;
  363. }
  364. }
  365.  
  366. void stormTwo() {
  367. float input, C;
  368. cout << "The Island Weather Service has issued a storm warning for this area. Take cover immediately." << endl;
  369. cout << "Press C for cover." << endl;
  370. cin >> input;
  371. if (input == C) {
  372. cout << "Great job! You avoided a tree falling on your face!" << endl;
  373. }
  374. else {
  375. cout << "Bet you didn't like that nail poking your eye out, did you? I told you to take cover." << endl;
  376. health = health - 20;
  377. cout << "Health: " << endl;
  378. cout << "Your incompetance is unbelievable." << endl;
  379. }
  380. }
  381.  
  382. void enterCave() {
  383. float input, W;
  384. cout << "You've entered a cave." << endl;
  385. cout << "Watch out! There are bats nearby!" << endl;
  386. cout << "Press W to swat them off." << endl;
  387. cin >> input;
  388. if (input == W) {
  389. cout << "Congratulations! You swatted off the bats." << endl;
  390. cout << "You have recieved one coin." << endl;
  391. coin++;
  392. }
  393. else {
  394. cout << "The bats got you." << endl;
  395. health = health - 10;
  396. cout << "Your health is depreciating. Press W to swat off the bats before its too late! Health: " << health << endl;
  397. cin >> input;
  398. if (input == W) {
  399. cout << "You have swatted off the bats! Good job, but you have lost a little bit of health due to the delay. Health: " << health << endl;
  400. }
  401. else {
  402. cout << "The bats got to you. They didn't even bat an eye. You have died." << endl;
  403. }
  404. }
  405. }
  406.  
  407. void rollingBarrel() {
  408. char choice;
  409. float J, S, input;
  410. cout << "Aye! You have made it to the final challenge: the rolling barrel. Jump when I say jump, and squat when I say squat. If you don't you will be squat." << endl;
  411. cout << "Are you ready? (y/n)" << endl;
  412. if (choice == 'y') {
  413. cout << "Here comes the first barrel! Jump! (Press J for jump.)" << endl;
  414. cin >> input;
  415. if (input == J) {
  416. cout << "First barrel avoided." << endl;
  417. cout << "Here comes another! Watch out! (Press S for squat." << endl;
  418. cin >> input;
  419.  
  420. if (input == S) {
  421. cout << "Here comes a barrel! Jump! (Press J for jump.)" << endl;
  422. cin >> input;
  423.  
  424. if (input == J) {
  425. cout << "Barrel avoided." << endl;
  426. cout << "Here comes another! Watch out! (Press S for squat." << endl;
  427. cin >> input;
  428. }
  429. }
  430. }
  431. }
  432. else {
  433. health = health - 20;
  434. cout << " Damage! Health: " << health << endl;
  435. cout << "You lost a game. Nice job!" << endl;
  436. }
  437. }
  438. void yourDeath() {
  439. cout << "You have died. All your coins have been lost." << endl;
  440. }
  441.  
  442. void initialHealthPack() {
  443. health = health + 80;
  444. cout << "You're at full health! Health: " << health << endl;
  445. }
  446. void shipfight() {
  447. char input, S;
  448. cout << "You board a ship but unknowingly board with an enemy." << endl;
  449. cout << "You two see each other and want to engage in a fight." << endl;
  450. cout << "Press S to swing your sword." << endl;
  451. cin >> input;
  452. if (input == 'S') {
  453. cout << "The enemy's head was cut off. Great job. You've earned one coin." << endl;
  454. coin++;
  455. }
  456. }
  457. void swordfight() {
  458. char input, S;
  459. cout << "Press S to swing your sword." << endl;
  460. cin >> input;
  461. if (input == 'S') {
  462. cout << "The enemy's head was cut off. Great job. You've earned one coin." << endl;
  463. coin++;
  464. }
  465. }
  466.  
  467. void retirement() {
  468. char choice;
  469. char A, B;
  470. cout << "The road ahead is long and dangerous" << endl;
  471. cout << "You can go ahead and: " << endl;
  472. cout << "(A) retire, and live a peaceful life " << endl;
  473. cout << "Or (B) continue on" << endl;
  474. cin >> choice;
  475. if (choice == 'A') {
  476. cout << "You live out your days as celebrated individual in your town" << endl;
  477. cout << "Kids come to your house and ask to hear your stories about being a pirate " << endl;
  478. cout << "thanks for playing!" << endl;
  479. }
  480. else if (choice == 'B') {
  481. cout << "your greed outweights everything else." << endl;
  482. cout << " you decide to continue on your journey." << endl;
  483. }
  484. }
  485. };
  486.  
  487.  
  488. int main() {
  489. Pirate var;
  490. char choice, n;
  491. cout << "Hello!" << endl;
  492. cout << "Welcome to: The pirated game" << endl;
  493. cout << "Would you like to play? (y/n)" << endl;
  494. cin >> choice;
  495. if (choice == 'n') {
  496. cout << "Alright, thanks for your time" << endl;
  497. return 0;
  498. }
  499. else
  500. {
  501. cout << "Great, get ready for an amazing story line" << endl;
  502. }
  503. cout << "You are Captain Landlubber, the most feared man on the seven seas" << endl;
  504.  
  505. cout << "You have sunk every single ship sent out after you, pillaged almost every village on every coastline in the world" << endl;
  506. cout << "Your age is unknown, and so is your backstory" << endl;
  507. cout << "The only thing you know how to do is be a pirate, and your are the best at it" << endl;
  508. cout << "You slowly come back to conciousness, you see the chaos around you" << endl;
  509. cout << "The battle commences around you in the village square" << endl;
  510. cout << "You notice the wounds on your body, and realize you are bleeding out" << endl;
  511. cout << "As you look around, you notice that one of your fallen shipmates has dropped a healthpack" << endl;
  512. cout << "Do you: " << endl;
  513. cout << "A. Crawl " << endl;
  514. cout << "B. Give up and die" << endl;
  515. cin >> choice;
  516.  
  517. if (choice == 'B') {
  518. var.yourDeath();
  519.  
  520. }
  521. else if (choice == 'A') {
  522. cout << "You begin to crawl towards the health pack" << endl;
  523. cout << "after several minutes of agonizing pain, you reach the health pack" << endl;
  524. var.initialHealthPack();
  525.  
  526. cout << "After using the health pack, you slowly feel better" << endl;
  527. cout << "You notice your health bar is going from 10 to 90" << endl;
  528. cout << "In order to get the last 10 health, you must watch an ad for pirates booty" << endl;
  529. cout << "Do you wish to see the ad? Pick carefully now. (y/n)" << endl;
  530. cin >> choice;
  531. if (choice == 'n')
  532. {
  533. cout << "wow look at you, thinking you dont have to pay to play this game" << endl;
  534. cout << "Youve now automatically lost the game, you penny pincher" << endl;
  535. var.yourDeath();
  536. }
  537. else {
  538. cout << "thank you for choosing to watch the ad from our sponsors " << endl;
  539. cout << "the ad which will play is from our friends at Pirates booty" << endl;
  540. var.advertisementPBP();
  541.  
  542.  
  543. cout << "After healing up do you:" << endl;
  544. cout << "A. Continue Fighting" << endl;
  545. cout << "B. Return to your ship" << endl;
  546. cin >> choice;
  547. if (choice == 'A') {
  548. cout << "You decide to keep fighting on" << endl;
  549. cout << "You soon encounter an enemy pirate" << endl;
  550. cout << "Using your sword, you engage the enemy" << endl;
  551. var.swordfight();
  552. cout << "You eventually decide to return to yourship, as youve lost too many crew members" << endl;
  553.  
  554. }
  555. else {
  556. cout << "You flee the battlefield with what remains of your crew" << endl;
  557. var.shipfight();
  558. }
  559.  
  560. cout << "You and your crew quickly set sail away from the battlefield" << endl;
  561. cout << "Hoping to forget your first defeat, you decide to do something you know you are good at." << endl;
  562. cout << "You scan the horizon for ships to pillage" << endl;
  563. cout << "Days pass by before you finnaly find a ship that you can engage" << endl;
  564. cout << "Your crew quickly mussers to battlestations, ready to finnally taste victory" << endl;
  565. cout << "Do you:" << endl;
  566. cout << "A. Enage?" << endl;
  567. cout << "B. Run away and dissapoint your crew?" << endl;
  568. cin >> choice;
  569.  
  570.  
  571.  
  572. if (choice == 'B') {
  573. cout << "Coward!" << endl;
  574. cout << "Your crew thinks of you the same way!" << endl;
  575. cout << "They have decided to mutiny against a terrible leader!" << endl;
  576. cout << "You are lowerd into one of the lifeboats and set adrift without any provisions." << endl;
  577. cout << "You are never heard from again." << endl;
  578. var.yourDeath();
  579. }
  580. else {
  581. cout << "congrats you arent a coward" << endl;
  582. var.encounterEnemy();
  583.  
  584.  
  585. cout << "To continue playing, please listen to another ad (y/n)" << endl;
  586. cin >> choice;
  587.  
  588. if (choice == 'n') {
  589. cout << "wow look at you, thinking you dont have to pay to play this game" << endl;
  590. cout << "Youve now automatically lost the game, you penny pincher" << endl;
  591. var.yourDeath();
  592. }
  593. else if (choice == 'y'){
  594. cout << "thank you for choosing to watch the ad from our sponsor again " << endl;
  595. cout << "the ad which will play is from our friends at Mcdonalds" << endl;
  596. var.advertisementMCD();
  597.  
  598.  
  599. cout << "you watch the enemy ship sink" << endl;
  600. cout << "now that the enemy ship has sunk, you can continue on your way to finding the treasure. " << endl;
  601. cout << "You stop in port, taking on supplies and replacement crew members" << endl;
  602. cout << "A wiseman stops you and tells you that: " << endl;
  603. var.retirement();
  604.  
  605.  
  606. system("pause");
  607. }
  608. }
  609. }
  610. }
  611. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement