Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include <cstdio>
- using namespace std;
- class Pirate {
- public:
- int health;
- int coin;
- int damage;
- Pirate() {
- health = 10;
- coin = 0;
- }
- void getHealth() {
- int input;
- char choice;
- cout << "Do you have a health pack? (y/n)" << endl;
- cin >> choice; {
- if (choice == 'y')
- cout << "What level is your health pack?" << endl;
- cin >> input; {
- if (input == 1) {
- if (health <= 90) {
- health = health + 10;
- cout << "Your health: " << health << endl;
- }
- }
- else {
- cout << "Cannot use health pack." << endl;
- }
- if (input == 2) {
- if (health <= 80) {
- health = health + 20;
- cout << "Your health: " << health << endl;
- }
- }
- else {
- cout << "Cannot use health pack." << endl;
- }
- if (input == 3) {
- if (health <= 50) {
- health = health + 50;
- cout << "Your health: " << health << endl;
- }
- }
- else {
- cout << "Cannot use health pack." << endl;
- }
- }
- }
- }
- void damageImpactOne() {
- int input;
- cout << "Choose a number one through five, but choose carefully." << endl;
- cin >> input; {
- if (input == 1) {
- health = health - 20;
- cout << "Damage! Your new health: " << health << endl;
- }
- if (input == 2) {
- health = health - 0;
- cout << "Lucky Punk! No damage. Current health: " << health << endl;
- }
- if (input == 3) {
- health = health - 10;
- cout << "Damage! Your new health: " << health << endl;
- }
- if (input == 4) {
- health = health - 50;
- cout << "Damage! Your new health: " << health << endl;
- }
- if (input == 5) {
- cout << "Critical damage! You will not make it." << endl;
- }
- }
- }
- void damageImpactTwo() {
- int input;
- cout << "Choose a number one through five, but choose carefully." << endl;
- cin >> input; {
- if (input == 3) {
- health = health - 20;
- cout << "Damage! Your new health: " << health << endl;
- }
- if (input == 1) {
- health = health - 0;
- cout << "Lucky Punk! No damage. Current health: " << health << endl;
- }
- if (input == 2) {
- health = health - 10;
- cout << "Damage! Your new health: " << health << endl;
- }
- if (input == 5) {
- health = health - 50;
- cout << "Damage! Your new health: " << health << endl;
- }
- if (input == 4) {
- cout << "Critical damage! You will not make it." << endl;
- }
- }
- }
- void findTreasure() {
- char O;
- cout << "Check this out. You have a chest. Let's see what's inside." << endl;
- cout << "Press 'O' to open the chest. Capitalize!" << endl;
- cin >> O;
- if (health <= 80) {
- health = health + 20;
- cout << "Your health: " << health << endl;
- }
- }
- void findTreasureTwo() {
- char O;
- cout << "Check this out. You have a chest. Let's see what's inside." << endl;
- cout << "Press 'O' to open the chest. Capitalize!" << endl;
- cin >> O;
- if (health <= 50) {
- health = health + 50;
- cout << "Your health: " << health << endl;
- }
- }
- void findExplosive() {
- cout << "Watch out!!!!" << endl;
- cout << "Boom." << endl;
- cout << "What did I just say? Your health has decreased. Great job!" << endl;
- health = health - 20;
- cout << "Health: " << health << endl;
- }
- void findExplosiveTwo() {
- cout << "Uh oh." << endl;
- cout << "Pfft." << endl;
- health = health - 10;
- cout << "Think of it this way. You're not dead." << endl;
- cout << "Your health: " << health << endl;
- }
- void advertisementPBP() {
- cout << "What's poppin?" << endl;
- cout << "Pirate's Booty! That's what's poppin!" << endl;
- cout << "Try our new Pirate's Booty Aged White Cheddar Popcorn....Available at your nearest convenience store." << endl;
- health = health + 10;
- cout << "Thanks for watching the ad, heres your last 10 health" << health << endl;
- }
- void advertisementMCD() {
- cout << "Feeling hungry? Try the McDonald's dollar menu! Now with lettuce!" << endl;
- cout << "Badabababa. I'm loving it!" << endl;
- }
- void stopAds() {
- cout << "Would you like to stop ads?" << endl;
- cout << "Well, I'd love to help, but you bought a Pirated Game." << endl;
- cout << "LOL. Rest in peace." << endl;
- }
- void cannonThreat() {
- char input, IDKTPSWD;
- cout << "Ahoy MATEy! Welcome to Australia! There are lots of cannon threats here. To make sure it's you, enter the password. (IDKTPSWD) " << endl;
- cin >> input;
- if (input == IDKTPSWD) {
- cout << "Great! Proceed to the red x in the cave." << endl;
- }
- }
- void thePriceisRight() {
- int input;
- cout << "Welcome to the Price is Right! If you can guess within $2, you get a level 2 health pack!" << endl;
- 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;
- cin >> input;
- if (input <= 5 && input >= 2) {
- cout << "You now have a level 2 health pack! " << endl;
- }
- }
- void attackOtherSwing() {
- char input, duck, swing;
- cout << "There is someone coming behind you! And he has a sword! Duck!" << endl;
- cin >> input;
- if (input == duck) {
- cout << "He missed! Swing your sword!" << endl;
- cin >> input;
- if (input == swing) {
- cout << "You killed him! Shame on you! You have recieved one coin." << endl;
- coin++;
- }
- }
- else {
- cout << "He hit you. -20 health." << endl;
- health = health - 20;
- cout << "Health: " << health << endl;
- }
- }
- void cannonAttack() {
- float input, S;
- cout << "You're under attack! Someone is shooting you with their cannon!" << endl;
- cout << "Boom!" << endl;
- health = health - 20;
- cout << "Health: " << health << endl;
- cout << "Shoot your cannon! Type S for shoot!" << endl;
- cin >> input;
- if (input == S) {
- cout << "You won! The enemy is destroyed!" << endl;
- cout << "You have recieved one coin!" << endl;
- coin++;
- }
- else {
- cout << "You've been hit! Critical damage!" << endl;
- health = health / 2;
- cout << "Health:" << health << endl;
- getHealth();
- }
- }
- void printCredits() {
- float input;
- float p, c;
- cout << "Ahoy! Press p to play the game. Press c to see the credits!" << endl;
- cin >> input;
- if (input == p) {
- cout << "Welcome to the Pirated Game!" << endl;
- }
- if (input == c) {
- cout << "Built by: Benjamin Parma and Zachary Halpern. Gotta give us credit!" << endl;
- }
- }
- void encounterEnemy() {
- char input;
- float L, F;
- float hisHealth;
- hisHealth = 100;
- cout << "You've encountered another ship! Press L to load your cannon!" << endl;
- cin >> input;
- if (input = 'L') {
- cout << "Cannon loaded! Press F to fire." << endl;
- cin >> input;
- if (input = 'F') {
- hisHealth = hisHealth - 100;
- cout << "His ship was hit! His health: " << hisHealth << endl;
- }
- else {
- health = health - 20;
- cout << "You've been hit! Your health: " << health << endl;
- }
- }
- else {
- health = health - 20;
- cout << "Too slow! You've been hit! Health: " << health << endl;
- }
- if (hisHealth = 0)
- {
- cout << "congrats" << endl;
- cout << "you killed your fellow man" << endl;
- cout << "you have gained 10 coins for sinking his merchant ship" << endl;
- }
- }
- void encounterHelp() {
- cout << "Captain! I found you some aid. These leaves are healing. Here, apply them to your wounds." << endl;
- if (health <= 80) {
- health = health + 20;
- cout << "Your health: " << health << endl;
- }
- else {
- cout << "You have recieved a level 2 health pack." << endl;
- }
- }
- void encounterSink() {
- float input;
- cout << "Arrrg, Captain! The ship is sinking. We need to patch the hole!" << endl;
- cout << "Solve this problem to repair the ship! 12 X 4 = ? " << endl;
- cin >> input;
- if (input == 48) {
- cout << "The boat has been repaired! Great job!" << endl;
- }
- else {
- float input, plane, airplane, bb;
- cout << "You're starting to drown!" << endl;
- health = health - 10;
- cout << "Health: " << health << endl;
- cout << "Solve this riddle to save yourself! What has 4 wheels and flies?" << endl;
- cin >> input;
- if (input == plane || airplane) {
- cout << "You're saved!" << endl;
- }
- else {
- cout << "Crtitical damage!" << endl;
- health = health - 50;
- cout << "Health: " << health << endl;
- cout << "Solve this pattern. aabbaabbaabbaa__." << endl;
- cin >> input;
- if (input == bb) {
- cout << "You're saved!" << endl;
- }
- else {
- cout << "You have died." << endl;
- }
- }
- }
- }
- void attackEnemy() {
- float L, F;
- float input;
- cout << "You've spotted an enemy! Press L to load!" << endl;
- cin >> input;
- if (input == L) {
- cout << "Loaded! Press F to fire!" << endl;
- cin >> input;
- if (input == F) {
- cout << "You killed the enemy! Great job. You've earned one coin." << endl;
- coin++;
- }
- else {
- cout << "He spotted you first!" << endl;
- cout << "Pow!" << endl;
- cout << "You've been hit." << endl;
- health = health - 20;
- cout << "Health: " << endl;
- cout << "Press F to fire!" << endl;
- cin >> input;
- if (input == F) {
- cout << "You killed the enemy! Great job. You've earned one coin." << endl;
- coin++;
- }
- }
- }
- else {
- cout << "I don't really know why you couldn't follow directions. Sorry, son. You're dead." << endl;
- }
- }
- void storm() {
- float input, C;
- cout << "The Island Weather Service has issued a storm warning for this area. Take cover immediately." << endl;
- cout << "Press C for cover." << endl;
- cin >> input;
- if (input == C) {
- cout << "Great job! You avoided a tree falling on your face!" << endl;
- }
- else {
- cout << "Bet you didn't like that nail poking your eye out, did you? I told you to take cover." << endl;
- health = health - 10;
- cout << "Health: " << endl;
- cout << "Your incompetance is unbelievable." << endl;
- }
- }
- void stormTwo() {
- float input, C;
- cout << "The Island Weather Service has issued a storm warning for this area. Take cover immediately." << endl;
- cout << "Press C for cover." << endl;
- cin >> input;
- if (input == C) {
- cout << "Great job! You avoided a tree falling on your face!" << endl;
- }
- else {
- cout << "Bet you didn't like that nail poking your eye out, did you? I told you to take cover." << endl;
- health = health - 20;
- cout << "Health: " << endl;
- cout << "Your incompetance is unbelievable." << endl;
- }
- }
- void enterCave() {
- float input, W;
- cout << "You've entered a cave." << endl;
- cout << "Watch out! There are bats nearby!" << endl;
- cout << "Press W to swat them off." << endl;
- cin >> input;
- if (input == W) {
- cout << "Congratulations! You swatted off the bats." << endl;
- cout << "You have recieved one coin." << endl;
- coin++;
- }
- else {
- cout << "The bats got you." << endl;
- health = health - 10;
- cout << "Your health is depreciating. Press W to swat off the bats before its too late! Health: " << health << endl;
- cin >> input;
- if (input == W) {
- 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;
- }
- else {
- cout << "The bats got to you. They didn't even bat an eye. You have died." << endl;
- }
- }
- }
- void rollingBarrel() {
- char choice;
- float J, S, input;
- 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;
- cout << "Are you ready? (y/n)" << endl;
- if (choice == 'y') {
- cout << "Here comes the first barrel! Jump! (Press J for jump.)" << endl;
- cin >> input;
- if (input == J) {
- cout << "First barrel avoided." << endl;
- cout << "Here comes another! Watch out! (Press S for squat." << endl;
- cin >> input;
- if (input == S) {
- cout << "Here comes a barrel! Jump! (Press J for jump.)" << endl;
- cin >> input;
- if (input == J) {
- cout << "Barrel avoided." << endl;
- cout << "Here comes another! Watch out! (Press S for squat." << endl;
- cin >> input;
- }
- }
- }
- }
- else {
- health = health - 20;
- cout << " Damage! Health: " << health << endl;
- cout << "You lost a game. Nice job!" << endl;
- }
- }
- void yourDeath() {
- cout << "You have died. All your coins have been lost." << endl;
- }
- void initialHealthPack() {
- health = health + 80;
- cout << "You're at full health! Health: " << health << endl;
- }
- void shipfight() {
- char input, S;
- cout << "You board a ship but unknowingly board with an enemy." << endl;
- cout << "You two see each other and want to engage in a fight." << endl;
- cout << "Press S to swing your sword." << endl;
- cin >> input;
- if (input == 'S') {
- cout << "The enemy's head was cut off. Great job. You've earned one coin." << endl;
- coin++;
- }
- }
- void swordfight() {
- char input, S;
- cout << "Press S to swing your sword." << endl;
- cin >> input;
- if (input == 'S') {
- cout << "The enemy's head was cut off. Great job. You've earned one coin." << endl;
- coin++;
- }
- }
- void retirement() {
- char choice;
- char A, B;
- cout << "The road ahead is long and dangerous" << endl;
- cout << "You can go ahead and: " << endl;
- cout << "(A) retire, and live a peaceful life " << endl;
- cout << "Or (B) continue on" << endl;
- cin >> choice;
- if (choice == 'A') {
- cout << "You live out your days as celebrated individual in your town" << endl;
- cout << "Kids come to your house and ask to hear your stories about being a pirate " << endl;
- cout << "thanks for playing!" << endl;
- }
- else if (choice == 'B') {
- cout << "your greed outweights everything else." << endl;
- cout << " you decide to continue on your journey." << endl;
- }
- }
- };
- int main() {
- Pirate var;
- char choice, n;
- cout << "Hello!" << endl;
- cout << "Welcome to: The pirated game" << endl;
- cout << "Would you like to play? (y/n)" << endl;
- cin >> choice;
- if (choice == 'n') {
- cout << "Alright, thanks for your time" << endl;
- return 0;
- }
- else
- {
- cout << "Great, get ready for an amazing story line" << endl;
- }
- cout << "You are Captain Landlubber, the most feared man on the seven seas" << endl;
- cout << "You have sunk every single ship sent out after you, pillaged almost every village on every coastline in the world" << endl;
- cout << "Your age is unknown, and so is your backstory" << endl;
- cout << "The only thing you know how to do is be a pirate, and your are the best at it" << endl;
- cout << "You slowly come back to conciousness, you see the chaos around you" << endl;
- cout << "The battle commences around you in the village square" << endl;
- cout << "You notice the wounds on your body, and realize you are bleeding out" << endl;
- cout << "As you look around, you notice that one of your fallen shipmates has dropped a healthpack" << endl;
- cout << "Do you: " << endl;
- cout << "A. Crawl " << endl;
- cout << "B. Give up and die" << endl;
- cin >> choice;
- if (choice == 'B') {
- var.yourDeath();
- }
- else if (choice == 'A') {
- cout << "You begin to crawl towards the health pack" << endl;
- cout << "after several minutes of agonizing pain, you reach the health pack" << endl;
- var.initialHealthPack();
- cout << "After using the health pack, you slowly feel better" << endl;
- cout << "You notice your health bar is going from 10 to 90" << endl;
- cout << "In order to get the last 10 health, you must watch an ad for pirates booty" << endl;
- cout << "Do you wish to see the ad? Pick carefully now. (y/n)" << endl;
- cin >> choice;
- if (choice == 'n')
- {
- cout << "wow look at you, thinking you dont have to pay to play this game" << endl;
- cout << "Youve now automatically lost the game, you penny pincher" << endl;
- var.yourDeath();
- }
- else {
- cout << "thank you for choosing to watch the ad from our sponsors " << endl;
- cout << "the ad which will play is from our friends at Pirates booty" << endl;
- var.advertisementPBP();
- cout << "After healing up do you:" << endl;
- cout << "A. Continue Fighting" << endl;
- cout << "B. Return to your ship" << endl;
- cin >> choice;
- if (choice == 'A') {
- cout << "You decide to keep fighting on" << endl;
- cout << "You soon encounter an enemy pirate" << endl;
- cout << "Using your sword, you engage the enemy" << endl;
- var.swordfight();
- cout << "You eventually decide to return to yourship, as youve lost too many crew members" << endl;
- }
- else {
- cout << "You flee the battlefield with what remains of your crew" << endl;
- var.shipfight();
- }
- cout << "You and your crew quickly set sail away from the battlefield" << endl;
- cout << "Hoping to forget your first defeat, you decide to do something you know you are good at." << endl;
- cout << "You scan the horizon for ships to pillage" << endl;
- cout << "Days pass by before you finnaly find a ship that you can engage" << endl;
- cout << "Your crew quickly mussers to battlestations, ready to finnally taste victory" << endl;
- cout << "Do you:" << endl;
- cout << "A. Enage?" << endl;
- cout << "B. Run away and dissapoint your crew?" << endl;
- cin >> choice;
- if (choice == 'B') {
- cout << "Coward!" << endl;
- cout << "Your crew thinks of you the same way!" << endl;
- cout << "They have decided to mutiny against a terrible leader!" << endl;
- cout << "You are lowerd into one of the lifeboats and set adrift without any provisions." << endl;
- cout << "You are never heard from again." << endl;
- var.yourDeath();
- }
- else {
- cout << "congrats you arent a coward" << endl;
- var.encounterEnemy();
- cout << "To continue playing, please listen to another ad (y/n)" << endl;
- cin >> choice;
- if (choice == 'n') {
- cout << "wow look at you, thinking you dont have to pay to play this game" << endl;
- cout << "Youve now automatically lost the game, you penny pincher" << endl;
- var.yourDeath();
- }
- else if (choice == 'y'){
- cout << "thank you for choosing to watch the ad from our sponsor again " << endl;
- cout << "the ad which will play is from our friends at Mcdonalds" << endl;
- var.advertisementMCD();
- cout << "you watch the enemy ship sink" << endl;
- cout << "now that the enemy ship has sunk, you can continue on your way to finding the treasure. " << endl;
- cout << "You stop in port, taking on supplies and replacement crew members" << endl;
- cout << "A wiseman stops you and tells you that: " << endl;
- var.retirement();
- system("pause");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement