Player.cpp 1.34 KB
Newer Older
Kameron Kinsey's avatar
Kameron Kinsey committed
1
// Random Stat Generator and Player Class
Kameron Kinsey's avatar
Bleh  
Kameron Kinsey committed
2

Kameron Kinsey's avatar
Kameron Kinsey committed
3
#include "Player.h"
Kameron Kinsey's avatar
Bleh  
Kameron Kinsey committed
4
#include <cstring>
Kameron Kinsey's avatar
Kameron Kinsey committed
5
#include <cstdlib>
Kameron Kinsey's avatar
Bleh  
Kameron Kinsey committed
6 7 8
#include <iostream>
using namespace std;

Kameron Kinsey's avatar
Kameron Kinsey committed
9

Kameron Kinsey's avatar
Bleh  
Kameron Kinsey committed
10 11 12

int main() {
    
Kameron Kinsey's avatar
Kameron Kinsey committed
13 14 15 16
    // Declare Character Details
    int seed;
    Player player;
    string name = player.getPlayerName();
Kameron Kinsey's avatar
Bleh  
Kameron Kinsey committed
17
    
Kameron Kinsey's avatar
Kameron Kinsey committed
18 19 20
    
    // Set Stats
    player.setStats(seed);
Kameron Kinsey's avatar
Kameron Kinsey committed
21
    
Kameron Kinsey's avatar
Kameron Kinsey committed
22
    // Enter Name
Kameron Kinsey's avatar
Bleh  
Kameron Kinsey committed
23
    cout << "Enter Player Name: ";
Kameron Kinsey's avatar
Kameron Kinsey committed
24
    cin >> name;
Kameron Kinsey's avatar
Kameron Kinsey committed
25
    player.setPlayerName(name);
Kameron Kinsey's avatar
Bleh  
Kameron Kinsey committed
26
    
Kameron Kinsey's avatar
Kameron Kinsey committed
27 28 29 30
    int health = player.getHealth();
    int fight = player.getFight();
    int flee = player.getFlee();
    int talk = player.getTalk();
Kameron Kinsey's avatar
Kameron Kinsey committed
31
    
Kameron Kinsey's avatar
Kameron Kinsey committed
32
    cout << name << "'s stats" << endl
Kameron Kinsey's avatar
Bleh  
Kameron Kinsey committed
33
         << "========================" << endl
Kameron Kinsey's avatar
Kameron Kinsey committed
34 35 36 37
         << "Health: " << health << endl
         << "Fight: " << fight << endl
         << "Flee:  " << flee  << endl
         << "Talk:  " << talk << endl
Kameron Kinsey's avatar
Kameron Kinsey committed
38 39 40
         << endl;
        //  << "Armor: " << armor << endl
        //  << "Weapon: " << weapon << endl;
Kameron Kinsey's avatar
Bleh  
Kameron Kinsey committed
41 42 43 44 45
    
    
    return 0;
}

Kameron Kinsey's avatar
Kameron Kinsey committed
46 47 48 49
void Player::setStats(int seed) {
    
    cin >> seed;
    srand(seed);
Kameron Kinsey's avatar
Bleh  
Kameron Kinsey committed
50
    
Kameron Kinsey's avatar
Kameron Kinsey committed
51
    // Set Fight Stat and Modifier
Kameron Kinsey's avatar
Kameron Kinsey committed
52
    int fight = getFight();
Kameron Kinsey's avatar
Bleh  
Kameron Kinsey committed
53
    fight = rand() % 20 + 5;
Kameron Kinsey's avatar
Kameron Kinsey committed
54
    setFight(fight);
Kameron Kinsey's avatar
Kameron Kinsey committed
55 56
    
    // Set Flee Stat and Modifier
Kameron Kinsey's avatar
Kameron Kinsey committed
57
    int flee = getFlee();
Kameron Kinsey's avatar
Kameron Kinsey committed
58
    flee = rand() % 20 + 5;
Kameron Kinsey's avatar
Kameron Kinsey committed
59 60
    setFlee(flee);
    
Kameron Kinsey's avatar
Kameron Kinsey committed
61
    // Set Talk Stat and Modifier
Kameron Kinsey's avatar
Kameron Kinsey committed
62
    int talk = getTalk();
Kameron Kinsey's avatar
Bleh  
Kameron Kinsey committed
63
    talk = rand() % 20 + 5;
Kameron Kinsey's avatar
Kameron Kinsey committed
64
    setTalk(talk);
Kameron Kinsey's avatar
Bleh  
Kameron Kinsey committed
65 66

}