Player.cpp 1.65 KB
Newer Older
Kameron Kinsey's avatar
Kameron Kinsey committed
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
/******************************************************************************
 * 
 *
 *  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;
    }
}