Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // RPG.cpp : The main class.
- #include "stdafx.h"
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #include <string>
- #include <sstream>
- #include <iostream>
- #include "Monster.h"
- #include "Monster.cpp"
- using namespace std;
- int main()
- {
- unsigned int randomNumber;
- srand (time(0));
- randomNumber = rand() % 11;
- string playerName;
- int choice = 0;
- int health = 10;
- int attack = 1;
- int level = 1;
- int exp = 0;
- int expToLevel = level * ((level + level + 2) / level);
- int currentHealth;
- int currentExp;
- string monsterNamer;
- string monsterPicker[5] = {"Arckolit", "Gruduum'gro", "Naxhiksil", "Urist McFighter", "Zul'fihk"};
- Monster Monster;
- cout << "This is an experimental RPG game.\nFeatures will be added, and updated with time." << endl;
- cout << "You can go ahead and type your name in here." << endl;
- cout << ": ";
- getline (cin, playerName);
- cout << "" << endl;
- cout << "Alright, " << playerName << ", this game will refer to you by that name." << endl;
- cout << "" << endl;
- cout << "As for this game." << endl;
- cout << "You are in a room with no exits. Only one door." << endl;
- cout << "The door leads to another room with no exits." << endl;
- cout << "This room will have a monster in it at all times." << endl;
- cout << "When you defeat the monster, another one will be put in its place." << endl;
- cout << "" << endl;
- //-----------------------------------------------------------------------------------------//
- while(choice != 2){
- cout << "Your current stats are-" << endl;
- cout << playerName << ": Health " << health << ": Attack " << attack << ": Level " << level << ": Experience " << exp << endl;
- cout << "" << endl;
- cout << "" << endl;
- cout << "What would you like to do?" << endl;
- cout << "1| Fight a monster" << endl;
- cout << "2| Exit the game" << endl;
- cout << "" << endl;
- currentHealth = health;
- cin.clear();
- if(cin >> choice){
- while(choice < 1 || choice > 2){
- cout << "" << endl;
- cout << "That's not a good choice, " << playerName << ". Let's try again." << endl;
- cout << "" << endl;
- cin >> choice;
- }
- }
- else
- {
- cout << "" << endl;
- cout << "That's not a good choice, " << playerName << ". Let's try again." << endl;
- cout << "" << endl;
- cin.clear();
- cin.ignore(numeric_limits<streamsize>::max(), '\n');
- }
- cout << "" << endl;
- while(randomNumber > 4){
- switch(randomNumber){
- case 0:
- monsterNamer = monsterPicker[0];
- break;
- case 1:
- monsterNamer = monsterPicker[1];
- break;
- case 2:
- monsterNamer = monsterPicker[2];
- break;
- case 3:
- monsterNamer = monsterPicker[3];
- break;
- case 4:
- monsterNamer = monsterPicker[4];
- break;
- default:
- break;
- }
- }
- switch(choice){
- case 1:
- Monster.fightMonster(monsterNamer, health, attack, level + (level * level) / (level + (level / 2)));
- break;
- case 2:
- cout << "Goodbye." << endl;
- system("exit");
- break;
- default:
- cout << "That is not a good choice, " << playerName << ". Let's try again." << endl;
- break;
- }
- }
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement