Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <stdio.h>
- #include <cstdlib>
- #include <ctime>
- #include <unistd.h>
- using namespace std;
- int rhp , dahp ,smhp , ohp , dlhp;
- int main();
- int score;
- int hp = 50;
- void game(void);
- void credits(void);
- void truewin (void)
- {
- cout << "CONGRAGULATIONS!" << endl;
- cout << "YOU WIN!" << endl;
- credits();
- main();
- }
- void win (void)
- {
- cout << "WIN" << endl;
- sleep(1);
- cout<< "hp: " << hp << endl;
- cout << "score: " << score << endl;
- }
- void lose(void)
- {
- cout << "LOSE" << endl;
- sleep(1);
- cout<< "hp: " << hp << endl;
- sleep(1);
- credits();
- }
- void esc(void)
- {
- cout << "YOU ESCAPED..." << endl;
- sleep(1);
- cout<< "hp: " << hp << endl;
- }
- void ROTSALA(void)
- {
- rhp = 25;
- label:
- int atk;
- cout << "ROTSALA APPEARS!" << endl;
- cout << endl;
- cout << "STATS:"<< endl;
- cout << "hp: " << hp << endl;
- cout << "ehp: " << rhp << endl;
- cout << endl;
- cout << "ATTACKS:" << endl;
- cout << "(1) sword attack" << endl;
- cout <<"(2) rain of arrows" << endl;
- cout << "(3) dark ritual" << endl;
- cout << "(4) summon healer" << endl;
- cout << "(5) escape" << endl;
- cin >> atk;
- if (atk == 1){
- cout << "You attack ROTSALA with your sword" << endl;
- rhp -= rand()%5;
- cout << "ROTSALA uses spear attack" << endl;
- hp -= rand()% 5;
- if (rhp <= 0){
- win();
- score += 50;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atk == 2){
- cout << "you activated arrow rain "<< endl;
- rhp -= rand()%10;
- hp-= rand()%5;
- cout << "ROTSALA heals" << endl;
- rhp += rand()%5;
- if (rhp <= 0){
- win();
- score += 50;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atk == 3){
- cout << "you did a dark ritual" << endl;
- if (rand()% 10 >= 3){
- rhp -= rand()%20;
- } else {
- cout << "It did not work" << endl;
- }
- cout << "ROTSALA throws fireballs " << endl;
- hp -= rand()% 10;
- if (rhp <= 0){
- win();
- score += 50;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atk == 4){
- cout << "you healed" << endl;
- hp += rand()% 15;
- cout << "ROTSALA throws His spear " << endl;
- hp -= rand()% 7;
- if (rhp <= 0){
- win();
- score+= 50;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atk == 5){
- if (rand()% 10 >= 5){
- esc();
- game();
- }
- cout << "YOU DID NOT ESCAPE" << endl;
- cout << "ROTSALA HEALS" << endl;
- rhp += rand()% 15;
- }
- goto label;
- }
- void DON (void)
- {
- dahp = 30;
- label:
- int atkq;
- cout << "DON ANSTEL (ANSTEL) APPEARS" << endl;
- cout << endl;
- cout << "STATS:"<< endl;
- cout << "hp: " << hp << endl;
- cout << "ehp: " << dahp << endl;
- cout << endl;
- cout << "ATTACKS:" << endl;
- cout << "(1) sword attack" << endl;
- cout <<"(2) rain of arrows" << endl;
- cout << "(3) dark ritual" << endl;
- cout << "(4) summon healer" << endl;
- cout << "(5) escape" << endl;
- cin >> atkq;
- if (atkq == 1){
- cout << "You attack ANSTEL with your sword" << endl;
- dahp -= rand()%5;
- cout << "ANSTEL STABS YOU WITH HIS KNIFE" << endl;
- hp -= rand()% 5;
- if (dahp <= 0){
- win();
- score += 100;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atkq == 2){
- cout << "you activated arrow rain "<< endl;
- dahp -= rand()%10;
- hp-= rand()%5;
- cout << "ANSTEN heals" << endl;
- rhp += rand()%5;
- if (dahp <= 0){
- win();
- score += 100;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atkq == 3){
- cout << "you did a dark ritual" << endl;
- if (rand()% 10 >= 3){
- dahp -= rand()%20;
- } else {
- cout << "It did not work" << endl;
- }
- cout << "ANSTEN SHOOTS YOU WITH HIS TOMMY GUN " << endl;
- hp -= rand()% 10;
- if (dahp <= 0){
- win();
- score += 100;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atkq == 4){
- cout << "you healed" << endl;
- hp += rand()% 15;
- cout << "ANSTEN SHOOTS YOU WITH HIS REVOLVER" << endl;
- hp -= rand()% 7;
- if (dahp <= 0){
- win();
- score += 100;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atkq == 5){
- if (rand()% 10 >= 5){
- esc();
- game();
- }
- cout << "YOU DID NOT ESCAPE" << endl;
- cout << " ANSTEN HEALS" << endl;
- dahp += rand()% 15;
- }
- goto label;
- }
- void SPYMASTER (void)
- {
- smhp = 35;
- label:
- int atkw;
- cout << "SPY MASTER (SPY) APPEARS" << endl;
- cout << endl;
- cout << "STATS:"<< endl;
- cout << "hp: " << hp << endl;
- cout << "ehp: " << smhp << endl;
- cout << endl;
- cout << "ATTACKS:" << endl;
- cout << "(1) sword attack" << endl;
- cout <<"(2) rain of arrows" << endl;
- cout << "(3) dark ritual" << endl;
- cout << "(4) summon healer" << endl;
- cout << "(5) escape" << endl;
- cin >> atkw;
- if (atkw == 1){
- cout << "You attack SPY with your sword" << endl;
- smhp -= rand()%5;
- cout << "SPY shoots you" << endl;
- hp -= rand()% 5;
- if (smhp <= 0){
- win();
- score += 200;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atkw == 2){
- cout << "you activated arrow rain "<< endl;
- smhp -= rand()%10;
- hp-= rand()%5;
- cout << "SPY heals" << endl;
- smhp += rand()%5;
- if (smhp <= 0){
- win();
- score += 200;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atkw == 3){
- cout << "you did a dark ritual" << endl;
- if (rand()% 10 >= 3){
- smhp -= rand()%20;
- } else {
- cout << "It did not work" << endl;
- }
- cout << "SPY SHOOTS YOU " << endl;
- hp -= rand()% 10;
- if (smhp <= 0){
- win();
- score += 200;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atkw == 4){
- cout << "you healed" << endl;
- hp += rand()% 15;
- cout << "SPY SHOOTS YOU" << endl;
- hp -= rand()% 7;
- if (smhp <= 0){
- win();
- score += 200;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atkw == 5){
- if (rand()% 10 >= 5){
- esc();
- game();
- }
- cout << "YOU DID NOT ESCAPE" << endl;
- cout << "SPY HEALS" << endl;
- smhp += rand()% 15;
- }
- goto label;
- }
- void OVERLORD(void)
- {
- ohp = 45;
- label:
- int atke;
- cout << "OVERLORD ATTACKS!" << endl;
- cout << endl;
- cout << "STATS:"<< endl;
- cout << "hp: " << hp << endl;
- cout << "ehp: " << ohp << endl;
- cout << endl;
- cout << "ATTACKS:" << endl;
- cout << "(1) sword attack" << endl;
- cout <<"(2) rain of arrows" << endl;
- cout << "(3) dark ritual" << endl;
- cout << "(4) summon healer" << endl;
- cout << "(5) escape" << endl;
- cin >> atke;
- if (atke == 1){
- cout << "You attack OVERLORD with your sword" << endl;
- ohp -= rand()%5;
- cout << "OVERLORD THROWS YOU" << endl;
- hp -= rand()% 5;
- if (ohp <= 0){
- win();
- score += 400;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atke == 2){
- cout << "you activated arrow rain "<< endl;
- ohp -= rand()%10;
- hp-= rand()%5;
- cout << "OVERLORD heals" << endl;
- ohp += rand()%5;
- if (ohp <= 0){
- win();
- score += 400;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atke == 3){
- cout << "you did a dark ritual" << endl;
- if (rand()% 10 >= 3){
- ohp -= rand()%20;
- } else {
- cout << "It did not work" << endl;
- }
- cout << "OVERLORD throws fireballs " << endl;
- hp -= rand()% 10;
- if (ohp <= 0){
- win();
- score += 400;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atke == 4){
- cout << "you healed" << endl;
- hp += rand()% 15;
- cout << "OVERLORD BOMBARDS YOU" << endl;
- hp -= rand()% 7;
- if (ohp <= 0){
- win();
- score += 400;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atke == 5){
- if (rand()% 10 >= 5){
- esc();
- score += 400;
- game();
- }
- cout << "YOU DID NOT ESCAPE" << endl;
- cout << "OVERLORD HEALS" << endl;
- ohp += rand()% 15;
- }
- if (ohp <= 0){
- win();
- score += 400;
- game();
- }
- if (hp <= 0){
- lose();
- }
- goto label;
- }
- void DRAGONLORD(void)
- {
- dlhp = 50;
- label:
- int atkr;
- cout << "DRAGONLORD (DRAGON) ATTACKS!" << endl;
- cout << endl;
- cout << "STATS:"<< endl;
- cout << "hp: " << hp << endl;
- cout << "ehp: " << dlhp << endl;
- cout << endl;
- cout << "ATTACKS:" << endl;
- cout << "(1) sword attack" << endl;
- cout <<"(2) rain of arrows" << endl;
- cout << "(3) dark ritual" << endl;
- cout << "(4) summon healer" << endl;
- cout << "(5) escape" << endl;
- cin >> atkr;
- if (atkr == 1){
- cout << "You attack DRAGON with your sword" << endl;
- dlhp -= rand()%5;
- cout << "DRAGON THROWS YOU" << endl;
- hp -= rand()% 5;
- if (dlhp <= 0){
- win();
- score += 1000;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atkr == 2){
- cout << "you activated arrow rain "<< endl;
- dlhp -= rand()%10;
- hp-= rand()%5;
- cout << "DRAGON heals" << endl;
- dlhp += rand()%5;
- if (dlhp <= 0){
- win();
- score += 1000;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atkr == 3){
- cout << "you did a dark ritual" << endl;
- if (rand()% 10 >= 3){
- dlhp -= rand()%20;
- } else {
- cout << "It did not work" << endl;
- }
- cout << "DRAGON throws fireballs " << endl;
- hp -= rand()% 10;
- if (dlhp <= 0){
- win();
- score += 1000;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atkr == 4){
- cout << "you healed" << endl;
- hp += rand()% 15;
- cout << "DRAGON BOMBARDS YOU" << endl;
- hp -= rand()% 7;
- if (dlhp <= 0){
- win();
- score += 1000;
- game();
- }
- if (hp <= 0){
- lose();
- }
- }
- if (atkr == 5){
- if (rand()% 10 >= 5){
- esc();
- game();
- }
- cout << "YOU DID NOT ESCAPE" << endl;
- cout << "DRAGON HEALS" << endl;
- dlhp += rand()% 15;
- }
- if (dlhp <= 0){
- win();
- score += 1000;
- game();
- }
- if (hp <= 0){
- lose();
- }
- goto label;
- }
- void game(void)
- {
- srand(time(0));
- label:
- char conf;
- int e;
- int ev = rand()%10;
- cout << "YOUR ADVENTURE BEGINS..." << endl;
- cout << "heal: 1" << endl;
- cout << "quit: 2" << endl;
- cout << "hp: " << hp << endl;
- cout << "score: " << score << endl;
- cin >> e;
- if ( e == 1){
- cout << "heal" << endl;
- hp += rand()%25;
- }
- if (e == 2){
- cout << "are you sure? (Y/y) for yes, (N/n) for no" << endl;
- cin >> conf;
- switch (conf){
- case 'N':
- case 'n':
- goto label;
- break;
- case 'Y':
- case 'y':
- main();
- break;
- }
- }
- if (score == 10000){
- truewin();
- }
- switch (ev){
- case 1:
- ROTSALA();
- break;
- case 2:
- DON();
- break;
- case 3:
- SPYMASTER();
- break;
- case 4:
- OVERLORD();
- break;
- case 5:
- DRAGONLORD();
- break;
- default:
- cout << "you walk through an empty feild..." << endl;
- break;
- }
- goto label;
- }
- void credits(void)
- {
- cout << "developer /programmer : ALFRED NATHANIEL M. DIANA" << endl;
- sleep(1);
- cout << "Mother: Anstacia Abayan Melquiades Diana" << endl;
- cout << "Father: Alfredo Servillon Diana" << endl;
- sleep(1);
- cout << "Thank you for playing" << endl;
- sleep(1);
- }
- int main()
- {
- int dec;
- label:
- cout << "RPG CLASSIC" << endl;
- cout << "(1) GAME , (2) CREDITS" << endl;
- cin >> dec;
- switch (dec){
- case 1:
- game();
- break;
- case 2:
- credits();
- break;
- default :
- cout << "ERROR! NOT VALID NUMBER!" << endl;
- break;
- }
- goto label;
- }
Add Comment
Please, Sign In to add comment