/* To ADD MONEY during the game, when in the shop, type "rob" (without the " "). To ADD Health during the game, when in the shop, type "heal" (without the " "). To ADD Attack during the game, when in the shop, type "power" (without the " "). To ADD levels during the game, when in the shop, type "exp" (without the " "). To play as a Jedi, press J in the Class select bit - makes you pretty hench, while the game isn't totally defeated. EDIT 16/12/11 - I've added in a minigames section. There is only 1 minigame so far, but I intend to add more soon. EDIT 07/01/12 - I've added in different classes, which have more options and a new leveling system. It meant making a lot of changes. Should make the game better. Need to add more enemies and make them stronger. Need to add some sorta quest line and inventory function with bonuses as you buy equipment - maybe unlockable attacks? PS - OVER 2000 LINES :) */ #include <iostream> using namespace std ; #include <iomanip> #include <array> // never used this in the end :( #include <string> #include <math.h> //needed #include <fstream> //declare classes void FightEn (); void MainMenu (); void Intro (); void LevelUp (); void Item (); void FightStats (); void Stats (); void ChooseEnemy (); void FightEn1 (); void FightEn2 (); void FightEn3 (); void FightEn4 (); void FightEn5 (); void FightEn6 (); void FightEn7 (); void FightEn8 (); void FightEn9 (); void FightEn10 (); void FightEn11 (); void FightEn12 (); void FightEn13 (); void FightEn14 (); void FightEn15 (); void FightEn16 (); void FightEn17 (); void FightEn18 (); void FightEn19 (); void FightBoss (); void MoveScene (); void UseItem (); void Shop (); void Superpot (); void Ultrapot (); void Uberpot (); void EMpot (); void AUpot (); void HUpot (); void Attpot (); void Healthpot (); void Die (); void WinGame (); void DiceRoll (); void DiceCall (); void Winnings (); void GoldCheck (); void Dicemain (); void GuessGame (); void GoldCheck (); void GoldCheck2 (); void Guess (); void Tavern (); void Load (); void Save (); void JCAttack (); void RCattack (); void WCAttack (); void MCAttack (); void Mage (); void Warrior (); void Ranger (); void Jedi (); void IntroA (); //declare global variables string charname = "???" ; string set = "???" ; string Aname = "???" ; int middleman ; int acc ; int defence = 0 ; int scenery = 1 ; int attack = 5 ; //player stats int healthMax = 30 ; int attackMax = 5 ; int health = 30 ; int level = 1 ; int exper = 0 ; //I couldn't use exp because that's the exponential function in math.h! :( int nextLevel = 10 ; // no. of exp before next level int dead = 0 ; int apot = 2 ; int hpot = 1 ; int spot = 0 ; int upot = 0 ; int uupot = 0 ; int empot = 0 ; int aupot = 0 ; int hupot = 0 ; int gold = 50 ; int enattack = 1 ; //enemy stats int enhealth = 1 ; int enexper = 0 ; int enacc = 0 ; int engold = 0 ; string enname = "???" ; string enatname = "???" ; string choice2 = "a" ; //I needed this to be accessible to ChooseEnemy(); int abot ; int tries ; int Odice , Ototal ; int Ydice , Ytotal ; int Bet , Btotal ; int check , begger ; int Rolls ; char C , D ; int iSecret , iGuess ; int cost ; int earnings ; int top ; char E ; char Class ; char ichoose ; void Intro () { system ( "CLS" ); cout << "What class would you like to play as?

Mage - M

Warrior - W

Hunter - H

" ; cin >> Class ; if ( Class == 'M' || Class == 'm' ) { cout << "The Mage is a very attack heavy person, who has little health, but can deal out lots of damage!

Are you sure?

(y or n) " ; cin >> Class ; if ( Class == 'n' || Class == 'N' ) { Intro (); } else if ( Class == 'y' || Class == 'Y' ) { Mage (); } else { cout << "Incorrect responce, please try again

" ; system ( "pause" ); Intro (); } } else if ( Class == 'W' || Class == 'w' ) { cout << "The Warrior is a very defence heavy person, who has high health, but can't deal out lots of damage!

Are you sure?

(y or n) " ; cin >> Class ; if ( Class == 'n' || Class == 'N' ) { Intro (); } else if ( Class == 'y' || Class == 'Y' ) { Warrior (); } else { cout << "Incorrect responce, please try again

" ; system ( "pause" ); Intro (); } } else if ( Class == 'H' || Class == 'h' ) { cout << "The Hunter is a very dexterous person, who has mid level health, but can deal out a fair amount of damage with his bow!

Are you sure?

(y or n) " ; cin >> Class ; if ( Class == 'n' || Class == 'N' ) { Intro (); } else if ( Class == 'y' || Class == 'Y' ) { Ranger (); } else { cout << "Incorrect responce, please try again

" ; system ( "pause" ); Intro (); } } else if ( Class == 'J' || Class == 'j' ) { cout << "The Jedi Master is the all powerful general of this war!

Are you sure you can handle him?

(y or n) " ; cin >> Class ; if ( Class == 'n' || Class == 'N' ) { Intro (); } else if ( Class == 'y' || Class == 'Y' ) { Jedi (); } else { cout << "Incorrect responce, please try again

" ; system ( "pause" ); Intro (); } } else { cout << "Incorrect responce, please try again

" ; system ( "pause" ); Intro (); } } void Mage () { system ( "pause" ); Class = 'M' ; set = "MAGE" ; attackMax = 50 ; healthMax = 30 ; defence = 5 ; acc = 40 ; MainMenu (); } void LevelUp () { level += 1 ; nextLevel = ( nextLevel + 17 * ( level - 1 ) + 10 ); cout << "Well done, you have leveled up!

" ; cout << "How would you like to spend your points?" << endl ; for ( int g = 5 ; g > 0 ; -- g ) { system ( "CLS" ); cout << "You have " << g << "points remaining

" ; cout << "Attack - A

Defence - D

Health - H

Accuracy - C

" ; cin >> C ; if ( C == 'A' || C == 'a' ) { attackMax += 5 ; } else if ( C == 'D' || C == 'd' ) { defence += 5 ; } else if ( C == 'H' || C == 'h' ) { healthMax += 5 ; } else if ( C == 'C' || C == 'c' ) { acc += 5 ; } else { cout << "invalid choice" ; system ( "pause" ); continue ; } } cout << set << "

" ; cout << " \t Level: " << level << "

" ; cout << " \t Max Health: " << healthMax << "

" ; cout << " \t Attack: " << attackMax << "

" ; cout << " \t Accuracy: " << acc << "

" ; cout << " \t Defence: " << defence << "

" ; cin . get (); } void Warrior () { system ( "pause" ); set = "WARRIOR" ; Class = 'W' ; attackMax = 10 ; healthMax = 100 ; defence = 30 ; acc = 10 ; MainMenu (); } void Ranger () { system ( "pause" ); Class = 'R' ; set = "HUNTER" ; attackMax = 30 ; healthMax = 75 ; defence = 15 ; acc = 20 ; MainMenu (); } void Jedi () { system ( "pause" ); set = "JEDI_LORD" ; Class = 'J' ; attackMax = 100 ; healthMax = 200 ; defence = 50 ; acc = 1000 ; gold = 10000 ; MainMenu (); } void FightStats () { cout << set << endl ; cout << setw ( 12 ) << charname << " " << setw ( 20 ) << enname << endl ; cout << "Health: \t " << setw ( 12 ) << health << setw ( 20 ) << enhealth << endl ; cout << "Attack: \t " << setw ( 12 ) << attack << setw ( 20 ) << enattack << endl ; } void MCAttack () { cout << " \t Z - Flame Shot

\t X - Ice Arrown

" ; // if unlocked others, they will appear too if ( level >= 4 ) { cout << " \t C - Strom Arrown

" ;} if ( level >= 8 ) { cout << " \t B - FireBall

" ;} if ( level >= 12 ) { cout << " \t N - IceSpear

" ;} if ( level >= 16 ) { cout << " \t M - Thunder

" ;} if ( level >= 20 ) { cout << " \t L - Sun

" ;} if ( level >= 24 ) { cout << " \t K - Gravity

" ;} cout << " \t I - Use Item

" ; while ( level <= 1000 ) { cin >> ichoose ; if ( ichoose == 'Z' || ichoose == 'z' ) { Aname = "Flame Arrow" ; break ; } else if ( ichoose == 'X' || ichoose == 'x' ) { Aname = "Ice Arrow" ; break ; } else if (( ichoose == 'C' || ichoose == 'c' ) && ( level >= 4 )) { Aname = "Storm Arrow" ; break ; } else if (( ichoose == 'B' || ichoose == 'b' ) && ( level >= 8 )) { Aname = "FireBall" ; break ; } else if (( ichoose == 'N' || ichoose == 'n' ) && ( level >= 12 )) { Aname = "IceSpear" ; break ; } else if (( ichoose == 'M' || ichoose == 'm' ) && ( level >= 16 )) { Aname = "Thunder" ; break ; } else if (( ichoose == 'L' || ichoose == 'l' ) && ( level >= 20 )) { Aname = "Sun" ; break ; } else if (( ichoose == 'K' || ichoose == 'k' ) && ( level >= 24 )) { Aname = "Gravity" ; break ; } else { cout << "invald opperation" << endl ; system ( "pause" ); system ( "CLS" ); } } } void WCAttack () { cout << " \t Z - Slash

\t X - Body Slam

" ; // if unlocked others, they will appear too if ( level >= 4 ) { cout << " \t C - Repost

" ;} if ( level >= 8 ) { cout << " \t B - Pommel Strike

" ;} if ( level >= 12 ) { cout << " \t N - Push

" ;} if ( level >= 16 ) { cout << " \t M - Slap

" ;} if ( level >= 20 ) { cout << " \t L - Kamikaze

" ;} if ( level >= 24 ) { cout << " \t K - Charge

" ;} cout << " \t I - Use Item

" ; while ( level <= 1000 ) { cin >> ichoose ; if ( ichoose == 'Z' || ichoose == 'z' ) { Aname = "Slash" ; break ; } else if ( ichoose == 'X' || ichoose == 'x' ) { Aname = "Body Slam" ; break ; } else if (( ichoose == 'C' || ichoose == 'c' ) && ( level >= 4 )) { Aname = "Repost" ; break ; } else if (( ichoose == 'B' || ichoose == 'b' ) && ( level >= 8 )) { Aname = "Pommel Strike" ; break ; } else if (( ichoose == 'N' || ichoose == 'n' ) && ( level >= 12 )) { Aname = "Push" ; break ; } else if (( ichoose == 'M' || ichoose == 'm' ) && ( level >= 16 )) { Aname = "Slap" ; break ; } else if (( ichoose == 'L' || ichoose == 'l' ) && ( level >= 20 )) { Aname = "Kamikaze" ; break ; } if (( ichoose == 'K' || ichoose == 'k' ) && ( level >= 24 )) { Aname = "Charge" ; break ; } else { cout << "invald opperation" << endl ; system ( "pause" ); system ( "CLS" ); } } } void RCAttack () { cout << " \t Z - Arrow

\t X - Ice Shot

" ; // if unlocked others, they will appear too if ( level >= 4 ) { cout << " \t C - Strom Shot

" ;} if ( level >= 8 ) { cout << " \t B - Bomb Shot

" ;} if ( level >= 12 ) { cout << " \t N - Bludgeon

" ;} if ( level >= 16 ) { cout << " \t M - Triple Shot

" ;} if ( level >= 20 ) { cout << " \t L - Arrow to Face

" ;} if ( level >= 24 ) { cout << " \t K - Arrow to Knee

" ;} cout << " \t I - Use Item

" ; while ( level <= 1000 ) { cin >> ichoose ; if ( ichoose == 'Z' || ichoose == 'z' ) { Aname = "Arrow" ; break ; } else if ( ichoose == 'X' || ichoose == 'x' ) { Aname = "Ice Shot" ; break ; } else if (( ichoose == 'C' || ichoose == 'c' ) && ( level >= 4 )) { Aname = "Strom Shot" ; break ; } else if (( ichoose == 'B' || ichoose == 'b' ) && ( level >= 8 )) { Aname = "Bomb Shot" ; break ; } else if (( ichoose == 'N' || ichoose == 'n' ) && ( level >= 12 )) { Aname = "Bludgon" ; break ; } else if (( ichoose == 'M' || ichoose == 'm' ) && ( level >= 16 )) { Aname = "Triple Shot" ; break ; } else if (( ichoose == 'L' || ichoose == 'l' ) && ( level >= 20 )) { Aname = "Arrow to face" ; break ; } else if (( ichoose == 'K' || ichoose == 'k' ) && ( level >= 24 )) { Aname = "Arrow to Knee" ; break ; } else { cout << "invald opperation" << endl ; system ( "pause" ); system ( "CLS" ); } } } void JCAttack () { cout << " \t Q - Slash

\t W - Force Lightening

" ; // if unlocked others, they will appear too if ( level >= 4 ) { cout << " \t E - Strom

" ;} if ( level >= 8 ) { cout << " \t R - Choke

" ;} if ( level >= 12 ) { cout << " \t T - Force Push

" ;} if ( level >= 16 ) { cout << " \t Y - Force Slam

" ;} if ( level >= 20 ) { cout << " \t U - Force Enlighten

" ;} if ( level >= 24 ) { cout << " \t I - Crush

" ;} cout << " \t I - Use Item

" ; while ( level <= 1000 ) { cin >> ichoose ; if ( ichoose == 'Q' || ichoose == 'q' ) { Aname = "Slash" ; break ; } else if ( ichoose == 'W' || ichoose == 'w' ) { Aname = "Force Lightening" ; break ; } else if (( ichoose == 'E' || ichoose == 'e' ) && ( level >= 4 )) { Aname = "Strom" ; break ; } else if (( ichoose == 'R' || ichoose == 'r' ) && ( level >= 8 )) { Aname = "Choke" ; break ; } if (( ichoose == 'T' || ichoose == 't' ) && ( level >= 12 )) { Aname = "Force Push" ; break ; } else if (( ichoose == 'Y' || ichoose == 'y' ) && ( level >= 16 )) { Aname = "Force Slam" ; break ; } else if (( ichoose == 'U' || ichoose == 'u' ) && ( level >= 20 )) { Aname = "Force Englighten" ; break ; } else if (( ichoose == 'O' || ichoose == 'o' ) && ( level >= 24 )) { Aname = "Crush" ; break ; } else { cout << "invald opperation" << endl ; system ( "pause" ); system ( "CLS" ); JCAttack (); } } } void ChooseEnemy () { system ( "CLS" ); char ichoose ; int enemy = 0 , chance = 0 ; srand ( time ( NULL )); if ( scenery == 1 ) { enemy = rand () % 5 + 1 ; //random from 1 to 5 } else if ( scenery == 2 ) { enemy = rand () % 7 + 2 ; //random from 2 to 3 } else if ( scenery == 3 ) { enemy = rand () % 9 + 2 ; //random from 2 to 4 } else if ( scenery == 4 ) { enemy = rand () % 11 + 3 ; //random from 3 to 7 } else if ( scenery == 5 ) { enemy = rand () % 19 + 1 ; //random from 1 to 8 } if ( enemy == 1 ) { FightEn1 ();} else if ( enemy == 2 ) { FightEn2 ();} else if ( enemy == 3 ) { FightEn3 ();} else if ( enemy == 4 ) { FightEn4 ();} else if ( enemy == 5 ) { FightEn5 ();} else if ( enemy == 6 ) { FightEn6 ();} else if ( enemy == 7 ) { FightEn7 ();} else if ( enemy == 8 ) { FightEn8 ();} else if ( enemy == 9 ) { FightEn9 ();} else if ( enemy == 10 ) { FightEn10 ();} else if ( enemy == 11 ) { FightEn11 ();} else if ( enemy == 12 ) { FightEn12 ();} else if ( enemy == 13 ) { FightEn13 ();} else if ( enemy == 14 ) { FightEn14 ();} else if ( enemy == 15 ) { FightEn15 ();} else if ( enemy == 16 ) { FightEn16 ();} else if ( enemy == 17 ) { FightEn17 ();} else if ( enemy == 18 ) { FightEn18 ();} else if ( enemy == 19 ) { FightEn19 ();} else if ( enemy == 20 ) { FightBoss ();} else { cout << "Something went wrong here

" ; MainMenu ();} FightEn (); } void FightEn () // So I can manually choose eneny later in the game during quests for example { cout << "Wild " << enname << " appeared!

" ; // LOL do { if ( abot == 1 && tries > 0 && choice2 != "N" && choice2 != "n" ) //potion uses won't go down if you just decided not to use an item { cout << "Your potion is active...

" ; attack = ( attackMax + 5 ); tries -= 1 ; if ( tries == 0 ) { cout << "Your potion has run out

" << endl ; } } else { attack = attackMax ; abot = 0 ; } FightStats (); cout << "What will " << charname << " do?

" ; /*cout << "\tZ - Slash

\tX - Body Slam

"; // if unlocked others, they will appear too if (level >= 4) {cout << "\tC - Flamethrower

";} if (level >= 13) {cout << "\tV - Thunder

";} */ if ( Class == 'M' ) { MCAttack ();} else if ( Class == 'W' ) { WCAttack (); } else if ( Class == 'R' ) { RCAttack (); } else if ( Class == 'J' ) { JCAttack ();} //cin >> ichoose; int chance ; system ( "CLS" ); chance = (( rand () % 100 + 1 ) - acc ); choice2 = "A" ; //Default set for the test after UseItem(); /////////////////////////////////////////////////////////////////////////////////////////// if ( ichoose == 'Z' || ichoose == 'z' ) { if ( chance <= 90 ) //90% chance { enhealth -= attack ; cout << Aname << " dealt " << attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if ( ichoose == 'X' || ichoose == 'x' ) { if ( chance <= 80 ) { enhealth -= 2 * attack ; cout << Aname << " dealt " << 2 * attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if (( ichoose == 'C' || ichoose == 'c' ) && ( level >= 4 )) { if ( chance <= 70 ) { enhealth -= 3 * attack ; cout << Aname << " dealt " << 3 * attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if (( ichoose == 'B' || ichoose == 'b' ) && ( level >= 8 )) { if ( chance <= 60 ) { enhealth -= 4 * attack ; cout << Aname << " dealt " << 4 * attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if (( ichoose == 'N' || ichoose == 'n' ) && ( level >= 12 )) { if ( chance <= 50 ) { enhealth -= 5 * attack ; cout << Aname << " dealt " << 5 * attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if (( ichoose == 'M' || ichoose == 'm' ) && ( level >= 16 )) { if ( chance <= 40 ) { enhealth -= 6 * attack ; cout << Aname << " dealt " << 6 * attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if (( ichoose == 'L' || ichoose == 'l' ) && ( level >= 20 )) { if ( chance <= 20 ) { enhealth -= 7 * attack ; cout << Aname << " dealt " << 7 * attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if (( ichoose == 'K' || ichoose == 'k' ) && ( level >= 24 )) { if ( chance <= 10 ) { enhealth -= 8 * attack ; cout << Aname << " dealt " << 8 * attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if (( ichoose == 'Q' || ichoose == 'q' ) && ( Class = 'J' )) { if ( chance <= 60 ) { enhealth -= attack ; cout << Aname << " dealt " << attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if (( ichoose == 'W' || ichoose == 'w' ) && ( Class = 'J' )) { if ( chance <= 60 ) { enhealth -= 2 * attack ; cout << Aname << " dealt " << 2 * attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if (( ichoose == 'E' || ichoose == 'e' ) && ( level >= 4 ) && ( Class = 'J' )) { if ( chance <= 60 ) { enhealth -= 3 * attack ; cout << Aname << " dealt " << 3 * attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if (( ichoose == 'R' || ichoose == 'r' ) && ( level >= 8 ) && ( Class = 'J' )) { if ( chance <= 60 ) { enhealth -= 4 * attack ; cout << Aname << " dealt " << 4 * attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if (( ichoose == 'T' || ichoose == 't' ) && ( level >= 12 ) && ( Class = 'J' )) { if ( chance <= 60 ) { enhealth -= 5 * attack ; cout << Aname << " dealt " << 5 * attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if (( ichoose == 'Y' || ichoose == 'y' ) && ( level >= 16 ) && ( Class = 'J' )) { if ( chance <= 60 ) { enhealth -= 6 * attack ; cout << Aname << " dealt " << 6 * attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if (( ichoose == 'U' || ichoose == 'u' ) && ( level >= 20 ) && ( Class = 'J' )) { if ( chance <= 60 ) { enhealth -= 7 * attack ; cout << Aname << " dealt " << 7 * attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if ( ichoose == 'O' || ichoose == 'o' ) { if ( chance <= 60 ) { enhealth -= 10 * attack ; cout << Aname << " dealt " << 10 * attack << " damage!

" ; } else { cout << "The attack missed!

" ; } } else if ( ichoose == 'I' || ichoose == 'i' ) { UseItem (); } // For now, this doesn't mean he loses a turn. Do you think he should? //actually, he does - see below else { cout << charname << " forfeited the turn!

" ;} if ( choice2 != "N" && choice2 != "n" ) //Tests whether you used a potion - if you did, you lose the turn. If you just pressed "return" i.e. looked at how many potions you had but did not want to use one, you are not penalised. { if ( enhealth > 0 ) //enemy strikes back! { cout << enname << " used " << enatname << ".

" ; chance = rand () % 100 + 1 ; if ( chance <= enacc ) { middleman = enattack - defence ; if ( middleman <= 0 ) { middleman = 1 ; } health -= middleman ; cout << enname << " dealt " << enattack << " damage!

" ; } else { cout << enname << " missed!

" ;} } } } while ( health > 0 && enhealth > 0 ); if ( health < 0 ) { Die ();} else //i.e. enemy dead { exper += enexper ; gold += engold ; cout << "Enemy defeated! You gained: " << setw ( 10 ) << enexper << " experience and " << engold << " gold!

" ; cout << "You now have " << exper << " experience points!



" ; cout << "You now have " << gold << " gold in your pouch!



" ; if ( exper > 100000 ) { WinGame (); } if ( exper >= nextLevel ) { LevelUp (); } //chance of finding an item - items and chances dependent on enemy. Add later? system ( "pause" ); system ( "CLS" ); MainMenu (); } } int main () { srand ( time ( NULL )); system ( "TITLE FIRST RPG" ); system ( "CLS" ); cout << "New Game - X

Load Game - Y" << endl ; cin >> E ; if ( E == 'Y' || E == 'y' ) { Load ();} IntroA (); MainMenu (); } void IntroA () { char cA ; do { cout << "Hi, my name is Prof Oak, what was yours again?" << endl ; cin >> charname ; cout << "Was that '" << charname << "'?

(y or n)" ; cin >> cA ; } while ( cA != 'y' && cA != 'Y' ); cA = 'a' ; do { system ( "CLS" ); cout << "So, " << charname << ", in this RPG, you have stats, for example:" << endl ; getchar (); cout << health << " is how much health I have. When this drops to 0, GAME OVER." << endl ; getchar (); cout << attack << " is how many attack points I have. This value matters when trying do deal

damage to enemies." << endl ; getchar (); cout << "In this game, you fight monsters. There are 7 normal monsters and the boss." << endl ; getchar (); cout << "Beat the boss to win the game!" << endl ; getchar (); cout << "You have 8 different attacks. They will deal different multiples of your attack stat.

As you level up, you unlock more of them." << endl ; getchar (); cout << "But be careful; the more damage an attack does, the riskier it is to use - you

are more likely to miss." << endl ; getchar (); cout << "Killing monsters will help you grow, and as you grow, so do your stats.

Every time you level up, you can choose to allocate your points." << endl ; getchar (); cout << "The accuracy stat will increase your chance of hitting the target,

while the defence stat will decrease the damage you take." << endl ; getchar (); cout << "You can buy potions and equipment from the shop specific to your class." << endl ; getchar (); cout << "Go to the tavern for some minigames to kill time, or just grind!" << endl ; getchar (); cout << "Did you get all that, " << charname << "?

(y or n)

" ; cin >> cA ; system ( "CLS" ); } while ( cA != 'y' && cA != 'Y' ); Intro (); } void MainMenu () { system ( "CLS" ); if ( dead == 0 ) //so if you're dead the game should just end because it will go back to main { char choice ; cout << "What would you like to do?

Currently in: world no. " << scenery << "

\t F - Fight Enemy

\t M - Move Scenery

\t S - Show Stats

\t I - Use Item



\t B - Shop

\t T - Tavern

\t G - Save

" ; cin >> choice ; if ( choice == 'F' || choice == 'f' ) { ChooseEnemy ();} else if ( choice == 'M' || choice == 'm' ) { MoveScene ();} else if ( choice == 'I' || choice == 'i' ) { UseItem (); MainMenu ();} //this should solve the problem with UseItem(); else if ( choice == 'S' || choice == 's' ) { Stats ();} else if ( choice == 'B' || choice == 'b' ) { Shop ();} else if ( choice == 'T' || choice == 't' ) { Tavern ();} else if ( choice == 'G' || choice == 'g' ) { Save ();} else cout << "Incorrect input

" ; system ( "PAUSE" ); { MainMenu ();} } } void Load () { system ( "CLS" ); ifstream statsin ; statsin . open ( "stats.txt" ); if ( ! statsin ) { cout << "You must save a game to load it!

If you have saved it before, please return the game for a full refund." << endl ; system ( "pause" ); main (); } statsin >> charname >> scenery >> attack >> healthMax >> attackMax >> health >> level >> exper >> nextLevel >> dead >> apot >> hpot >> spot >> upot >> uupot >> empot >> aupot >> hupot >> gold >> acc >> set >> Class ; statsin . close (); cout << charname << " loaded the game!

" ; system ( "pause" ); MainMenu (); } void Save () { system ( "CLS" ); cout << "Save Game - S

Main Menu - Q" << endl ; cin >> E ; if ( E == 'S' || E == 's' ) { ofstream statsout ; statsout . open ( "stats.txt" ); statsout << charname << " " << scenery << " " << attack << " " << healthMax << " " << attackMax << " " << health << " " << level << " " << exper << " " << nextLevel << " " << dead << " " << apot << " " << hpot << " " << spot << " " << upot << " " << uupot << " " << empot << " " << aupot << " " << hupot << " " << gold << " " << acc << " " << set << " " << Class ; statsout . close (); cout << charname << " saved the game!

" ; system ( "pause" ); } MainMenu (); } /*( void FightStats() { cout << setw(12) << charname << " " << setw(20) << enname << endl; cout << "Health:\t" << setw(12) << health << setw(20) << enhealth << endl; cout << "Attack:\t" << setw(12) << attack << setw(20) << enattack << endl; } */ void Stats () { system ( "CLS" ); attack = attackMax ; cout << set << " " << charname << endl ; cout << setw ( 12 ) << "Health: " << health << "/" << healthMax << endl ; cout << setw ( 12 ) << "Attack: " << attack << endl ; //Only shows base stats, not if he has both an AP and an AUP on for now. cout << setw ( 12 ) << "Accuracy: " << acc << endl ; cout << setw ( 12 ) << "Defence: " << attack << endl ; cout << setw ( 12 ) << "Level: " << level << endl ; cout << setw ( 12 ) << "Experience: " << exper << setw ( 19 ) << "NEXT LEVEL AT: " << nextLevel << " EXPERIENCE



" ; cout << setw ( 12 ) << "Attacks: " << " " << setw ( 10 ) << "Power:" << setw ( 12 ) << "Accuracy %:" << endl ; if ( Class == 'M' ) { cout << setw ( 12 ) << "Flame Arrow" << " - " << setw ( 10 ) << attack << setw ( 12 ) << ( 90 + acc ) << "

" ; cout << setw ( 12 ) << "Ice Arrow" << " - " << setw ( 10 ) << 2 * attack << setw ( 12 ) << ( 80 + acc ) << "

" ; if ( level >= 4 ) { cout << setw ( 12 ) << "Strom Arrown" << " - " << setw ( 10 ) << 3 * attack << setw ( 12 ) << ( 70 + acc ) << "

" ;} if ( level >= 8 ) { cout << setw ( 12 ) << "FireBall" << " - " << setw ( 10 ) << 4 * attack << setw ( 12 ) << ( 60 + acc ) << "

" ;} if ( level >= 12 ) { cout << setw ( 12 ) << "IceSpear" << " - " << setw ( 10 ) << 5 * attack << setw ( 12 ) << ( 50 + acc ) << "

" ;} if ( level >= 16 ) { cout << setw ( 12 ) << "Thunder" << " - " << setw ( 10 ) << 6 * attack << setw ( 12 ) << ( 40 + acc ) << "

" ;} if ( level >= 20 ) { cout << setw ( 12 ) << "Sun" << " - " << setw ( 10 ) << 7 * attack << setw ( 12 ) << ( 30 + acc ) << "

" ;;} if ( level >= 24 ) { cout << setw ( 12 ) << "Gravity" << " - " << setw ( 10 ) << 8 * attack << setw ( 12 ) << ( 20 + acc ) << "

" ;} /*if (level >= 4) {cout << setw(12) << "Flamethrower" << " - " << setw(10) << 3*attack << setw(12) << "45" << "

"; if (level >= 7) {cout << setw(12) << "Thunder" << " - " << setw(10) << 10*attack << setw(12) << "8" << "

";} */ } else if ( Class == 'W' ) { cout << setw ( 12 ) << "Slash" << " - " << setw ( 10 ) << attack << setw ( 12 ) << ( 90 + acc ) << "

" ; cout << setw ( 12 ) << "Body Slam" << " - " << setw ( 10 ) << 2 * attack << setw ( 12 ) << ( 80 + acc ) << "

" ; if ( level >= 4 ) { cout << setw ( 12 ) << "Repost" << " - " << setw ( 10 ) << 3 * attack << setw ( 12 ) << ( 70 + acc ) << "

" ;} if ( level >= 8 ) { cout << setw ( 12 ) << "Pommel Strike" << " - " << setw ( 10 ) << 4 * attack << setw ( 12 ) << ( 60 + acc ) << "

" ;} if ( level >= 12 ) { cout << setw ( 12 ) << "Push" << " - " << setw ( 10 ) << 5 * attack << setw ( 12 ) << ( 50 + acc ) << "

" ;} if ( level >= 16 ) { cout << setw ( 12 ) << "Slap" << " - " << setw ( 10 ) << 6 * attack << setw ( 12 ) << ( 40 + acc ) << "

" ;} if ( level >= 20 ) { cout << setw ( 12 ) << "Kamikaze" << " - " << setw ( 10 ) << 7 * attack << setw ( 12 ) << ( 30 + acc ) << "

" ;;} if ( level >= 24 ) { cout << setw ( 12 ) << "Charge" << " - " << setw ( 10 ) << 8 * attack << setw ( 12 ) << ( 20 + acc ) << "

" ;} } else if ( Class == 'R' ) { cout << setw ( 12 ) << "Arrow" << " - " << setw ( 10 ) << attack << setw ( 12 ) << ( 90 + acc ) << "

" ; cout << setw ( 12 ) << "Ice Shot" << " - " << setw ( 10 ) << 2 * attack << setw ( 12 ) << ( 80 + acc ) << "

" ; if ( level >= 4 ) { cout << setw ( 12 ) << "Storm Shot" << " - " << setw ( 10 ) << 3 * attack << setw ( 12 ) << ( 70 + acc ) << "

" ;} if ( level >= 8 ) { cout << setw ( 12 ) << "Bomb Shot" << " - " << setw ( 10 ) << 4 * attack << setw ( 12 ) << ( 60 + acc ) << "

" ;} if ( level >= 12 ) { cout << setw ( 12 ) << "Bludgeon" << " - " << setw ( 10 ) << 5 * attack << setw ( 12 ) << ( 50 + acc ) << "

" ;} if ( level >= 16 ) { cout << setw ( 12 ) << "Triple Shot" << " - " << setw ( 10 ) << 6 * attack << setw ( 12 ) << ( 40 + acc ) << "

" ;} if ( level >= 20 ) { cout << setw ( 12 ) << "Arrow to Face" << " - " << setw ( 10 ) << 7 * attack << setw ( 12 ) << ( 30 + acc ) << "

" ;;} if ( level >= 24 ) { cout << setw ( 12 ) << "Arrow to Knee" << " - " << setw ( 10 ) << 8 * attack << setw ( 12 ) << ( 20 + acc ) << "

" ;} } else if ( Class == 'J' ) { cout << setw ( 12 ) << "Slash" << " - " << setw ( 10 ) << attack << setw ( 12 ) << ( 90 + acc ) << "

" ; cout << setw ( 12 ) << "Force Lightening" << " - " << setw ( 10 ) << 2 * attack << setw ( 12 ) << ( 80 + acc ) << "

" ; if ( level >= 4 ) { cout << setw ( 12 ) << "Strom" << " - " << setw ( 10 ) << 3 * attack << setw ( 12 ) << ( 70 + acc ) << "

" ;} if ( level >= 8 ) { cout << setw ( 12 ) << "Choke" << " - " << setw ( 10 ) << 4 * attack << setw ( 12 ) << ( 60 + acc ) << "

" ;} if ( level >= 12 ) { cout << setw ( 12 ) << "Force Push" << " - " << setw ( 10 ) << 5 * attack << setw ( 12 ) << ( 50 + acc ) << "

" ;} if ( level >= 16 ) { cout << setw ( 12 ) << "Force Slam" << " - " << setw ( 10 ) << 6 * attack << setw ( 12 ) << ( 40 + acc ) << "

" ;} if ( level >= 20 ) { cout << setw ( 12 ) << "Force Englighten" << " - " << setw ( 10 ) << 7 * attack << setw ( 12 ) << ( 30 + acc ) << "

" ;;} if ( level >= 24 ) { cout << setw ( 12 ) << "Crush" << " - " << setw ( 10 ) << 8 * attack << setw ( 12 ) << ( 20 + acc ) << "

" ;} } system ( "pause" ); //getchar basically system ( "CLS" ); MainMenu (); } /* void ChooseEnemy() { char ichoose; int enemy = 0, chance = 0; srand(time(NULL)); if (scenery == 1) { enemy = rand() % 2 + 1; //random from 1 to 2 } else if (scenery == 2) { enemy = rand() % 2 + 2; //random from 2 to 3 } else if (scenery == 3) { enemy = rand() % 3 + 2; //random from 2 to 4 } else if (scenery == 4) { enemy = rand() % 5 + 3; //random from 3 to 7 } else if (scenery == 5) { enemy = rand() % 8 + 1; //random from 1 to 8 } if (enemy == 1) {FightEn1();} else if (enemy == 2) {FightEn2();} else if (enemy == 3) {FightEn3();} else if (enemy == 4) {FightEn4();} else if (enemy == 5) {FightEn5();} else if (enemy == 6) {FightEn6();} else if (enemy == 7) {FightEn7();} else if (enemy == 8) {FightBoss();} else {cout << "Something went wrong here

"; MainMenu();} cout << "Wild " << enname << " appeared!

"; // LOL do { if (abot == 1 && tries > 0 && choice2 != "N" && choice2 != "n") //potion uses won't go down if you just decided not to use an item { cout << "Your potion is active...

"; attack = (attackMax + 5); tries -= 1; if (tries == 0) { cout << "Your potion has run out

" << endl; } } else { attack = attackMax; abot = 0; } FightStats(); cout << "What will " << charname << " do?

"; cout << "\tZ - Slash

\tX - Body Slam

"; // if unlocked others, they will appear too if (level >= 4) {cout << "\tC - Flamethrower

";} if (level >= 13) {cout << "\tV - Thunder

";} cout << "\tI - Use Item

"; cin >> ichoose; system("CLS"); chance = rand() % 100 + 1; choice2 = "A"; //Default set for the test after UseItem(); if (ichoose == 'Z' || ichoose == 'z') { if (chance <= 90) //90% chance { enhealth -= attack; cout << "Slash dealt " << attack << " damage!

"; } else { cout << "The attack missed!

"; } } else if (ichoose == 'X' || ichoose == 'x') { if (chance <= 60) //60% chance { enhealth -= 2*attack; cout << "Body slam dealt " << 2*attack << " damage!

"; } else { cout << "The attack missed!

"; } } else if ((ichoose == 'C' || ichoose == 'c') && level >= 4) { if (chance <= 45) //45% chance { enhealth -= 3*attack; cout << "Flamethrower dealt " << 3*attack << " damage!

"; } else { cout << "The attack missed!

"; } } else if ((ichoose == 'V' || ichoose == 'v') && level >= 13) { if (chance <= 8) //8% chance { enhealth -= 10*attack; cout << "Thunder dealt " << 10*attack << " damage!

"; } else { cout << "The attack missed!

"; } } else if (ichoose == 'I' || ichoose == 'i') { UseItem();} // For now, this doesn't mean he loses a turn. Do you think he should? //actually, he does - see below else {cout << charname << " forfeited the turn!

";} if (choice2 != "N" && choice2 != "n") //Tests whether you used a potion - if you did, you lose the turn. If you just pressed "return" i.e. looked at how many potions you had but did not want to use one, you are not penalised. { if (enhealth > 0) //enemy strikes back! { cout << enname << " used " << enatname << ".

"; chance = rand() % 100 + 1; if (chance <= enacc) {health -= enattack; cout << enname << " dealt " << enattack << " damage!

"; } else {cout << enname << " missed!

";} } } } while (health > 0 && enhealth > 0); if (health < 0) {Die();} else //i.e. enemy dead { exper += enexper; gold += engold; cout << "Enemy defeated! You gained: " << setw(10)<< enexper << " experience and " << engold << " gold!

"; cout << "You now have " << exper << " experience points!



"; cout << "You now have " << gold << " gold in your pouch!



"; if (exper > 100000) { WinGame(); } if (exper >= nextLevel) { LevelUp(); } //chance of finding an item - items and chances dependent on enemy. Add later? system("pause"); system("CLS"); MainMenu(); } } */ //HP is their health, ATRT is attack rate, i.e. attack * accuracy / 100%. void FightEn1 () //Weak enemy HP 9, ATRT 1.8, GD 5, EXP 4 { enname = "Mini Frog" ; enattack = 2 ; enhealth = 50 ; enacc = 90 ; enatname = "Lick" ; enexper = 4 ; engold = 5 ; // The money they win from the battle, to later use in the shop } void FightEn2 () //A bit stronger but tends to miss HP 20, ATRT 2.5, GD 10, EXP 7 { enname = "Rotten Newt" ; enattack = 5 ; enhealth = 100 ; enacc = 50 ; enatname = "Spew" ; enexper = 7 ; engold = 10 ; } void FightEn3 () //Better for attack HP 25, ATRT 5.6, GD 20, EXP 13 { enname = "Spotted Toad" ; enattack = 8 ; enhealth = 150 ; enacc = 70 ; enatname = "Poison Breath" ; enexper = 13 ; engold = 20 ; } void FightEn4 () //A big step up all round HP 40, ATRT 9, GD 50, EXP 23 { enname = "Saltwater Crocodile" ; enattack = 10 ; enhealth = 200 ; enacc = 90 ; enatname = "Great Bite" ; enexper = 23 ; engold = 50 ; } //Added some new guys in, cause otherwise it was too easy. Gone with a more desert theme now though. Its going to get a LOT harder in this game ;). void FightEn5 () //The sniper - never failing to hit. Not as much health and less gold HP 35, ATRT 11, GD 30, EXP 29 { enname = "Desert Snake" ; //Meh enattack = 11 ; //For 100% accuracy these stats were a bit harsh (the snake was way harder than the meerkat) so I lowered them enhealth = 250 ; enacc = 100 ; enatname = "Poison Sting" ; enexper = 37 ; //prime numbers please :) engold = 30 ; } void FightEn6 () //The tank - high HP but not good for attack. Less exp but more gold HP 100, ATRT 8, GD 130, EXP 23 { enname = "Angry Meercat" ; enattack = 20 ; enhealth = 200 ; enacc = 80 ; enatname = "Slap" ; enexper = 29 ; engold = 130 ; } void FightEn7 () //Very strong and lots of health, but low acc. Good for gold, very good for exp HP 150, ATRT 12 GD 200 EXP { enname = "Rabid Koala" ; enattack = 27 ; enhealth = 400 ; enacc = 50 ; enatname = "Brain Chomp" ; enexper = 87 ; engold = 200 ; } void FightEn8 () //Very strong and lots of health, but low acc. Good for gold, very good for exp HP 150, ATRT 12 GD 200 EXP { enname = "Rabid Koala" ; enattack = 27 ; enhealth = 400 ; enacc = 50 ; enatname = "Brain Chomp" ; enexper = 87 ; engold = 200 ; } void FightEn9 () //Very strong and lots of health, but low acc. Good for gold, very good for exp HP 150, ATRT 12 GD 200 EXP { enname = "Rabid Koala" ; enattack = 27 ; enhealth = 400 ; enacc = 50 ; enatname = "Brain Chomp" ; enexper = 87 ; engold = 200 ; } void FightEn10 () //Very strong and lots of health, but low acc. Good for gold, very good for exp HP 150, ATRT 12 GD 200 EXP { enname = "Arbok" ; enattack = 27 ; enhealth = 500 ; enacc = 70 ; enatname = "Poison Sting" ; enexper = 87 ; engold = 200 ; } void FightEn11 () //Very strong and lots of health, but low acc. Good for gold, very good for exp HP 150, ATRT 12 GD 200 EXP { enname = "Muk" ; enattack = 29 ; enhealth = 600 ; enacc = 50 ; enatname = "Smog" ; enexper = 87 ; engold = 250 ; } void FightEn12 () //Very strong and lots of health, but low acc. Good for gold, very good for exp HP 150, ATRT 12 GD 200 EXP { enname = "Zubat" ; enattack = 31 ; enhealth = 700 ; enacc = 60 ; enatname = "Screech" ; enexper = 87 ; engold = 300 ; } void FightEn13 () //Very strong and lots of health, but low acc. Good for gold, very good for exp HP 150, ATRT 12 GD 200 EXP { enname = "Zubat" ; enattack = 33 ; enhealth = 800 ; enacc = 50 ; enatname = "Annoy" ; enexper = 87 ; engold = 350 ; } void FightEn14 () //Very strong and lots of health, but low acc. Good for gold, very good for exp HP 150, ATRT 12 GD 200 EXP { enname = "Golbat" ; enattack = 35 ; enhealth = 900 ; enacc = 70 ; enatname = "Confusion" ; enexper = 87 ; engold = 400 ; } void FightEn15 () //Very strong and lots of health, but low acc. Good for gold, very good for exp HP 150, ATRT 12 GD 200 EXP { enname = "Alakazam" ; enattack = 37 ; enhealth = 1000 ; enacc = 100 ; enatname = "Psybeam" ; enexper = 87 ; engold = 450 ; } void FightEn16 () //Very strong and lots of health, but low acc. Good for gold, very good for exp HP 150, ATRT 12 GD 200 EXP { enname = "MegaMan" ; enattack = 39 ; enhealth = 1100 ; enacc = 50 ; enatname = "Electricute" ; enexper = 87 ; engold = 500 ; } void FightEn17 () //Very strong and lots of health, but low acc. Good for gold, very good for exp HP 150, ATRT 12 GD 200 EXP { enname = "Kid Muscle" ; enattack = 55 ; enhealth = 1200 ; enacc = 20 ; enatname = "Butt Buster" ; enexper = 87 ; engold = 550 ; } void FightEn18 () //Very strong and lots of health, but low acc. Good for gold, very good for exp HP 150, ATRT 12 GD 200 EXP { enname = "NEET" ; enattack = 43 ; enhealth = 1300 ; enacc = 50 ; enatname = "Hack" ; enexper = 87 ; engold = 600 ; } void FightEn19 () //Very strong and lots of health, but low acc. Good for gold, very good for exp HP 150, ATRT 12 GD 200 EXP { enname = "Kid Buu" ; enattack = 45 ; enhealth = 1400 ; enacc = 50 ; enatname = "Fusion" ; enexper = 87 ; engold = 650 ; } void FightBoss () //Strong all round HP 500, 21 { enname = "Giant Anaconda" ; enattack = 47 ; enhealth = 2000 ; //Holy shit! enacc = 75 ; enatname = "Big Squeeze" ; engold = 50000 ; // For whatever its worth :) enexper = 100000 ; //maybe to win the game you have to get 100000 exp? } /* void LevelUp() { attackMax += 2; attack = attackMax; healthMax += 5; health = healthMax; //a nice bonus - you get fully healed when you level up. Probably will remove later but useful for debug at least! level += 1; nextLevel = (nextLevel + 17*(level-1) + 10); //so basically level ups are at 10,37,81,142,220,315,427,556,702,865,1045,1242,1456,1687,1935. cout << "Well done, you have leveled up!

"; //with corresponding level: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15. cout << "\tLevel: " << level << "

"; //haven't yet tested it but it feels about right given the amount of exp per battle. If you think cout << "\tMax Health: " << healthMax << "

"; //that it needs changing tell me because the formula is a bit of a congusion to all of us :S cout << "\tAttack: " << attack << "

"; if (level == 3) {cout << "



ATTENTION!

You have gained access to the second world, Green Marshes!

To go there choose 'move scene'.

";} if (level == 4) {cout << "



ATTENTION!

You have gained a new ability: Flamethrower!

";} if (level == 5) {cout << "



ATTENTION!

You have gained access to the third world, Deep Swamp!

To go there choose 'move scene'.

";} if (level == 13) {cout << "



ATTENTION!

You have gained a new ability: Thunder!

Use it well...

";} if (level == 9) {cout << "



ATTENTION!

You have gained access to the fourth world, Harsh Desert!

To go there choose 'move scene'.

";} if (level == 15) {cout << "



ATTENTION!

You have gained the opportunity to fight the Boss at Deadly Chasm!

You can fight him by choosing 'move scene'.

Prepare well, because it's all over if you die!";} cin.get(); } */ void MoveScene () { system ( "CLS" ); int choiceC ; cout << "What world would you like to travel to?

" ; if ( level >= 0 && level < 3 ) { cout << " \t World 1 - The Plains (1)

" ; cin >> choiceC ; if ( choiceC = 1 ) { scenery = 1 ; cout << "You are now in world " << scenery << "!" << endl ; system ( "pause" ); MainMenu (); } else { cout << "Incorrect choice" << endl ; system ( "pause" ); MoveScene (); } } else if ( level >= 3 && level < 5 ) { cout << " \t World 1 - The Plains (1)

\t World 2 - Green Marshes (2)

" << endl ; cin >> choiceC ; if ( choiceC == 1 || choiceC == 2 ) { scenery = choiceC ; cout << "You are now in world " << scenery << "!" << endl ; system ( "pause" ); MainMenu (); } else { cout << "Incorrect choice" << endl ; system ( "pause" ); MoveScene (); } } else if ( level >= 5 && level < 9 ) { cout << " \t World 1 - The Plains (1)

\t World 2 - Green Marshes (2)

\t World 3 - Deep Swamp (3)

" << endl ; cin >> choiceC ; if ( choiceC >= 1 && choiceC <= 3 ) { scenery = choiceC ; cout << "You are now in world " << scenery << "!" << endl ; system ( "pause" ); MainMenu (); } else { cout << "Incorrect choice" << endl ; system ( "pause" ); MoveScene (); } } else if ( level >= 9 && level < 15 ) { cout << " \t World 1 - The Plains (1)

\t World 2 - Green Marshes (2)

\t World 3 - Deep Swamp (3)

\t World 4 - Harsh Desert(4)

" ; cin >> choiceC ; if ( choiceC >= 1 && choiceC <= 4 ) { scenery = choiceC ; cout << "You are now in world " << scenery << "!" << endl ; system ( "pause" ); MainMenu (); } else { cout << "Incorrect choice" << endl ; system ( "pause" ); MoveScene (); } } else if ( level >= 15 ) { cout << " \t World 1 - The Plains (1)

\t World 2 - Green Marshes (2)

\t World 3 - Deep Swamp (3)

\t World 4 - Harsh Desert (4)

\t World BOSS - Deadly Chasm (5)

" << endl ; cin >> choiceC ; if ( choiceC >= 1 && choiceC <= 5 ) { scenery = choiceC ; cout << "You are now in world " << scenery << "!" << endl ; if ( choiceC == 5 ) { cout << "Watch out for the boss - he will be very strong...

" ;} system ( "pause" ); MainMenu (); } else { cout << "Incorrect choice" << endl ; system ( "pause" ); MoveScene (); } } } void UseItem () { system ( "CLS" ); cout << "What would you like to use?

" << "

\t HP - Health potion (" << hpot << " remaining)" << endl << " \t SP - Super potion (" << spot << " remaining)

" ; cout << " \t UP - Ultra Potion (" << upot << " remaining)

" ; cout << "

\t UUP - Uber potion (" << uupot << " remaining)" << endl << " \t EMP - EPIC MASTER potion (" << empot << " remaining)

\t AP - Attack Potion (" << apot << " remaining)

" ; cout << "

\t AUP - Attack Up potion (" << aupot << " remaining)" << endl << " \t HUP - Health Up potion (" << hupot << " remaining)

\t N - return

" ; cin >> choice2 ; if ( choice2 == "HP" || choice2 == "hp" ) { Healthpot ();} else if ( choice2 == "SP" || choice2 == "sp" ) { Superpot ();} else if ( choice2 == "UP" || choice2 == "up" ) { Ultrapot ();} else if ( choice2 == "UUP" || choice2 == "uup" ) { Uberpot ();} else if ( choice2 == "EMP" || choice2 == "emp" ) { EMpot ();} else if ( choice2 == "AUP" || choice2 == "aup" ) { AUpot ();} else if ( choice2 == "AP" || choice2 == "ap" ) { Attpot ();} else if ( choice2 == "HUP" || choice2 == "hup" ) { HUpot ();} else if ( choice2 == "N" || choice2 == "n" ) { //do nothing; it will automatically return to either the battle or the shop } else { cout << "Incorrect input

" ; system ( "PAUSE" ); UseItem (); } system ( "pause" ); system ( "CLS" ); } void Shop () { system ( "CLS" ); string potion ; cout << "Welcome to the Swampmart, " << charname << "! How can I help you?

" << endl ; cout << "You have " << gold << " gold coins

" ; cout << "You can buy:

" ; cout << setw ( 35 ) << "Owned" << setw ( 20 ) << "Price" << endl ; cout << "Health Potion - 10 HP (HP): \t " << setw ( 12 ) << hpot << setw ( 20 ) << "10 Gold" << endl ; cout << "Attack Potion (AP): \t\t " << setw ( 12 ) << apot << setw ( 20 ) << "10 Gold" << endl << endl ; cout << "Super Potion - 20 HP (SP): \t " << setw ( 12 ) << spot << setw ( 20 ) << "20 Gold" << endl ; cout << "Ultra Potion - 35 HP (UP): \t " << setw ( 12 ) << upot << setw ( 20 ) << "40 Gold" << endl ; cout << "Uber Potion - 50 HP (UUP): \t " << setw ( 12 ) << uupot << setw ( 20 ) << "60 Gold" << endl << endl ; cout << "Attack Up - max +2 (AUP): \t " << setw ( 12 ) << aupot << setw ( 20 ) << "100 Gold" << endl ; cout << "Health Up - max +5 (HUP): \t " << setw ( 12 ) << hupot << setw ( 20 ) << "100 Gold" << endl << endl ; cout << "EPIC MASTER Potion - 100 HP (EMP): " << setw ( 9 ) << empot << setw ( 20 ) << "100 Gold" << endl << endl ; cout << "To leave us, press 'N' and return to the main menu



" ; cin >> potion ; //health if ( potion == "N" || potion == "n" ) { system ( "pause" ); MainMenu (); } if ( potion == "HP" || potion == "hp" ) { if ( gold < 10 ) { cout << "You don't have enough money! Go grind more!

" ; system ( "pause" ); Shop (); } else { gold -= 10 ; hpot += 1 ; cout << "You have bought a health potion.

You now have " << hpot << "." << endl ; system ( "pause" ); Shop (); } } //super else if ( potion == "SP" || potion == "sp" ) { if ( gold < 20 ) { cout << "You don't have enough money! Go grind more!

" ; system ( "pause" ); Shop (); } else { gold -= 20 ; spot += 1 ; cout << "You have bought a super potion.

You now have " << spot << "." << endl ; system ( "pause" ); Shop (); } } //ultra else if ( potion == "UP" || potion == "up" ) { if ( gold < 10 ) { cout << "You don't have enough money! Go grind more!

" ; system ( "pause" ); Shop (); } else { gold -= 40 ; upot += 1 ; cout << "You have bought an ultra potion.

You now have " << upot << "." << endl ; system ( "pause" ); Shop (); } } //uber else if ( potion == "UUP" || potion == "uup" ) { if ( gold < 60 ) { cout << "You don't have enough money! Go grind more!

" ; system ( "pause" ); Shop (); } else { gold -= 60 ; uupot += 1 ; cout << "You have bought an uber potion.

You now have " << uupot << "." << endl ; system ( "pause" ); Shop (); } } //epic master else if ( potion == "EMP" || potion == "emp" ) { if ( gold < 100 ) { cout << "You don't have enough money! Go grind more!

" ; system ( "pause" ); Shop (); } else { gold -= 100 ; empot += 1 ; cout << "You have bought a EPIC master potion.

You now have " << empot << "." << endl ; system ( "pause" ); Shop (); } } //attack else if ( potion == "AP" || potion == "ap" ) { if ( gold < 10 ) { cout << "You don't have enough money! Go grind more!

" ; system ( "pause" ); Shop (); } else { gold -= 10 ; apot += 1 ; cout << "You have bought a attack potion.

You now have " << apot << "." << endl ; system ( "pause" ); Shop (); } } //attack up else if ( potion == "AUP" || potion == "aup" ) { if ( gold < 100 ) { cout << "You don't have enough money! Go grind more!

" ; system ( "pause" ); Shop (); } else { gold -= 100 ; aupot += 1 ; cout << "You have bought an attack up potion.

You now have " << aupot << "." << endl ; system ( "pause" ); Shop (); } } //health up else if ( potion == "HUP" || potion == "hup" ) { if ( gold < 100 ) { cout << "You don't have enough money! Go grind more!

" ; system ( "pause" ); Shop (); } else { gold -= 100 ; hupot += 1 ; cout << "You have bought a health up potion.

You now have " << hupot << "." << endl ; system ( "pause" ); Shop (); } } else if ( potion == "rob" ) //so these are the cheats then. { cout << "Please, I'll give you anything, just don't shoot. How much money do you want?

" ; cin >> gold ; Shop (); } else if ( potion == "heal" ) { cout << "There is a local drug lord in store. He can make your health go up, if you want?

" ; cin >> healthMax ; health = healthMax ; Shop (); } else if ( potion == "power" ) { cout << "There is an armorer in store. He can make your attack go up, if you want?

" ; cin >> attackMax ; attack = attackMax ; Shop (); } else if ( potion == "exp" ) { cout << "There is a trainer in store. He can make your level go up, if you want?

" ; cin >> level ; Shop (); } else if ( potion == "new" ) { main (); } else if ( potion == "penis" ) { cout << " PPPPPPPP

" ; cout << " PP PP

" ; cout << " P PIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII

" ; cout << " P P | I

" ; cout << " P P | I

" ; cout << " P P | I

" ; cout << " P P | I

" ; cout << " P P | I

" ; cout << " P P | I

" ; cout << " PP PP | I

" ; cout << " PPPPPPPP IIIIIIIIIII

" ; cout << " PP PP | I

" ; cout << " P P | I

" ; cout << " P P | I

" ; cout << " P P | I

" ; cout << " P P | I

" ; cout << " P P | I

" ; cout << " P P | I

" ; cout << " P PIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII

" ; cout << " PP PP

" ; cout << " PPPPPPPP

" ; cout << " " ; } else { cout << "That is an invalid option

" ; system ( "pause" ); Shop (); } } void Healthpot () //this is a bit useless really isn't it?!? Changed all potion values. See what you think... { if ( hpot <= 0 ) { cout << "You don't have any remaining

" ; choice2 = "n" ; //so you don't get penalised when you return to battle } else { //I have not allowed the health to go above healthMax cout << "You have used a health potion

" ; health += 10 ; if ( health > healthMax ) { health = healthMax ;} hpot -= 1 ; cout << "You have " << hpot << " health potions remaining" << endl ; } } void Superpot () { if ( spot <= 0 ) { cout << "You don't have any remaining

" ; choice2 = "n" ; } else { cout << "You have used a super potion

" ; health += 20 ; if ( health > healthMax ) { health = healthMax ;} spot -= 1 ; cout << "You have " << spot << " super potions remaining" << endl ; } } void Ultrapot () { if ( upot <= 0 ) { cout << "You don't have any remaining

" ; choice2 = "n" ; } else { cout << "You have used aa ultra potion

" ; health += 35 ; if ( health > healthMax ) { health = healthMax ;} upot -= 1 ; cout << "You have " << upot << " ultra potions remaining" << endl ; } } void Uberpot () { if ( uupot <= 0 ) { cout << "You don't have any remaining

" ; choice2 = "n" ; } else { cout << "You have used an uber potion

" ; health += 50 ; if ( health > healthMax ) { health = healthMax ;} uupot -= 1 ; cout << "You have " << uupot << " uber potions remaining" << endl ; } } void EMpot () { if ( empot <= 0 ) { cout << "You don't have any remaining

" ; choice2 = "n" ; } else { cout << "You have used an EPIC Master potion

" ; health += 100 ; if ( health > healthMax ) { health = healthMax ;} empot -= 1 ; cout << "You have " << empot << " EPIC Master potions remaining" << endl ; } } void AUpot () { if ( aupot <= 0 ) { cout << "You don't have any remaining

" ; choice2 = "n" ; } else { cout << "You have used an Attack Up potion

Your max attack has increased permenantly by 2" ; attackMax += 2 ; aupot -= 1 ; cout << "You have " << aupot << " attack up potions remaining" << endl ; } } void HUpot () { if ( hupot <= 0 ) { cout << "You don't have any remaining

" ; choice2 = "n" ; } else { cout << "You have used an Health Up potion

Your max health has increased permenantly by 5" ; healthMax += 5 ; hupot -= 1 ; cout << "You have " << aupot << " health up potions remaining" << endl ; } } void Attpot () { if ( apot <= 0 ) { cout << "You don't have any remaining

" ; choice2 = "n" ; } else { cout << "You have used an attack potion

" ; apot -= 1 ; cout << "You have " << apot << " attack potions remaining" << endl ; abot = 1 ; tries = 4 ; attack += 5 ; cout << "this will last for only 3 turns!

" ; } } void Tavern () { system ( "CLS" ); cout << "If you're looking for some easy gold, you've come to the right place!

What'll it be Lad?

" ; cout << "Lier's Dice - L

Lout's Guess - G

Main Menu - Q" << endl ; cin >> E ; if ( E == 'L' || E == 'l' ) { Dicemain ();} else if ( E == 'G' || E == 'g' ) { GuessGame ();} else if ( E == 'Q' || E == 'q' ) { cout << "Wimp" << endl ; system ( "Pause" ); MainMenu ();} else { cout << "What? Cat got your tongue Lad? Speak up!" ; system ( "pause" ); Tavern (); } } void Dicemain () { check = 0 ; Btotal = 0 ; Bet = 0 ; Ytotal = 0 ; Ototal = 0 ; begger = 0 ; srand ( time ( NULL )); system ( "CLS" ); cout << "So you're here for a game of Dice then?

Pay the entry fee: 10 gold - You have " << gold << "

(y or n)

" ; cin >> C ; if ( C == 'y' ) { check = 10 ; GoldCheck (); if ( begger == 1 ) { system ( "pause" ); Dicemain (); } gold -= 10 ; Rolls = 1 ; DiceRoll (); } else if ( C == 'n' ) { cout << "Wimp" << endl ; system ( "pause" ); MainMenu (); } else { cout << "This is an incorrect command - try again" << endl ; system ( "pause" ); Dicemain (); } } void DiceRoll () { system ( "CLS" ); cout << "(Roll " << Rolls << ") The die have been cast

" << setw ( 15 ) << "Your total: " << Ytotal << " \t Your Bet: " << Btotal << endl ; system ( "pause" ); Ydice = rand () % 6 + 1 ; Ytotal += Ydice ; Odice = rand () % 6 + 1 ; Ototal += Odice ; getchar (); Rolls ++ ; DiceCall (); } void DiceCall () { cout << "You have rolled " << Ydice << endl ; cout << "Place your bet!" << endl ; cin >> Bet ; Btotal += Bet ; check = Btotal ; GoldCheck (); if ( begger == 1 ) { cout << "You can't afford that bet!" << endl ; Btotal -= Bet ; system ( "pause" ); system ( "CLS" ); DiceCall (); } if ( Rolls == 4 ) { cout << "You've had your 3 rounds already." << endl ; system ( "pause" ); Winnings (); } cout << "Fold - F

Raise - R

Carry - C" << endl ; cin >> D ; if ( D == 'F' || D == 'f' ) { Winnings (); } else if ( D == 'R' || D == 'r' ) { cout << "What you want to raise?! You've got guts...

" ; cin >> Bet ; Btotal += Bet ; check = Btotal ; if ( begger == 1 ) { cout << "You can't afford that bet!" << endl ; Btotal -= Bet ; system ( "pause" ); system ( "CLS" ); DiceCall (); } } else if ( D == 'C' || D == 'c' ) { cout << "Another round? You better be ready to cough up some gold!" << endl ; system ( "pause" ); DiceRoll (); } cout << "Incorrect input" << endl ; system ( "pause" ); system ( "CLS" ); DiceCall (); system ( "pause" ); } void Winnings () { system ( "CLS" ); cout << "Your total is: " << Ytotal << endl ; cout << "Opponents total is: " << Ototal << endl ; if ( Ytotal > Ototal ) { cout << "You won. Just take your gold and get lost" << endl ; system ( "pause" ); gold += Btotal ; Tavern (); } else { cout << "Your total was less than your opponents. Hand over the gold and scram" << endl ; system ( "pause" ); gold -= Btotal ; Tavern (); } } void GoldCheck () { if ( gold < check ) { cout << "What are you, a begger?! Go earn some money" << endl ; system ( "pause" ); begger = 1 ; } else { cout << "Good you have enough gold" << endl ; begger = 0 ; system ( "Pause" ); } } void GuessGame () { srand ( time ( NULL ) ); system ( "CLS" ); cout << "So you want a game of Lout's Guess? Pick your difficulty:

Easy - E

Medium - M

Hard - H

Exit - Q:" << endl ; cout << "To give up, just guess a number higher than the max for that difficulty" << endl ; cin >> E ; if ( E == 'E' || E == 'e' ) { iSecret = rand () % 100 + 1 ; cost = 5 ; earnings = 50 ; top = 100 ; } else if ( E == 'M' || E == 'm' ) { iSecret = rand () % 1000 + 1 ; cost = 50 ; earnings = 500 ; top = 1000 ; } else if ( E == 'H' || E == 'h' ) { iSecret = rand () % 10000 + 1 ; cost = 50 ; earnings = 1000 ; top = 10000 ; } else if ( E == 'Q' || E == 'q' ) { cout << "Wimp" << endl ; system ( "pause" ); MainMenu ();} else { cout << "What? Cat got your tongue Lad? Speak up!" ; system ( "pause" ); Tavern (); } Guess (); } void Guess () { do { system ( "CLS" ); cout << "Guess the number (1 to " << top << ", MWAHAHAHAHA): \t you have " << gold << " left" << endl ; cin >> iGuess ; if ( iGuess > top ) { system ( "pause" ); GuessGame ();} GoldCheck2 (); if ( iSecret < iGuess ) cout << "The secret number is lower



" ; else if ( iSecret > iGuess ) cout << "The secret number is higher



" ; if ( iSecret == iGuess ) { cout << "Finally guessed it did you?" << endl ; cout << " Take your money and leave

" ; gold += earnings ; } system ( "pause" ); } while ( iSecret != iGuess ); Tavern (); } void GoldCheck2 () { if ( gold < cost ) { cout << "What are you, a begger?! Go earn some money" << endl ; system ( "pause" ); GuessGame (); } else { cout << "Thanks for the gold" << endl ; gold -= cost ; } } void Die () { cout << charname << ", you have failed!...you should be more careful...



" ; dead = 1 ; MainMenu (); system ( "pause" ); } void WinGame () { cout << "Congratulations! You have defeated the boss and won the game!

" ; cout << "Credits :)" << endl ; cout << "" << endl ; system ( "pause" ); }