-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcharacter.hpp
126 lines (116 loc) · 2.44 KB
/
character.hpp
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/******************************************************************************
* Program name: character.hpp
* Author: George Lenz
* Date: 2/18/2018
* Description: Header file for character class
******************************************************************************/
#ifndef CHARACTER_HPP
#define CHARACTER_HPP
#include <cstdlib>
#include <time.h>
#include <string>
#include <iostream>
using namespace std;
class Character
{
protected:
int attackMax;
int defenseMax;
int armor;
int strength;
std::string name;
struct display
{
std::string line1;
std::string line2;
std::string line3;
std::string line4;
std::string line5;
};
display picture;
public:
Character()
{
attackMax = 0;
defenseMax = 0;
armor = 0;
strength= 0;
name = "";
picture.line1 = "";
picture.line2 = "";
picture.line3 = "";
picture.line4 = "";
picture.line5 = "";
}
Character(int aMax, int dMax, int armor1, int strength1)
{
this->attackMax = aMax;
this->defenseMax = dMax;
this->armor = armor1;
this->strength = strength1;
}
//Character(const Character);
//Charcter& operator=(Character);
~Character(){};
int getAttackMax()
{
return attackMax;
}
int getdefenseMax()
{
return defenseMax;
}
int getArmor()
{
return armor;
}
int getStrength()
{
return strength;
}
std::string getName()
{
return name;
}
void setName(std::string aName)
{
this->name = aName;
}
void setStrength(int num)
{
strength = num;
}
display getDisplay()
{
return picture;
}
void printCharacters(Character* right)
{
cout << endl << (this->getDisplay()).line1;
cout << " " << right->getDisplay().line1 << endl;
cout << (this->getDisplay()).line2 << " ";
cout << right->getDisplay().line2 << endl;
cout << this->getDisplay().line3 << " vs ";
cout << right->getDisplay().line3 << endl;
cout << this->getDisplay().line4 << " ";
cout << right->getDisplay().line4 << endl;
cout << this->getDisplay().line5 << " ";
cout << right->getDisplay().line5 << endl;
};
virtual int attack() = 0;
virtual void defend(int) = 0;
int roll(int anAttack)
{
return 1 + rand() % anAttack;
}
//assignment operator overload
Character& operator=(const Character* right)
{
this->attackMax = right->attackMax;
this->defenseMax = right->defenseMax;
this->armor = right->armor;
this->strength = right->strength;
this->name = right->name;
}
};
#endif