| CODE |
// Text RPG Game // By: Darwin Aguirre // Thxz To MOFO #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int battle( void ); int attack( void ); int skill( void ); int skill1( void ); int skill2( void ); int skill3( void ); int end( void ); int stats( void ); int rest( void ); int path( void ); int levelsystem( void ); int randome( void ); int higherRandome( void ); int highestRandome( void ); int all( void ); int bossGen( void ); char heroname[ 20 ]; int HP = 100; int fHP = HP; int MP = 10; int fMP = MP; int Str = 5; int Exp = 0; int TExp = 50; int lv = 1; const char Monstername[ 10 ] = { "Korishi: " }; int HP1; int Str1; int Ex; template < class R > R Randome ( R value1, R value2, R value3 ) { HP1 = value1; Str1 = value2; Ex = value3; return HP1, Str1, Ex; } int main() { cout << "Hello and welcome to my \"RPG GAME\" hope you enjoy it!!\nThxz To MOFO\n"; cout << "Version 3.7\n\n\n"; cout << "Please enter your hero's name: "; cin >> heroname; srand( time( 0 ) ); path(); return 0; } int path( void ) { int respond; while (1) { while ( Exp >= TExp ) levelsystem(); cout << "\nHello " << heroname << ", what would you like to do?\n"; cout << "1)Train\n2)Check Stats\n3)Rest\n4)Exit\nChoose: "; cin >> respond; switch ( respond ) { case 1: battle(); break; case 2: stats(); break; case 3: rest(); break; case 4: return 0; break; default: cout << "Invailed choice\n"; break; } } return 0; } int battle( void ) { int answer = 0; switch ( lv ) { case 1: case 2: case 3: case 4: case 5: randome(); break; case 6: case 7: case 8: case 9: case 10: higherRandome(); break; case 11: case 12: case 13: case 14: case 15: highestRandome(); default: all(); break; } while (1) { cout << "\n\nBATTLE\n\n\n"; cout << Monstername <<"\nHP: " << HP1 << "\n\n\n"; cout << heroname << ":"; cout << "\nHP: " << HP << endl; cout << "MP: " << MP << endl; cout << "1) Attack\n2) Skills\n"; cout << "Choose: "; cin >> answer; switch ( answer ) { case 1: attack(); break; case 2: skill(); break; default: cout << "Invalid choice, try agian.\n"; break; } if ( HP <= 0 || HP1 <= 0 ) { end(); return 0; } } return 0; } int attack( void ) { int Att = ( 1 + rand() % Str ); int Att1 = ( 1 + rand() % Str1 ); int critical = ( 1 + rand() % 20 ); switch ( critical ) { case 7: cout << "\n\nCRITICAL hit: " << ( Att + 10 ); HP1 -= ( Att + 10 ); break; default: cout << "\n\nYou hit: " << Att; HP1 -= Att; break; } cout << "\nMonster hit: " << Att1; HP -= Att1; return 0; } int skill( void ) { int Att1 = ( 1 + rand() % Str1 ); if ( lv < 7 ) skill1(); if( lv <= 14 && lv >= 7) skill2(); if ( lv >= 15 ) skill3(); cout << "\nMonster hit: " << Att1; HP -= Att1; return 0; } int end( void ) { if ( HP <= 0 ) { cout << "\n\n\n\nYou have DIED!!\n"; cout << heroname << "'s has been returned to what they were when you started!!\n\n"; fHP = 100; fMP = 10; HP = fHP; MP = fMP; lv = 1; Exp = 0; TExp = 50; } if ( HP1 <= 0 ) { cout << "\n\n\n\nYou have WON!!\n"; cout << "You gained " << Ex << " EX!!\n\n\n\n"; HP1 = 25; Exp += Ex; } return 0; } int stats( void ) { cout << endl; cout << heroname << "'s Stats\n"; cout << "Level: " << lv << endl; cout << "HP: " << HP << "/" << fHP << endl; cout << "MP: " << MP << "/" << fMP << endl; cout << "Strength: " << Str << endl; cout << "Ex: " << Exp << "/" << TExp << endl; return 0; } int rest( void ) { HP = fHP; MP = fMP; cout << "\nYou are fully rested now!\n"; return 0; } int levelsystem( void ) { cout << "You went up a level!!\n"; cout << "You are now level " << ( lv += 1 ) << endl;; cout << "HP + 25!!\n"; cout << "MP + 10!!\n"; cout << "Str + 5!!\n"; fHP += 25; fMP += 10; Str += 5; TExp += ( 50 * lv ); cout << endl; switch ( lv ) { case 7: cout << "You have learned a new skill!!\n"; break; case 15: cout << "You learned the final skill!!\n"; break; default: break; } return 0; } int randome( void ) { int HPGen = ( rand() % 25 ); int StrGen = ( 2 + rand() % 4 ); int ExGen = ( rand() % 20 ); if ( HPGen < 10 ) { int y = 10; int p; p = y - HPGen; HPGen += p; } if ( ExGen < 10 ) { int z = 10; int f; f = z - ExGen; ExGen += f; } Randome ( HPGen, StrGen, ExGen ); return 0; } int higherRandome( void ) { int HPGen = (50 + rand() % 100 ); int StrGen = ( 15 + rand() % 15 ); int ExGen = ( 25 + rand() % 50 ); if ( HPGen < 50 ) { int y = 50; int p; p = y - HPGen; HPGen += p; } if ( ExGen < 25 ) { int z = 25; int f; f = z - ExGen; ExGen += f; } Randome ( HPGen, StrGen, ExGen ); return 0; } int highestRandome( void ) { int HPGen = (100 + rand() % 200 ); int StrGen = ( 20 + rand() % 25 ); int ExGen = ( 50 + rand() % 100 ); if ( HPGen < 100 ) { int y = 100; int p; p = y - HPGen; HPGen += p; } if ( ExGen < 50 ) { int z = 50; int f; f = z - ExGen; ExGen += f; } Randome ( HPGen, StrGen, ExGen ); return 0; } int all( void ) { int BossRanz = ( 1 + rand() % 10 ); if ( BossRanz == 1 ) { bossGen(); return 0; } int HPGen = (200 + rand() % 300 ); int StrGen = ( 30 + rand() % 40 ); int ExGen = ( 50 + rand() % 100 ); if ( HPGen < 200 ) { int y = 200; int p; p = y - HPGen; HPGen += p; } if ( ExGen < 50 ) { int z = 50; int f; f = z - ExGen; ExGen += f; } Randome ( HPGen, StrGen, ExGen ); return 0; } int bossGen( void ) { cout << "\nBOSS!!"; int HPGen = (700 + rand() % 1000 ); int StrGen = ( 100 + rand() % 120 ); int ExGen = ( 700 + rand() % 1000 ); if ( HPGen < 700 ) { int y = 700; int p; p = y - HPGen; HPGen += p; } if ( ExGen < 700 ) { int z = 700; int f; f = z - ExGen; ExGen += f; } Randome ( HPGen, StrGen, ExGen ); return 0; } int skill1( void ) { int choose; int skillA = Str * 2; int skill1 = ( 1 + rand() % skillA ); int Att1 = ( 1 + rand() % Str1 ); int critical = ( 1 + rand() % 20 ); cout << "Skills:\n1)Tera Slash\nChoose: "; cin >> choose; if ( choose == 1 ) { switch ( critical ) { case 7: cout << "TERA SLASH - @#@#@#//\\\n"; cout << "CRITICAL TERA SLASH hit: " << ( skill1 + 10 ); HP1 -= ( skill1 + 10 ); MP -= 1; break; default: cout << "TERA SLASH - @#@#@#//\\\n"; cout << "TERA SLASH hit: " << skill1; HP1 -= skill1; MP -= 1; return 0; break; } } else { cout << "Invaild Choice\n"; battle(); } return 0; } int skill2( void ) { int choose; int skillA = Str * 2; int skillB = Str * 5; int skill1 = ( 1 + rand() % skillA ); int skill2 = ( 1 + rand() % skillB ); int Att1 = ( 1 + rand() % Str1 ); int critical = ( 1 + rand() % 20 ); cout << "Skills:\n1)Tera Slash\n2)Double Edge\nChoose: "; cin >> choose; if ( choose == 1 ) { switch ( critical ) { case 7: cout << "TERA SLASH - @#@#@#//\\\n"; cout << "CRITICAL TERA SLASH hit: " << ( skill1 + 10 ); HP1 -= ( skill1 + 10 ); MP -= 1; break; default: cout << "TERA SLASH - @#@#@#//\\\n"; cout << "TERA SLASH hit: " << skill1; HP1 -= skill1; MP -= 1; break; } } if ( choose == 2 ) { switch ( critical ) { case 7: cout << "DOUBLE EDGE - ---@@$$$^^&& \n"; cout << "CRITICAL DOUBLE EDGE hit: " << ( skill2 + 10 ); HP1 -= ( skill2 + 10 ); MP -= 5; break; default: cout << "DOUBLE EDGE - ---@@$$$^^&& \n"; cout << "DOUBLE EDGE hit: " << skill2; HP1 -= skill2; MP -= 5; break; } } else { cout << "Invaild Choice\n"; battle(); } return 0; } int skill3( void ) { int choose; int skillA = Str * 2; int skillB = Str * 5; int skillC = Str * 10; int skill1 = ( 1 + rand() % skillA ); int skill2 = ( 1 + rand() % skillB ); int skill3 = ( 1 + rand() % skillC ); int Att1 = ( 1 + rand() % Str1 ); int critical = ( 1 + rand() % 20 ); cout << "Skills:\n1)Tera Slash\n2)Double Edge\n3)Dragon Blade\nChoose: "; cin >> choose; if ( choose == 1 ) { switch ( critical ) { case 7: cout << "TERA SLASH - @#@#@#//\\\n"; cout << "CRITICAL TERA SLASH hit: " << ( skill1 + 20 ); HP1 -= ( skill1 + 10 ); MP -= 1; break; default: cout << "TERA SLASH - @#@#@#//\\\n"; cout << "TERA SLASH hit: " << skill1; HP1 -= skill1; MP -= 1; break; } } if ( choose == 2 ) { switch ( critical ) { case 7: cout << "DOUBLE EDGE - ---@@$$$^^&& \n"; cout << "CRITICAL DOUBLE EDGE hit: " << ( skill2 + 10 ); HP1 -= ( skill2 + 10 ); MP -= 5; break; default: cout << "DOUBLE EDGE - ---@@$$$^^&& \n"; cout << "DOUBLE EDGE hit: " << skill2; HP1 -= skill2; MP -= 5; return 0; break; } } if ( choose == 3 ) { switch ( critical ) { case 7: cout << "DRAGON BLADE - %@""""__&==*\n"; cout << "CRITICAL DRAGON BLADE hit: " << ( skill3 + 5 ); HP1 -= ( skill3 + 5 ); MP -= 20; break; default: cout << "DRAGON BLADE - %@""""__&==*\n"; cout << "DRAGON BLADE Hit: " << skill3; HP1 -= skill3; MP -= 20; break; } } else cout << "Invaild Choice\n"; return 0; } |
| QUOTE (Zaqufant @ Dec 3 2006, 11:57 PM) |
| Learn an easy gfx library (saaaay allegro) and turn it into graphics. It will be cool. |
| QUOTE (Shonoby @ Dec 12 2006, 11:29 PM) |
| OK, well the reason i used inline is cause i felt like it and wanted to try it out and see if it would make a diffrence, |
| QUOTE (Shonoby @ Dec 12 2006, 11:29 PM) |
| so just use the code at it is |
| QUOTE (Shonoby @ Dec 12 2006, 11:29 PM) |
| and the reason i made it inline is so that everytime the compiler calls the function it goes stright to the source |
| QUOTE (Shonoby @ Dec 12 2006, 11:29 PM) |
| rather than just making a copy of it which it would have done if i did not pui t"inline" |
| QUOTE (Shonoby @ Dec 12 2006, 11:29 PM) |
| so dont say its making it slower, |
| QUOTE (Shonoby @ Dec 12 2006, 11:29 PM) |
| and if i did not use inline it would have to use alot of unessasary space |
| QUOTE (Shonoby @ Dec 12 2006, 11:29 PM) |
| which i need for this giant code |
| QUOTE (Shonoby @ Dec 12 2006, 11:29 PM) |
| so dont tell me something that iam sure of well moslty, so please stop it with the inline thing and if u dont like it then just change it i dont care |
| QUOTE (Shonoby @ Dec 12 2006, 11:29 PM) |
| yes i know iam begin rude but stop telling me about the inline thing, |
| QUOTE (Shonoby @ Dec 12 2006, 11:29 PM) |
| i know what i did for this code was good |
| QUOTE (Shonoby @ Dec 12 2006, 11:29 PM) |
| and if u dont like it than change it urself, ok, well later |
| QUOTE (Shonoby @ Dec 13 2006, 04:29 AM) |
| Ok, well the reason i used inline is cause i felt like it and wanted to try it out and see if it would make a diffrence, so just use the code at it is and the reason i made it inline is so that everytime the compiler calls the function it goes stright to the source rather than just making a copy of it which it would have done if i did not pui t"inline" so dont say its making it slower, and if i did not use inline it would have to use alot of unessasary space which i need for this giant code so dont tell me something that iam sure of well moslty, so please stop it with the inline thing and if u dont like it then just change it i dont care, yes i know iam begin rude but stop telling me about the inline thing, i know what i did for this code was good and if u dont like it than change it urself, ok, well later |