Commit 1988d927 authored by Kameron Kinsey's avatar Kameron Kinsey
Browse files

Initialize repository

parent 733bfa63
/******************************************************************************
*
*
* Random Stat Generator and Player Class
* By: Kameron Kinsey
*
*
*
*
*/
#include "Player.h"
#include <cstring>
#include <cstdlib>
#include <iostream>
using namespace std;
int main() {
// Declare Character Details
int seed;
Player player;
string name = player.getPlayerName();
// Set Stats
player.setStats(seed);
// Enter Name
cout << "Enter Player Name: ";
cin >> name;
player.setPlayerName(name);
int health = player.getHealth();
int fight = player.getFight();
int flee = player.getFlee();
int talk = player.getTalk();
cout << name << "'s stats" << endl
<< "========================" << endl
<< "Health: " << health << endl
<< "Fight: " << fight << endl
<< "Flee: " << flee << endl
<< "Talk: " << talk << endl
<< endl;
// << "Armor: " << armor << endl
// << "Weapon: " << weapon << endl;
return 0;
}
void Player::setStats(int seed) {
cin >> seed;
srand(seed);
// Set Fight Stat and Modifier
int fight = getFight();
fight = rand() % 20 + 5;
setFight(fight);
// Set Flee Stat and Modifier
int flee = getFlee();
flee = rand() % 20 + 5;
setFlee(flee);
// Set Talk Stat and Modifier
int talk = getTalk();
talk = rand() % 20 + 5;
setTalk(talk);
}
bool Player::checkVictory(bool win) {
if (win == true) {
cout << "Congratulations " << getPlayerName() << " you have retrieved the Maguffin of Vauge Desirability!" << endl;
}
}
\ No newline at end of file
// Header File for the Player Class
#include <cstring>
#include <iostream>
using namespace std;
class Player {
private:
int fight = 10,
flee = 10,
talk = 10,
health = 100;
string playerName;
public:
// Get Functions
int getFight() { return fight; }
int getFlee() { return flee; }
int getTalk() { return talk; }
int getHealth() { return health; }
string getPlayerName() { return playerName; }
// Set Functions
void setStats(int);
int setFight(int Fight) { fight = Fight; }
int setFlee(int Flee) { flee = Flee; }
int setTalk(int Talk) { talk = Talk; }
int setPlayerName(string name) { playerName = name; }
// Check Victory
bool checkVictory(bool win);
};
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment