Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- #include <time.h>
- using namespace std;
- int health = 100;
- int ohealth = 100;
- int ans;
- int dmgTaken,dmgTakenn;
- bool life = true;
- int wonInRow = 0;
- bool goldenPowder = false;
- void slowPrint(unsigned long speed, const char *s) {
- int i = 0;
- while(s[i]!=0) {
- cout << s[i++];
- cout.flush();
- usleep(speed);
- }
- }
- int generateRand(){
- int a, b, c, lolrand;
- a = rand();
- lolrand = rand() %10 + 1;
- c = lolrand;
- return c;
- }
- int damageRand(){
- int a, b, c, lolrand;
- a = rand();
- lolrand = rand() %20 + 1;
- c = lolrand;
- return c;
- }
- int goldenRand(){
- int a, b, c, lolrand;
- a = rand();
- lolrand = rand() %10 + 5;
- c = lolrand;
- return c;
- }
- int testWon(){
- if (ohealth <1){
- system("clear");
- slowPrint(50000,"Congratulations! You have beat the game!\nI hope you enjoyed it!\nYour final health was: ");
- cout << health << "\n";
- slowPrint(50000,"You fought a good game, congratulations.\n");
- cout << "Press ENTER\n";
- cin.get();
- return 0;
- }
- }
- int testLose(){
- if (health <1){
- system("clear");
- slowPrint(50000,"You were shot down!\nYou must now restart :(\nYour enemy's final health was: ");
- cout << ohealth << "\n";
- slowPrint(50000,"See ya later, soldier\n");
- cout << "Press ENTER\n";
- cin.get();
- return 0;
- }
- }
- void q6(){
- }
- void q5(){
- testWon();
- testLose();
- system("clear");
- cout << "Health: " << health << endl;
- cout << "Enemy's health: " << ohealth << endl;
- if (wonInRow > 2){
- goldenPowder = true;
- system("clear");
- slowPrint(50000,"You got golden powder for your minnieball musket!\nYou attacks will now become 50% stronger!");
- cin.get();
- system("clear");
- }
- if (wonInRow <=2){
- goldenPowder = false;
- }
- cout << "Who were white southern democrats who wanted to regain power?" <<endl;
- cout << "1)Redeemers" <<endl;
- cout << "2)Red Shirts" <<endl;
- cout << "3)Scalawags" <<endl;
- cin >> ans;
- switch (ans){
- case 2:
- system("clear");
- slowPrint(50000,"You have taken damage!\n");
- dmgTakenn = damageRand();
- health = health - dmgTakenn;
- cout << "Damage taken: " << dmgTakenn << endl;
- wonInRow = 0;
- cin.get();
- cin.get();
- q5();
- break;
- case 3:
- system("clear");
- slowPrint(50000,"You have taken damage!\n");
- dmgTaken = damageRand();
- health = health - dmgTaken;
- cout << "Damage taken: " << dmgTaken << endl;
- wonInRow = 0;
- cin.get();
- cin.get();
- q5();
- break;
- case 1:
- system("clear");
- slowPrint(50000,"You have succeeded!\n");
- wonInRow++;
- if (goldenPowder == true){
- int dmg = goldenRand();
- ohealth = ohealth - dmg;
- if (dmg > 7){
- cout << "Critical hit!\n" << endl;
- }
- }
- if (goldenPowder == false){
- int dmg = generateRand();
- ohealth = ohealth - dmg;
- if (dmg > 7){
- cout << "Critical hit!\n" << endl;
- }
- }
- cout << "Health: " << health << endl;
- cout << "Enemy's health: " << ohealth << endl;
- cout << "\n\nPress ENTER to continue to the next question...\n" << endl;
- cin.get();
- cin.get();
- q6();
- break;
- }
- }
- void q4(){
- testWon();
- testLose();
- system("clear");
- cout << "Health: " << health << endl;
- cout << "Enemy's health: " << ohealth << endl;
- if (wonInRow > 2){
- goldenPowder = true;
- system("clear");
- slowPrint(50000,"You got golden powder for your minnieball musket!\nYou attacks will now become 50% stronger!");
- cin.get();
- system("clear");
- }
- if (wonInRow <=2){
- goldenPowder = false;
- }
- cout << "Who were white southern democrats who wanted to regain power?" <<endl;
- cout << "1)Redeemers" <<endl;
- cout << "2)Red Shirts" <<endl;
- cout << "3)Scalawags" <<endl;
- cin >> ans;
- switch (ans){
- case 2:
- system("clear");
- slowPrint(50000,"You have taken damage!\n");
- dmgTakenn = damageRand();
- health = health - dmgTakenn;
- cout << "Damage taken: " << dmgTakenn << endl;
- wonInRow = 0;
- cin.get();
- cin.get();
- q4();
- break;
- case 3:
- system("clear");
- slowPrint(50000,"You have taken damage!\n");
- dmgTaken = damageRand();
- health = health - dmgTaken;
- cout << "Damage taken: " << dmgTaken << endl;
- wonInRow = 0;
- cin.get();
- cin.get();
- q4();
- break;
- case 1:
- system("clear");
- slowPrint(50000,"You have succeeded!\n");
- wonInRow++;
- if (goldenPowder == true){
- int dmg = goldenRand();
- ohealth = ohealth - dmg;
- if (dmg > 7){
- cout << "Critical hit!\n" << endl;
- }
- }
- if (goldenPowder == false){
- int dmg = generateRand();
- ohealth = ohealth - dmg;
- if (dmg > 7){
- cout << "Critical hit!\n" << endl;
- }
- }
- cout << "Health: " << health << endl;
- cout << "Enemy's health: " << ohealth << endl;
- cout << "\n\nPress ENTER to continue to the next question...\n" << endl;
- cin.get();
- cin.get();
- q5();
- break;
- }
- }
- void q3(){
- testWon();
- testLose();
- system("clear");
- cout << "Health: " << health << endl;
- cout << "Enemy's health: " << ohealth << endl;
- if (wonInRow > 2){
- goldenPowder = true;
- system("clear");
- slowPrint(50000,"You got golden powder for your minnieball musket!\nYou attacks will now become 50% stronger!");
- cin.get();
- system("clear");
- }
- if (wonInRow <=2){
- goldenPowder = false;
- }
- cout << "What amendment provided \"equality of the law\"?" <<endl;
- cout << "1)13th Amendment" <<endl;
- cout << "2)14th Amendment" <<endl;
- cout << "3)15th Amendment" <<endl;
- cin >> ans;
- switch (ans){
- case 1:
- system("clear");
- slowPrint(50000,"You have taken damage!\n");
- dmgTakenn = damageRand();
- health = health - dmgTakenn;
- cout << "Damage taken: " << dmgTakenn << endl;
- wonInRow = 0;
- cin.get();
- cin.get();
- q3();
- break;
- case 3:
- system("clear");
- slowPrint(50000,"You have taken damage!\n");
- dmgTaken = damageRand();
- health = health - dmgTaken;
- cout << "Damage taken: " << dmgTaken << endl;
- wonInRow = 0;
- cin.get();
- cin.get();
- q3();
- break;
- case 2:
- system("clear");
- slowPrint(50000,"You have succeeded!\n");
- wonInRow++;
- if (goldenPowder == true){
- int dmg = goldenRand();
- ohealth = ohealth - dmg;
- if (dmg > 7){
- cout << "Critical hit!\n" << endl;
- }
- }
- if (goldenPowder == false){
- int dmg = generateRand();
- ohealth = ohealth - dmg;
- if (dmg > 7){
- cout << "Critical hit!\n" << endl;
- }
- }
- cout << "Health: " << health << endl;
- cout << "Enemy's health: " << ohealth << endl;
- cout << "\n\nPress ENTER to continue to the next question...\n" << endl;
- cin.get();
- cin.get();
- q4();
- break;
- }
- }
- void q2(){
- testWon();
- testLose();
- system("clear");
- cout << "Health: " << health << endl;
- cout << "Enemy's health: " << ohealth << endl;
- if (wonInRow > 2){
- goldenPowder = true;
- system("clear");
- slowPrint(50000,"You got golden powder for your minnieball musket!\nYou attacks will now become 50% stronger!");
- cin.get();
- system("clear");
- }
- if (wonInRow <=2){
- goldenPowder = false;
- }
- cout << "Who was elected that ended reconstruction?" <<endl;
- cout << "1)Daniel Chamberlain" <<endl;
- cout << "2)Rutherford B. Hayes" <<endl;
- cout << "3)Wade Hampton" <<endl;
- cin >> ans;
- switch (ans){
- case 1:
- system("clear");
- slowPrint(50000,"You have taken damage!\n");
- dmgTakenn = damageRand();
- health = health - dmgTakenn;
- cout << "Damage taken: " << dmgTakenn << endl;
- wonInRow = 0;
- cin.get();
- cin.get();
- q2();
- break;
- case 3:
- system("clear");
- slowPrint(50000,"You have taken damage!\n");
- dmgTaken = damageRand();
- health = health - dmgTaken;
- cout << "Damage taken: " << dmgTaken << endl;
- wonInRow = 0;
- cin.get();
- cin.get();
- q2();
- break;
- case 2:
- system("clear");
- slowPrint(50000,"You have succeeded!\n");
- wonInRow++;
- if (goldenPowder == true){
- int dmg = goldenRand();
- ohealth = ohealth - dmg;
- if (dmg > 7){
- cout << "Critical hit!\n" << endl;
- }
- }
- if (goldenPowder == false){
- int dmg = generateRand();
- ohealth = ohealth - dmg;
- if (dmg > 7){
- cout << "Critical hit!\n" << endl;
- }
- }
- cout << "Health: " << health << endl;
- cout << "Enemy's health: " << ohealth << endl;
- cout << "\n\nPress ENTER to continue to the next question...\n" << endl;
- cin.get();
- cin.get();
- q3();
- break;
- }
- }
- void q1(){
- testWon();
- testLose();
- system("clear");
- cout << "Health: " << health << endl;
- cout << "Enemy's health: " << ohealth << endl;
- if (wonInRow > 2){
- goldenPowder = true;
- system("clear");
- slowPrint(50000,"You got golden powder for your minnieball musket!\nYou attacks will now become 50% stronger!");
- cin.get();
- system("clear");
- }
- if (wonInRow <=2){
- goldenPowder = false;
- }
- cout << "What is corruption?" <<endl;
- cout << "1)Breaking the law" <<endl;
- cout << "2)Radical Republicans" <<endl;
- cout << "3)Dishonest practices" <<endl;
- cin >> ans;
- switch (ans){
- case 1:
- system("clear");
- slowPrint(50000,"You have taken damage!\n");
- dmgTakenn = damageRand();
- health = health - dmgTakenn;
- cout << "Damage taken: " << dmgTakenn << endl;
- wonInRow = 0;
- cin.get();
- cin.get();
- q1();
- break;
- case 2:
- system("clear");
- slowPrint(50000,"You have taken damage!\n");
- dmgTaken = damageRand();
- health = health - dmgTaken;
- cout << "Damage taken: " << dmgTaken << endl;
- wonInRow = 0;
- cin.get();
- cin.get();
- q1();
- break;
- case 3:
- system("clear");
- slowPrint(50000,"You have succeeded!\n");
- wonInRow++;
- if (goldenPowder == true){
- int dmg = goldenRand();
- ohealth = ohealth - dmg;
- if (dmg > 7){
- cout << "Critical hit!\n" << endl;
- }
- }
- if (goldenPowder == false){
- int dmg = generateRand();
- ohealth = ohealth - dmg;
- if (dmg > 7){
- cout << "Critical hit!\n" << endl;
- }
- }
- cout << "Health: " << health << endl;
- cout << "Enemy's health: " << ohealth << endl;
- cout << "\n\nPress ENTER to continue to the next question...\n" << endl;
- cin.get();
- cin.get();
- q2();
- break;
- }
- }
- void play(){
- system("clear");
- /*
- Here comes the questions. :D
- */
- q1();
- }
- void menu(){
- system("clear");
- cout << "****Crazy*Boss*RPG****\n";
- cout << "**1)*Play*************\n";
- cout << "**2)*About************\n";
- cout << "**3)*Quit*************\n";
- cout << "**********************\n";
- int ch;
- cin >> ch;
- switch (ch){
- case 1:
- play();
- break;
- case 2:
- system("clear");
- slowPrint(50000,"\n\nCreated by Julian Rachele, started Febuary 19, 2012 for a SS project.\nIt uses C++ and the standard library.\nTook me a while to make, even if it is an ASCII based game.\n");
- cin.get();
- cin.get();
- menu();
- break;
- case 3:
- break;
- default:
- cout << "Please type in a correct value, thanks." << endl;
- break;
- }
- }
- int main() {
- system("clear");
- srand(time(0));
- slowPrint(50000,"Julian Rachele Presents...\n");
- slowPrint(50000,"A fun game that will (hopefully) keep you playing\n");
- slowPrint(50000,"The Crazy Boss Social Studies RPG! (v1.0)\n");
- slowPrint(50000,"Press [Enter].");
- cin.get();
- system("clear");
- menu();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement