Advertisement
Guest User

SodaSipper

a guest
May 7th, 2013
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 13.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <string>
  4. #include <time.h>
  5. #include <stdlib.h>
  6.  
  7. using namespace std;
  8.  
  9. int PHealth;
  10. int sodaConsumed = 0;
  11. bool suitFound = false;
  12. bool canFound = false;
  13.  
  14. //FUNCTIONS
  15.  
  16. void preGame();
  17. void emptySoda();
  18. void sodaSearch();
  19. void sodaDrink();
  20. void monsterFight();
  21. void endGame();
  22.  
  23. //THIS IS THE SOUND THAT PLAYS UPON VARIOUS THINGS OCCURING
  24.  
  25. void actionSound(){
  26.  
  27.     Beep(400,100); Beep(500,500);
  28. }
  29.  
  30. //THIS IS THE TUTORIAL AND WHAT-NOT
  31.  
  32. int main(){
  33.  
  34.     srand(time(0));
  35.  
  36.     string inputM;
  37.  
  38.     cout << "Welcome to Soda Sipper 1.0!\n\n"; Sleep(2000);
  39.     cout << "Type 'help' for some basic info, or type 'begin' to start the game!" << endl;
  40.  
  41.     while(true){
  42.  
  43.         cin >> inputM;
  44.  
  45.         if(inputM == "help"){
  46.  
  47.             cout << "Type 'sip' to drink from your soda!\nType 'punch' to punch monsters!\nType 'search' to search for more sodas!\n\n"; Sleep(4000);
  48.             cout << "Drinking an entire soda will restore your health!\nDrink all five sodas to win the game!\n(NOTE): Type all commands in lowercase!\n\n"; Sleep(2500); system("Pause");
  49.             cout << endl; Sleep(3000);
  50.             preGame();
  51.         }
  52.  
  53.         else if(inputM == "begin"){
  54.  
  55.             preGame();
  56.         }
  57.  
  58.         else{
  59.  
  60.             cout << "Wha? Say that again, young man?\n";
  61.         }
  62.     }
  63. }
  64.  
  65. //THIS IS THE PREGAME. IT JUST SERVES TO GIVE SOME BACKSTORY
  66.  
  67. void preGame(){
  68.  
  69.     string inputPG;
  70.  
  71.     cout << "\nIt all began on a seemingly normal day... just before tragedy struck.\n\n"; Sleep(3000);
  72.     cout << "Me: \"Ah! I do enjoy a refreshing soda on such a hot day!\"\n"; Sleep(3000);
  73.     cout << "Me: \"In fact, I think I'll take a SIP of my soda right now!\"" << endl;
  74.  
  75.     while(true){
  76.  
  77.         cin >> inputPG;
  78.  
  79.         if(inputPG=="sip"){
  80.  
  81.             actionSound();
  82.             emptySoda();
  83.         }
  84.  
  85.         else{
  86.  
  87.             cout << "Me: \"Ow! I hit my ear by mistake! Better try again!\"\n";
  88.         }
  89.     }
  90. }
  91.  
  92. //THIS IS WHAT RUNS WHEN THE USER SIPS ALL OF HIS SODA
  93.  
  94. void emptySoda(){
  95.  
  96.     //THIS RESETS THE USERS HEALTH AND CHECKS IF HE HAS DRUNKEN THE GOLDEN SODA
  97.  
  98.     if(canFound == true){
  99.  
  100.         PHealth = 15;
  101.     }
  102.  
  103.     else{
  104.  
  105.         PHealth = 10;
  106.     }
  107.  
  108.     string inputES;
  109.  
  110.     cout << "Me: \"Ah! How refreshing!\"\n"; Sleep(3000);
  111.     cout << "Me: \"Huh?\"\n";Sleep(2000);
  112.     cout << "Me: \"Oh no, my soda's empty! I need SEARCH for more soda pronto!\"\n"; Sleep (2000);
  113.  
  114.     while(true){
  115.  
  116.         cin >> inputES;
  117.  
  118.         if(inputES == "search"){
  119.  
  120.             sodaSearch();
  121.         }
  122.  
  123.         else{
  124.  
  125.             cout << "Me: \"I have no time to do that! I need more soda!\"\n";
  126.         }
  127.     }
  128. }
  129.  
  130. //THIS IS WHAT RUNS WHEN THE USER SEARCHES FOR MORE SODAS. MOST OF THE TIME WACKY THINGS HAPPEN!
  131.  
  132. void sodaSearch(){
  133.  
  134.     while(true){
  135.  
  136.         int randomEvent = rand() % 12 + 1;
  137.         string inputSS;
  138.  
  139.         switch(randomEvent){
  140.  
  141.             case 1:
  142.                 cout << "You see a man on a dock drinking a soda.\n"; Sleep(3000);
  143.                 cout << "Me: \"Give me that soda!\"\n"; Sleep(3000);
  144.                 cout << "Dirty-No-Good-Soda-Hoarder: \"Huh?\"\n"; Sleep(3000);
  145.                 cout << "Me: \"You asked for it!\"\n"; Sleep(3000);
  146.                 cout << "*PUNCHED!*\n"; actionSound(); Sleep(3000);
  147.                 cout << "Soda acquired!\n"; Sleep(3000);
  148.                 sodaDrink();
  149.                 break;
  150.  
  151.             case 2:
  152.                 cout << "You see an old woman standing outside a gas station.\n"; Sleep(3000);
  153.                 cout << "Me: \"Hey, old lady!\"\n"; Sleep(3000);
  154.                 cout << "Cheap-Old-Hag: \"Can I help you sonny?\"\n"; Sleep(3000);
  155.                 cout << "Me: \"Go buy me a soda from that store!\"\n"; Sleep(3000);
  156.                 cout << "Cheap-Old-Hag: \"Oh my. I'd love to, but I need this money to get home!\"\n"; Sleep(3000);
  157.                 cout << "Me: \"You need to get your priorities straight, lady!\"\n"; Sleep(3000);
  158.                 cout << "*TRIPPED!*\n"; actionSound(); Sleep(3000);
  159.                 cout << "Soda acquired!\n"; Sleep(3000);
  160.                 sodaDrink();
  161.                 break;
  162.  
  163.             case 3:
  164.                 cout << "You see a little boy drinking a soda.\n"; Sleep(3000);
  165.                 cout << "Me: \"Give me that soda, you little creep!\"\n"; Sleep(3000);
  166.                 cout << "Creepy-Little-Boy: \"Okay.\"\n"; Sleep(3000);
  167.                 cout << "*OKAYED!*\n"; actionSound(); Sleep(3000);
  168.                 cout << "Soda acquired!\n"; Sleep(3000);
  169.                 sodaDrink();
  170.                 break;
  171.  
  172.             case 4:
  173.                 cout << "You see a vending machine on the side of a road.\n"; Sleep(3000);
  174.                 cout << "Me: \"Give me one of your delicious sodas, metal monstrocity!\"\n"; Sleep(3000);
  175.                 cout << "Tightwad-Machine: \"PLEASE INSERT ONE DOLLAR USD\"\n"; Sleep(3000);
  176.                 cout << "Me: \"Do you take British Pounds?\"\n"; Sleep(3000);
  177.                 cout << "*POUNDED!*\n"; actionSound(); Sleep(3000);
  178.                 cout << "Tightwad-Machine: \"ERROR! PLEASE INSERT ONE DOLLAR USD\"\n"; Sleep(3000);
  179.                 cout << "Me: \"LONG LIVE THE QUEEN!\"\n"; Sleep(3000);
  180.                 cout << "*TIPPED!*\n"; actionSound(); Sleep(3000);
  181.                 cout << "Soda acquired!\n"; Sleep(3000);
  182.                 sodaDrink();
  183.                 break;
  184.  
  185.             case 5:
  186.                 cout << "You see a superhero flying overhead.\n"; Sleep(3000);
  187.                 cout << "Me: \"Hey, I need help!\"\n"; Sleep(3000);
  188.                 cout << "Super-Chump: \"Is there a problem, citizen?\"\n"; Sleep(3000);
  189.                 cout << "Me: \"I need a soda pronto!\"\n"; Sleep(3000);
  190.                 cout << "Super-Chump: \"You disctracted me from my heroic efforts for a soda?\"\n"; Sleep(3000);
  191.                 cout << "Me: \"You don't understand! I need a soda or I'll DIE!\"\n"; Sleep(3000);
  192.                 cout << "Super-Chump: \"Egads! I'll never let Hypoglycemia Man take another life!\"\n"; Sleep(3000);
  193.                 cout << "*SAVED!*\n"; actionSound(); Sleep(3000);
  194.                 cout << "Soda acquired!\n"; Sleep(3000);
  195.                 sodaDrink();
  196.                 break;
  197.  
  198.             case 6:
  199.                 cout << "You see a soda in someone's home.\n"; Sleep(3000);
  200.                 cout << "Selfish-Whore: \"What are you doing in my home?!\"\n"; Sleep(3000);
  201.                 cout << "Me: \"You're house? Don't be selfish!\"\n"; Sleep(3000);
  202.                 cout << "*SLAPPED*\n"; actionSound(); Sleep(3000);
  203.                 cout << "Soda acquired!\n"; Sleep(3000);
  204.                 sodaDrink();
  205.                 break;
  206.  
  207.             case 7:
  208.                 cout << "You see a toddler holding a soda.\n"; Sleep(3000);
  209.                 cout << "Me: \"Hand over the soda!\"\n"; Sleep(3000);
  210.                 cout << "Bastard-Child: \"No!\"\n"; Sleep(3000);
  211.                 cout << "Me: \"Respect your elders!\"\n"; Sleep(3000);
  212.                 cout << "*PUNTED*\n"; actionSound(); Sleep(3000);
  213.                 cout << "Soda acquired!\n"; Sleep(3000);
  214.                 sodaDrink();
  215.                 break;
  216.  
  217.             case 8:
  218.                 cout << "You find a soda in a dumpster.\n"; Sleep(3000);
  219.                 cout << "*SCAVENGED!*\n"; actionSound(); Sleep(3000);
  220.                 cout << "Soda acquired!\n"; Sleep(3000);
  221.                 sodaDrink();
  222.                 break;
  223.  
  224.             case 9:
  225.                 cout << "You come across a magical genie's lamp.\n"; Sleep(3000);
  226.                 cout << "*RUBBED!*\n"; actionSound(); Sleep(3000);
  227.                 cout << "Smart-ass-Genie: \"What is it you desi-\"\n"; Sleep(500);
  228.                 cout << "Me: \"GIVE ME A SODA. NOW.\"\n"; Sleep(3000);
  229.                 cout << "Smart-ass-Genie: \"Umm... are you certai-\"\n"; Sleep(500);
  230.                 cout << "Me: \"I SAID NOW.\"\n"; Sleep(3000);
  231.                 cout << "*WISHED!*\n"; actionSound(); Sleep(3000);
  232.                 cout << "Soda acquired!\n"; Sleep(3000);
  233.                 sodaDrink();
  234.                 break;
  235.  
  236.             case 10:
  237.                 cout << "You come across a hobo sleeping near a soda.\n"; Sleep(3000);
  238.                 cout << "Me: \"Give me that soda!\"\n"; Sleep(3000);
  239.                 cout << "Filthy-No-Good-Hobo: *Snore*\n"; Sleep(3000);
  240.                 cout << "Me: \"Don't sass me!\"\n"; Sleep(3000);
  241.                 cout << "*SHANKED!*\n"; actionSound(); Sleep(3000);
  242.                 cout << "Soda acquired!\n"; Sleep(3000);
  243.                 sodaDrink();
  244.                 break;
  245.  
  246.             //THESE ARE THE SPECIAL ITEMS THE USER CAN FIND
  247.  
  248.             case 11:
  249.  
  250.                 if(suitFound == false){
  251.  
  252.                     suitFound = true;
  253.  
  254.                     cout << "You see an object gleaming in the distance...\n"; Sleep(3000);
  255.                     cout << "Me: \"Could it be? Are the legends true?...\"\n"; Sleep(3000);
  256.                     cout << "Me: \"Oh my Soda! It's real! The Suit of a Thousand Soda Cans!\"\n"; Sleep(3000);
  257.                     cout << "Soda Suit acquired! All damage negated by 1!\n"; actionSound(); Sleep(3000);
  258.                     cout << "Me: \"This is great, but I still need to SEARCH for more sodas.\"\n"; Sleep(3000);
  259.  
  260.                     cin >> inputSS;
  261.  
  262.                     if(inputSS == "search"){
  263.  
  264.                         sodaSearch();
  265.                     }
  266.  
  267.                     else{
  268.  
  269.                         cout << "Me: \"I have no time to do that! I need more soda!\"\n";
  270.                     }
  271.                 }
  272.  
  273.                 else{
  274.  
  275.                     sodaSearch();
  276.                 }
  277.  
  278.             case 12:
  279.  
  280.                 if(canFound == false){
  281.  
  282.                     canFound = true;
  283.  
  284.                     cout << "You see a shiny object in the distance.\n"; Sleep(3000);
  285.                     cout << "Me: \"Hmm? Ooh... OOOHHH! Is... is that possibly?...\"\n"; Sleep(3000);
  286.                     cout << "Me: \"It is! The Golden Soda of Armirae! I thought it was only a legend!\"\n"; Sleep(3000);
  287.                     cout << "Golden Soda acquired! Health increased by 5!\n"; actionSound(); Sleep(3000);
  288.                     sodaDrink();
  289.  
  290.                 }
  291.  
  292.                 else{
  293.  
  294.                     sodaSearch();
  295.                 }
  296.         }
  297.     }
  298. }
  299.  
  300. //THIS IS WHAT ALLOWS THE USER TO DRINK HIS SODA
  301.  
  302. void sodaDrink(){
  303.  
  304.     string inputSD;
  305.  
  306.     string coolSayings[10] = {"Delicious!","Tasty!","Orgasmic!","Refreshing!","Cool!","Super!","Mmmm!","Oh yes!","Oh God, yes!","Perfect!"};
  307.     cout << "Me: \"Gee, I sure can't wait to SIP on this soda!\"\n"; Sleep(3000);
  308.  
  309.     for(int sipCounter = 0; sipCounter < 10; sipCounter++){
  310.  
  311.         while(true){
  312.  
  313.             //THIS CAUSES MONSTERS TO APPEAR WHILE YOU ENJOY YOUR SODA
  314.  
  315.             int randMonster = rand()%10;
  316.  
  317.             if(randMonster == 5){
  318.  
  319.                 monsterFight();
  320.             }
  321.  
  322.             else{
  323.  
  324.                 cin >> inputSD;
  325.  
  326.                 if(inputSD == "sip"){
  327.  
  328.                     cout << "Me: \"" << coolSayings[rand()% 10] << "\"" << endl; actionSound();
  329.                     break;
  330.                 }
  331.  
  332.                 else{
  333.  
  334.                     cout << "Me: \"I have no time for that! I need to drink my soda!\"\n";
  335.                 }
  336.             }
  337.         }
  338.     }
  339.  
  340.     //THIS COUNTS THE AMOUNT OF SODA THE USER HAS DRUNKEN(DRANK?)
  341.  
  342.     sodaConsumed++;
  343.  
  344.     if (sodaConsumed == 5){
  345.  
  346.         endGame();
  347.     }
  348.  
  349.     else{
  350.         emptySoda();
  351.     }
  352. }
  353.  
  354. //THIS IS THE COMBAT SIMULATOR
  355.  
  356. void monsterFight(){
  357.  
  358.     string inputMF;
  359.     int MHealth = 10;
  360.  
  361.     string attackSayings[6] = {"\"Take this!\"", "\"Taste justice!\"","\"Have at you!\"","\"Hiya!\"","\"Kapow!\"", "\"Take this, fiend!\""};
  362.     string attackS = attackSayings[rand() % 6];
  363.  
  364.     string enemyList[10] = {"Zombie", "Baby", "Bucket", "Cop", "Vampire", "Rock", "Car", "Mouse", "Dog", "Man"};
  365.     string enemy = enemyList[rand() % 10];
  366.  
  367.     Sleep(3000);
  368.  
  369.     cout << "Me: \"Egad! That " << enemy << " is coming straight at me!\"\n"; Sleep(3000);
  370.     cout << "Me: \"He's probably trying to sip on my delicious soda!\"\n"; Sleep(3000);
  371.     cout << "Me: \"I better PUNCH him before he gets the chance!\"\n"; Sleep(3000);
  372.  
  373.     while(true){
  374.  
  375.         int PDamage = rand() % 4 + 1;
  376.         int MDamage;
  377.  
  378.         //THIS CHECKS IF THE USER HAS FOUND THE SODA-SUIT
  379.  
  380.         if(suitFound == true){
  381.  
  382.             MDamage = rand() % 2;
  383.         }
  384.  
  385.         else{
  386.  
  387.             MDamage = rand() % 3;
  388.         }
  389.  
  390.         cin >> inputMF;
  391.  
  392.         if(inputMF == "punch"){
  393.  
  394.             cout << "Me: " << attackS; MHealth -= PDamage; Sleep(3000);
  395.             cout << "You hit " << enemy << " for " << PDamage << " damage!\n"; actionSound(); Sleep(3000);
  396.  
  397.             if(MHealth > 0){
  398.  
  399.                 PHealth -= MDamage;
  400.  
  401.                 cout << enemy << " hit you for " << MDamage << " damage!\n"; actionSound(); Sleep(3000);
  402.                 cout << "Me: \"You'll regret that!\"\n";
  403.  
  404.                 if(PHealth <= 0){
  405.  
  406.                     cout << enemy << " cheated and somehow managed to kill you.\n"; Sleep(3000);
  407.                     cout << "GAME OVER! YOU LOST!\n"; Sleep(3000);
  408.                     exit(EXIT_FAILURE);
  409.                 }
  410.             }
  411.  
  412.             else{
  413.  
  414.                 cout << enemy << " is dead! What a loser!\n"; Sleep(3000);
  415.                 cout << "Me: \"Woo! Glad that's over! Now, back to my soda!\"\n"; Sleep(3000);
  416.                 break;
  417.             }
  418.         }
  419.  
  420.         else{
  421.  
  422.             cout << "Me: \"I cant do that! I have to defend my soda!\"\n";
  423.         }
  424.     }
  425.  
  426.  
  427. }
  428.  
  429. //THIS IS THE END GAME
  430.  
  431. void endGame(){
  432.  
  433.     cout << "Me: \"Ah, my thirst is now quenched!\"\n"; Sleep(3000);
  434.     cout << "Me: \"Welp, off to work!\"\n"; Sleep(3000);
  435.     cout << "GAME OVER! YOU WIN!\n"; Sleep(3000);
  436.     exit(EXIT_FAILURE);
  437. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement