Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- int main() {
- srand(time(NULL));
- int critChance = rand() % 20 + 1;
- int player = 0;
- int dragon = 0;
- int worm = 0;
- int attacking = 0;
- bool dead = false;
- bool restart = false;
- int health = 10;
- std::string attack1;
- std::string attack2;
- std::string attack3;
- //classes
- int knight = 1;
- int mage = 2;
- int brute = 3;
- int ismage = 0;
- int isknight = 0;
- int isbrute = 0;
- //knight attacks
- int slash = 0;
- int swing = 0;
- int stab = 0;
- //mage attacks
- int fireball = 0;
- int poison = 0;
- int lightning = 0;
- //brute attacks
- int maul = 0;
- int beat = 0;
- int clobber = 0;
- //dragon attacks
- int burn = 0;
- int torture = 0;
- int roast = 0;
- //worm attacks
- int suck = 0;
- int consume = 0;
- int bury = 0;
- //-----------------------------------------------
- //start story
- int answer1 = 0;
- int answer2 = 0;
- int answer3 = 0;
- int max = 0;
- dead = true;
- while (dead == true) {
- dead = false;
- std::cout << "==========================\nWelcome to the story!\n==========================\n";
- std::cout << "Here you will be given a quiz, which will select your class!\n";
- std::cout << "==========================";
- std::cout << "Q1) How do you prefer to handle situations?\n\n1. With Honor\n2. With Knowledge\n3. With Force\n";
- std::cin >> answer1;
- if (answer1 == 1) {
- isknight++;
- }
- else if (answer1 == 2) {
- ismage++;
- }
- else if (answer1 == 3) {
- isbrute++;
- }
- else {
- std::cout << "Invalid Answer\n";
- }
- //---------------------------------------------
- std::cout << "Q2) Which quality do you value most?\n\n1. strength\n2. honor\n3. wisdom\n";
- std::cin >> answer2;
- if (answer2 == 1) {
- isbrute++;
- }
- else if (answer2 == 2) {
- isknight++;
- }
- else if (answer2 == 3) {
- ismage++;
- }
- else {
- std::cout << "Invalid Answer\n";
- }
- //---------------------------------------------
- std::cout << "Q3) If you were being attacked by someone, what would you do?\n\n1. Freeze them with your ice spell\n2. honor your vows and parry them like a proper servant of the king\n3. beat them to death\n";
- std::cin >> answer3;
- if (answer3 == 1) {
- ismage++;
- }
- else if (answer3 == 2) {
- isknight++;
- }
- else if (answer3 == 3) {
- isbrute++;
- }
- else {
- std::cout << "Invalid Answer\n";
- }
- //---------------------------------------------
- std::string classtype;
- if (ismage > max) {
- max = ismage;
- classtype = "Mage";
- player = 2;
- }
- if (isbrute > max) {
- max = isbrute;
- classtype = "Brute";
- player = 3;
- }
- if (isknight > max) {
- max = isknight;
- classtype = "Knight";
- player = 1;
- }
- std::cout << "You have been assigned the class " << classtype << "! Good luck!\n";
- //STORYLINE
- //======================================================
- int beginn = 0;
- int begin = 0;
- while (begin == 0) {
- std::cout << "Ready to begin?\n1) yes\n2) no\n";
- std::cin >> beginn;
- begin = 1;
- if (beginn == 1) {
- std::cout << "Starting the story!\n";
- begin = 2;
- }
- else if (beginn == 2) {
- std::cout << "Ok! Tell us when you are ready!\n";
- begin = 0;
- }
- else {
- std::cout << "Invalid Option\n";
- begin = 0;
- }
- }
- while (begin == 2) {
- if (player == 2) {
- std::string ma1 = "fireball";
- std::string ma2 = "poison";
- std::string ma3 = "lightning";
- int returntodoor = 0;
- int gotobeginquest = 0;
- int mtcheck = 0;
- int answer4 = 0;
- int answer5 = 0;
- int answer6 = 0;
- begin = 3;
- std::cout << "'Ah, what a beautiful morning' you say, rising out of bed.\n";
- std::cout << "You open your book to where you left off last night.\n";
- std::cout << "Suddenly, you hear a knock at the door\n";
- returntodoor = 1;
- while (returntodoor == 1) {
- std::cout << "Go to the door? (checkpoint)\n1. Yes\n2.No\n";
- std::cin >> answer4;
- returntodoor = 0;
- if (answer4 == 2) {
- std::cout << "You feel like going to the door would be for the better\n";
- returntodoor = 1;
- }
- if (answer4 == 1) {
- returntodoor = 0;
- std::cout << "You see a boy holding a newspaper standing at your door.\n";
- std::cout << "You take the newspaper and read it.\n";
- std::cout << "'UNKNOWN TERROR RAVAGING KINGDOM! Killer expected to receive opulent reward.'\n";
- std::cout << "The mentioned lucrative reward intrigues you.\n";
- std::cout << "You decide to speak to the sheriff. He probably knows something.\n";
- while (gotobeginquest == 0) {
- std::cout << "Speak to the sheriff?\n1. yes\n2. no\n";
- std::cin >> answer5;
- gotobeginquest = 1;
- if (answer5 == 2) {
- std::cout << "You go back to bed. The Kingdom is obliterated by a powerful beast. You die.\n";
- returntodoor = 1;
- }
- else if (answer5 == 1) {
- dead = false;
- std::cout << "You visit the sheriff. He instructs you to go through the mountains to find your foe.\n";
- std::cout << "Head to the mountains?\n1) yes\n2) no\n";
- std::cin >> answer6;
- if (answer6 == 2) {
- std::cout << "You decide today is a lazy day, and go back to bed. The Kingdom is ravaged by a ferocious beast. You die.\n";
- returntodoor = 1;
- }
- else if (answer6 == 1) {
- int answer7 = 0;
- dead = false;
- returntodoor = 0;
- std::cout << "In the height of the mountains, you see some fur poking out from behind a rock.\n";
- std::cout << "Investigate?\n1) Yes\n2) No\n";
- std::cin >> answer7;
- if (answer7 == 2) {
- std::cout << "You turn your back, and are mauled by a crazy wolf. You die.\n";
- returntodoor = 1;
- }
- else if (answer7 == 1) {
- int answer8 = 0;
- std::cout << "A crazed Wolf jumps out at you!\n\n1) attack\n2) bargain\n3) run";
- std::cin >> answer8;
- if (answer8 == 3) {
- std::cout << "You run.\n";
- returntodoor = 1;
- }
- else if (answer8 == 2) {
- int gotocave = 0;
- std::cout << "You bargain with the wolf.\n\nYou agree to go through a cave instead of disrupting the wolves.";
- gotocave = 1;
- }
- else if (answer8 == 1) {
- int usedattack = 0;
- int enemyhealth = 10;
- int playerhealth = 10;
- int a1dmg = 0;
- int a3dmg = 0;
- int a2dmg = 0;
- int iscrit = 0;
- int attackloop = 0;
- int enemydead1 = 0;
- std::cout << "Battle!\n\n";
- attackloop = 1;
- while (attackloop = 1) {
- attackloop = 0;
- std::cout << "Select your attack:\n" << "1) " << ma1 << "\n2) " << ma2 << "\n3) " << ma3 << "\n";
- std::cin >> usedattack;
- if (usedattack == 1) {
- std::cout << "Used fireball!\n";
- a1dmg = rand() % 9 + 1;
- iscrit = rand() % 5 + 1;
- if (iscrit == 3) {
- std::cout << "Critical hit! Damage doubled!\n";
- enemyhealth = enemyhealth - a1dmg * 2;
- iscrit == 0;
- if (enemyhealth == 0) {
- std::cout << "Your enemy is dead!";
- usedattack = 0;
- enemydead1 = 1;
- }
- else {
- if (enemyhealth != 0)
- std::cout << "Your enemy is on " << enemyhealth << " health.";
- usedattack = 0;
- attackloop = 1;
- }
- }
- else {
- enemyhealth = enemyhealth - a1dmg;
- if (enemyhealth == 0) {
- std::cout << "Your enemy is dead!";
- usedattack = 0;
- enemydead1 = 1;
- }
- else if (enemyhealth != 0) {
- std::cout << "Your enemy is on " << enemyhealth << " health.";
- usedattack = 0;
- attackloop = 1;
- }
- else {
- std::cout << "Your enemy is dead!";
- usedattack = 0;
- enemydead1 = 1;
- attackloop = 0;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment