#include <cstdlib>
#include <iostream>
#include <cmath>
#include <string>
#include <ctime>
usingnamespace std;
char name[50];
int menu;
char comm[10];
int hp;
int manhp;
int yourhp;
int money;
int attack;
int xp;
int bosshp;
int boss;
int level;
int rdm; // Random event when == to 10
int main(int argc, char *argv[])
{
string cho;
string shopitm1;
string inv;
string bossop;
string inv3;
string dev;
string inv2;
inv = "You havent got anything :P";
yourhp = 100;
srand(time(NULL)); // Timer for the HP random number.
hp = rand() % 10 + 1; // Timer defined as Int hp
attack = rand() % 10 + 1;//timer for killing
boss = rand() % 10 + 1;//timer for bossattck
string command;
menu = -1;
cout << "Moradica v0.01 alpha" << endl;
cout << "Please enter your name" << endl;
cin >> name;
cout << "Welcome to moradica" << endl;
while(menu < 1 )
{
cout << "Please enter a command or type 'help' " << endl;
cin >> command;
if (command == "help")
{
cout << "commands; \n \n\n\n Kill : To kill an enemy\n\n\n Money : To see how mutch money you have\n\n\n Shop : buy things\n\n\nChange log: Current updates \n\n\n inv : To see what you have" << endl;
}
elseif(command == "kill")
{
cout << "You walk to to a monster he has ";
cout << hp <<endl;
cout << " Do you attack or run? \n\n" << endl;
cin >> cho;
if (cho == "attack"){
if (xp > 50){
cout << "You just leveled up!";
cout << "The monster attacks you for ";
cout << attack ;
yourhp = yourhp - attack + 2;
cout << " hp. You attack back with";
cout << attack;
cout << "The monster dies droping 3 moneys"<<endl;
money = money + 100;
xp = xp + 1;}
elseif (rdm == 10){
cout << "A leprocon comes and takes 15 of your moneyz";
money = money - 10;
}
else{
cout << "The monster attacks you for ";
cout << attack ;
yourhp = yourhp - attack;
cout << " hp. You attack back with";
cout << attack;
cout << "The monster dies droping 3 moneys"<<endl;
money = money + 3;
xp = xp + 1;}
}
if (cho == "potion" && inv == "potion"){
cout <<" You used a potion!!! Killing the monster. He droped 20 money";
money = money + 20;
xp = xp + 5;
rdm = rdm + 3;// More use of potion = more change of random event!
inv = "Nothing";
}
}
if (command == "money")
{
cout << "You have ";
cout << money;
cout << "\n";
}
if(command == "shop"){
cout << "Hello there!!! I am the store clerk. I can sell you over 9000 things!\n\n";
cout << "Potion = 100 money\n\n\n";
cout << "Drug \n\n\n";
cout << "hp boost";
cin >> shopitm1;
if (shopitm1 == "potion" || "Potion" && money > 5){
cout << "You just got a potion, be warned! It attracts lepercons! You can use it in your next battle\n\n";
inv = "potion";
money = money - 5; // Taking money
}
elseif (shopitm1 == "Hp boost" || "hp boost"){
cout << "You got an HP boost! Use it in the main menu for boosting your overall HP! (boost)";
inv2 = "hp";
money = money - 5;
}
elseif (shopitm1 == "Drugs" || "drugs"){
cout << "This will make you high, At the expence of HP";
inv2 = "hp";
money = money - 5;}
}
if (command == "about"){
cout << "Made by bijan\n\nCompile from 6/1/10\n\n Alpha 0.01\n\n All of this code/program are an experiment \n \n";}
if (command == "changelog"){
cout << "Nothing here yet :(";}
if(command == "dev"){
cout << "Developer mode";
cin >> dev;
if (dev == "xp"){
cin >> xp;
}
if (dev == "money"){
cin >> money;
} }
if (command == "boost"){
if (inv2 == "hp"){
cout << "You just boosted your hp by 10 \n\n\n";
hp = hp + 10;}
else {
cout << "You have no hp booster!!!\n\n";
}}
if (command == "stats"){
cout << "You have ";
cout << xp;
cout << "Xp and ";
cout << money ;
cout << "money \n\n\n";
}
if (command == "about"){
cout << "Made by bijan\n\nCompile from 6/1/10\n\n Alpha 0.01\n\n All of this code/program are an experiment";}
if (command == "code")
{
cout << "This is your save code, Wright it down!\n\n\n";
cout << money <<"\n"<< xp <<"\n"<< level <<"\n"<< hp <<"\n"<< name<<"\n";
cout << "Please take note of it, Include the order of the lines.\n\n";
}
if (command == "enter"){//Crude form of saving, Will continue to use untill i get the hang on I/O
cout << "Please enter the code in the order you receved it in";
cin >> money;
cin >> xp;
cin >> level;
cin >> hp;
cin >> name;}
if (command == "boss") {
cout << "You walk uo to the 1st main boss, He hits you for "<< boss << " Damage!\n\n You hit him back with "<< attack <<" damage!\n\n Do you use a potion?";
cin >> bossop;
if (bossop == "yes" || "Yes")
hp = hp + 10;
cout << "He hits you again with" << boss << "Damage, You hit him with" << attack << "\n";
cout << "The boss falls to the ground in agony\n";
menu = 3;
}
if(hp < 0){
cout << "YOU LOOSE!" << endl;
}
if (money > 1000){
cout << "Youve won!";}
elseif(command == "inv"){
cout << "\n\n\n";
cout << inv;
string man;
}
}
string man;
while (menu > 2) {
cout << "Welcome to level 2! \n As you see the boss dieing you notice a man in the back ground do you walk up to him?";
cin >> man;
}
}
Because the shop command should be a loop with an option to escape. Not a bad start for a beginner certainly better then my first attempt.
EDIT: Acctually all of these commands should be a loop of some sort. I like the leprocan, you should put something it that says: "Give chase?""He got away :( "