-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mob.cpp
89 lines (82 loc) · 2.1 KB
/
Mob.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
#include "Mob.h"
Mob::Mob() {
Ten = "";
CapDo = 1;
}
Mob::Mob(std::string Name, unsigned int Level, int Class) {
this->setTen(Name);
this->setCapDo(Level);
if (Class != -1) {
this->setHe(Class);
}
this->setSatThuong(1);
}
std::string Mob::getTen() { return this->Ten; }
void Mob::setTen(std::string Name) {
if (Name == "") {
printf("Ten khong duoc de trong.");
}
else {
Ten = Name;
}
}
unsigned int Mob::getCapDo() { return this->CapDo; }
void Mob::setCapDo(int Level) {
if (Level < 1) {
printf("Cap do khong duoc duoi 1.");
}
else { CapDo = Level; }
}
NguHanh Mob::getHe() {
return this->He;
}
std::string Mob::getHeName() {
return this->getHe().getTen();
}
void Mob::setHe(int Class) {
// 1 = Kim; 2 = Moc; 3 = Thuy; 4 = Hoa; 5 = Tho
switch (Class)
{
case 1:
this->He = NguHanh::NguHanh("Kim", "Thuy", "Moc");
break;
case 2:
this->He = NguHanh::NguHanh("Moc", "Hoa", "Tho");
break;
case 3:
this->He = NguHanh::NguHanh("Thuy", "Moc", "Hoa");
break;
case 4:
this->He = NguHanh::NguHanh("Hoa", "Tho", "Kim");
break;
case 5:
this->He = NguHanh::NguHanh("Tho", "Kim", "Thuy");
break;
default:
// exception
printf("Khong co he.");
break;
}
}
void Mob::setSatThuong(int Damage) { SatThuong = Damage; }
int Mob::getSatThuong() {
return this->SatThuong;
}
void Mob::TanCong(Mob muctieu) {
/*printf("[%s]\n%s\n", this->He.getSinh().c_str(), muctieu.getHe().getTen().c_str());
if (this->getHe().getSinh() == muctieu.getHe().getTen()) {
int SatThuong = this->getSatThuong() + (this->getSatThuong() * this->getHe().TuongSinh() / 100);
printf("%s sat thuong tuong sinh %s: %d", this->getTen().c_str(), muctieu.getTen().c_str(), SatThuong);
}
else if (this->getHe().getKhac() == muctieu.getHe().getTen()) {
int SatThuong = this->getSatThuong() + (this->getSatThuong() * this->getHe().TuongKhac() / 100);
printf("%s sat thuong tuong khac %s: %d", this->getTen().c_str(), muctieu.getTen().c_str(), SatThuong);
}
else {
int SatThuong = this->getSatThuong();
printf("%s sat thuong %s: %d", (char*)&this->getTen(), (char*)&muctieu.getTen(), SatThuong);
}*/
}
void Mob::Xuat() {
/**/
}