1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
#include "Unit.h"
#include "Player.h"
#include "Enemy.h"
using namespace std;
string answer;
int PLAYER_HP = 10000;
int ENEMY_HP = 10000;
int main()
{
srand(time(0));
int damage = rand() % 100;
int BraveBurst = rand() % 1000;
int x = rand() % 3;
string enemyChoices[] = {"a","b","c"};
string enemyChoice = enemyChoices[x];
Unit* unit[2];
unit[0] = new Player;
unit[1] = new Enemy;
cout << "OneOnOne" << endl; //Name of Game
cout << endl;
system("pause");
system("cls");
for(int i=0;i<100;i++) //100 Rounds
{
cout << "Your HP: " << PLAYER_HP << endl;
cout << "Enemy HP: " << ENEMY_HP << endl;
cout << endl;
system("pause");
system("cls");
cout << "What do you want to do?" << endl;
cout << "[a]Basic Attack" << endl;
cout << "[b]Heal" << endl;
cout << "[c]Special Attack" << endl;
cin >> answer;
system("cls");
if(answer == "a" || answer == "A") //Basic Attack
{
unit[0]->basicMove("Attack",damage,ENEMY_HP);
}
else if(answer == "b" || answer == "B") //Heal
{
unit[0]->healMove("Heal",damage,PLAYER_HP);
}
else if(answer == "c" || answer == "C") //Special Attack
{
unit[0]->braveburstMove("Brave Burst",BraveBurst,ENEMY_HP);
}
cout << "Enemy's Turn .. " << endl;
cout << endl;
system("pause");
system("cls");
if(enemyChoice == "a") //Basic Attack
{
unit[1]->basicMove("Attack",damage,PLAYER_HP);
}
else if(enemyChoice == "b") //Heal
{
unit[1]->healMove("Heal",damage,ENEMY_HP);
}
else if(enemyChoice == "c") //Special Attack
{
unit[1]->braveburstMove("Brave Burst",BraveBurst,PLAYER_HP);
}
}
if(PLAYER_HP < 0) //If player's hp is zero (dies)
{
delete unit[0];
cout << "You died (GAME OVER)" << endl;
cout << endl;
system("pause");
exit(0);
}
if(ENEMY_HP < 0) //if enemy's hp is zero(dies)
{
delete unit[1];
cout << "Enemy died (Congratulation!)" << endl;
cout << "Here's a Smiley Face for you" << endl;
cout << endl;
cout << "O O" << endl;
cout << " ________________________ " << endl;
cout << endl;
system("pause");
exit(0);
}
return 0;
}
| |