Player.cpp 1.67 KB
Newer Older
Kameron Kinsey's avatar
Kameron Kinsey committed
1
2
3
4
5
6
7
8
9
10
11
/******************************************************************************
 * 
 *
 *  Random Stat Generator and Player Class
 *  By: Kameron Kinsey
 *
 *
 *
 *
 */

Kameron Kinsey's avatar
Kameron Kinsey committed
12
#include "item.h"
Kameron Kinsey's avatar
Kameron Kinsey committed
13
14
15
16
17
18
19
20
21
22
23
24
#include "Player.h"
#include <cstring>
#include <cstdlib>
#include <iostream>
using namespace std;



int main() {
    
    // Declare Character Details
    int seed;
Kameron Kinsey's avatar
Kameron Kinsey committed
25
    char command;
Kameron Kinsey's avatar
Kameron Kinsey committed
26
27
28
29
30
31
32
33
34
    Player player;
    string name = player.getPlayerName();
    
    
    // Set Stats
    player.setStats(seed);
    
    // Enter Name
    cout << "Enter Player Name: ";
Kameron Kinsey's avatar
Kameron Kinsey committed
35
    getline(cin,name);
Kameron Kinsey's avatar
Kameron Kinsey committed
36
37
38
39
40
41
42
43
44
    player.setPlayerName(name);
    
    int health = player.getHealth();
    int fight = player.getFight();
    int talk = player.getTalk();
    
    cout << name << "'s stats" << endl
         << "========================" << endl
         << "Health: " << health << endl
Kameron Kinsey's avatar
Kameron Kinsey committed
45
46
47
48
49
50
         << "Fight: " << fight + item.getEquippedFight() << endl
         << "Talk:  " << talk + item.getEquippedTalk() << endl
         << "Item: " << item.getEquippedItemName() << endl;
          
    cout << "Check inventory: i";
    getline(cin,command);
Kameron Kinsey's avatar
Kameron Kinsey committed
51
    
Kameron Kinsey's avatar
Kameron Kinsey committed
52
53
54
    if (command == 'i') {
        item.listInventory();
    }
Kameron Kinsey's avatar
Kameron Kinsey committed
55
56
57
58
59
60
    
    return 0;
}

void Player::setStats(int seed) {
    
Kameron Kinsey's avatar
Kameron Kinsey committed
61
    getline(cin,seed);
Kameron Kinsey's avatar
Kameron Kinsey committed
62
63
64
65
66
67
68
69
70
71
72
73
74
75
    srand(seed);
    
    // Set Fight Stat and Modifier
    int fight = getFight();
    fight = rand() % 20 + 5;
    setFight(fight);
    
    // Set Talk Stat and Modifier
    int talk = getTalk();
    talk = rand() % 20 + 5;
    setTalk(talk);

}

Kameron Kinsey's avatar
Kameron Kinsey committed
76
77
void check

Kameron Kinsey's avatar
Kameron Kinsey committed
78
79
80
81
82
bool Player::checkVictory(bool win) {
    if (win == true) {
        cout << "Congratulations " << getPlayerName() << " you have retrieved the Maguffin of Vauge Desirability!" << endl;
    }
}