-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCharacter.cpp
108 lines (85 loc) · 1.31 KB
/
Character.cpp
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
//
// Character.cpp
// Character
//
// Created by RX-78 01 on 3/26/13.
// Copyright (c) 2013 lilongyue. All rights reserved.
//
#include "Character.h"
bool Character::hit (int hitPoints)
{
bool isDead = false;
_hitPoints -= hitPoints;
if(_hitPoints <= 0)
{
isDead = true;
return isDead;
}
else
{
return isDead;
}
}
int Character::defense()
{
return _defense;
}
int Character::attack(int defense)
{
if(_attack > defense)
{
return _weaponDamage;
}
else
{
return 0;
}
}
int Character::getHitPoints()
{
return _hitPoints;
}
void Character::setHipPoints(int hp)
{
_hitPoints = hp;
}
int Character::getLevel()
{
return _level;
}
void Character::setLevel(int level)
{
_level = level;
}
int Character::getAttack()
{
return _attack;
}
void Character::setAttack(int attack)
{
_attack = attack;
}
int Character::getDefense()
{
return _defense;
}
void Character::setDefense(int defense)
{
_defense = defense;
}
int Character::getWeaponDamage()
{
return _weaponDamage;
}
void Character::setWeaponDamage(int damage)
{
_weaponDamage = damage;
}
int Character::getWeaponLevel()
{
return _weaponLevel;
}
void Character::setWeaponLevel(int weaponLevel)
{
_weaponLevel = weaponLevel;
}