Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication6.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <stdlib.h>
- #include <string>
- #include <stdio.h> /* printf, NULL */
- #include <stdlib.h> /* srand, rand */
- #include <time.h> /* time */
- using namespace std;
- int main() {
- string confirmBattle;
- string itemOne;
- string itemTwo;
- string name;
- double humanHealth = 60.00;
- double dragonHealth = 100.00;
- double hitRand;
- string ropesyn;
- srand(time(NULL));
- cout << "Welcome to Dragon Hunter. Press enter your name. \n \n";
- cin >> name;
- cout << "\nNarrator: The captain approaches. \n \n";
- cout << "Captain: A dragon has attacked our village. You have a moral obligation to go " << endl << "out and defend your citizens.Grab your weapons, and battle! You can do it, " << name << "." << endl << "\nDo you understand ? (yes or no)" << endl;
- cin >> confirmBattle;
- if (confirmBattle == "yes")
- {
- cout << "\nCaptain: Glad to hear, "<< name << " ." << "Here's a sword and a shield. Gather any other \nweapons you need from the barracks.\n" << endl << "You nod your head in approval.\n ";
- cout << "\nNarrator: You go to the barracks and you have space in your bag to take two \nother items.\n\nYou see a set of ropes, a helmet, and a two - handed longsword. Pick your first item, then your second. \n" << endl;
- cin >> itemOne;
- cin >> itemTwo;
- cout << "\nInteresting choices, " << itemOne << " and " << itemTwo << ".\n\n";
- cout << "Narrator: You run on the field. You notice most of the men have fled the field, but you refuse to do the same.\n\n" << endl;
- cout << "Dragon: ARRRRRRRRRRRRRRRRRGHHH! *spits fire directly at your face*\n\n" << endl;
- if (itemOne == "helmet" || itemTwo == "helmet")
- {
- cout << "Your helmet came to your support, and you only took minor damage \n\n" << endl;
- humanHealth -= 5;
- }
- else
- {
- cout << "Narrator: You took major damage, but fortunately the dragon missed a majority of his illuminated fire-breath. You now wish you took the helmet for aid.\n\n" << endl;
- humanHealth -= 20;
- }
- cout << "Narrator: Time to begin your fight. You take out your sword the captain handed you and begin fighting. \n\nBe aware: anytime you have an unsuccessful hit, the dragon will hit you.\n\n";
- do {
- hitRand = ("Random number: %d\n", rand() % 100);
- if (85 >= hitRand >= 30) {
- cout << "You hit the dragon! He took some damage.\n\n" << endl;
- dragonHealth = dragonHealth - 20;
- }
- else if (hitRand > 85) {
- cout << "WOOO! Major hit on the dragon. You notice the dragon feels major pain.\n\n";
- dragonHealth = dragonHealth - 40;
- }
- else {
- cout << "Miserable move. You completely missed the dragon and he launched a successful counter that led to him giving you major damage.\n\n" << endl;
- humanHealth = humanHealth - 18;
- }
- if (humanHealth < 30 && itemOne != "helmet" && itemOne != " two-handed longsword" && itemTwo != "two-handed longsword" && itemTwo != "helmet") {
- cout << "\nWould you like to use your ropes?\n\n";
- cin >> ropesyn;
- if (ropesyn == "yes") {
- cout << "Good choice. You made the dragon fall to the floor with a trap and gave it damage.\n\n";
- dragonHealth = dragonHealth - 25;
- }
- }
- else if (humanHealth < 30 && (itemOne == "two-handed longsword" || itemTwo == "two-handed longsword")) {
- cout << "\n Your sword broke. You are now using your longsword from the barracks and are dealing major damage.\n\n";
- dragonHealth = dragonHealth - 25;
- }
- if (humanHealth <= 0 || dragonHealth <= 0) {
- break;
- }
- } while (1);
- if (humanHealth <= 0)
- {
- cout << "You died. You were not the hero the village needed." << endl;
- }
- else if (dragonHealth <= 0)
- {
- cout << "\n\nYou won! The dragon has fallen to the floor, and the town rejoice. You have been given many accolades for your heroic actions.\n\n Job well done!" << endl;
- }
- }
- else if (confirmBattle == "no") {
- cout << "Your village's military could not defeat the dragon. Your village goes extinct.";
- cout << "By Alexander Tekle - 7/11/14";
- }
- getchar();
- int a;
- cin >> a;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement