温习C++继承与多态之打造简易回合制5V5小游戏

曾几何时,网页游戏风靡整个网络世界,然而手机游戏的出现,如今的网页游戏已经渐渐销声匿迹了。

还记得我玩的第一款时间较长的网页游戏——龙将,如今服务器已关闭了,包括代理商“风行”如今也鲜为人知。其实那款游戏很简单,两个玩家对弈,双方每人出场5个英雄,按回合制以英雄的速度为先后顺序,每个英雄普通攻击或使用技能,直到一方的所有英雄全部死亡为止。所有攻击操作都是自动的,不需要我们操作,我们只需选择英雄上阵即可。

曾经想着什么时候能自己编一款类似的游戏,以便属性按照自己的想法设定。如今就简简单单实现一下吧。(超级粗略哦)

首先,我们来分析一下,每个英雄都有攻击属性,防御属性,速度,生命值,还有一些特殊的效果(暴击,吸血什么的啦),英雄可以装备武器,可以对敌方英雄造成伤害。那么我们先创建一个Hero类,它包含上述所有属性及方法。然后,每个英雄不同之处在于技能与被动技能,那我们利用多态来实现不同的技能。

再来分析一下武器,武器有基础属性和特殊属性,不同的武器属性不同,那么我们先创建一个基类Weapon类,该类函数声明为纯虚类,不可被继承,由派生来来实现具体功能即可。

英雄和武器写完之后,再创建一个国家类。由于英雄以国家而划分,所以每个国家由许多英雄类指针组成。

每个玩家有5个英雄,具体实现同国家类。

图示如下

由于本人比较懒,写着写着又犯懒了,所以技能方面还没实现,每次都是普通攻击触发各种效果。不过目前可以正常运行。等哪天有时间了再继续改进吧。以下是代码:

Weapon.h

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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#pragma once
#include<iostream>
#include<string>
using namespace std;
//抽象类
class Weapon {
public:
//获取基础伤害
virtual int getBaceDamage() = 0;

//获取防御
virtual int getBaceDef() = 0;

//获取吸血
virtual bool getSuckBlood() = 0;

//获取流血
virtual bool getHold() = 0;

static bool isTrigger(int rate);

string m_WeaponName; //武器名
int m_BaceDamage; //基础伤害
int BaceDef; //基础防御
};

class Knife :public Weapon {
public:
Knife();
//获取基础伤害
virtual int getBaceDamage();

//获取防御
virtual int getBaceDef();

//获取吸血
virtual bool getSuckBlood();

//获取流血
virtual bool getHold();

int holdRate;
};

class DragonSword :public Weapon {
public:
DragonSword();
//获取基础伤害
virtual int getBaceDamage();

//获取防御
virtual int getBaceDef();

//获取吸血
virtual bool getSuckBlood();

//获取流血
virtual bool getHold();

int holdRate;
};

class Sword :public Weapon {
public:
Sword();
//获取基础伤害
virtual int getBaceDamage();

//获取防御
virtual int getBaceDef();

//获取吸血
virtual bool getSuckBlood();

//获取流血
virtual bool getHold();

int suckRate;
int holdRate;
};

class Shield :public Weapon {
public:
Shield();
//获取基础伤害
virtual int getBaceDamage();

//获取防御
virtual int getBaceDef();

//获取吸血
virtual bool getSuckBlood();

//获取流血
virtual bool getHold();

};


class Spear :public Weapon {
public:
Spear();
//获取基础伤害
virtual int getBaceDamage();

//获取防御
virtual int getBaceDef();

//获取吸血
virtual bool getSuckBlood();

//获取流血
virtual bool getHold();
int suckRate;
};


class Bow :public Weapon {
public:
Bow();
//获取基础伤害
virtual int getBaceDamage();

//获取防御
virtual int getBaceDef();

//获取吸血
virtual bool getSuckBlood();

//获取流血
virtual bool getHold();
};

class Book :public Weapon {
public:
Book();
//获取基础伤害
virtual int getBaceDamage();

//获取防御
virtual int getBaceDef();

//获取吸血
virtual bool getSuckBlood();

//获取流血
virtual bool getHold();

int suckRate;
};

class Fan :public Weapon {
public:
Fan();
//获取基础伤害
virtual int getBaceDamage();

//获取防御
virtual int getBaceDef();

//获取吸血
virtual bool getSuckBlood();

//获取流血
virtual bool getHold();

int holdRate;
int suckRate;
};

Weapon.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
#include "Weapon.h"


Knife::Knife()
{
this->m_BaceDamage = 10;
this->BaceDef = 0;
this->holdRate = 30;
this->m_WeaponName = "锋利匕首";
}

int Knife::getBaceDamage()
{
return this->m_BaceDamage;
}

int Knife::getBaceDef()
{
return this->BaceDef;
}

bool Knife::getSuckBlood()
{
return false;
}

bool Knife::getHold()
{
return isTrigger(this->holdRate);
}


DragonSword::DragonSword()
{
this->m_BaceDamage = 20;
this->m_WeaponName = "屠龙宝刀";
this->BaceDef = 10;
this->holdRate = 20;
}

int DragonSword::getBaceDamage()
{
return this->m_BaceDamage;
}

int DragonSword::getBaceDef()
{
return this->BaceDef;
}

bool DragonSword::getSuckBlood()
{
return false;
}

bool DragonSword::getHold()
{
return isTrigger(this->holdRate);
}

bool Weapon::isTrigger(int rate)
{
if (rate >= rand() % 100 + 1) {
return true;
}
return false;
}

Sword::Sword()
{
this->m_BaceDamage = 20;
this->m_WeaponName = "倚天神剑";
this->BaceDef = 10;
this->suckRate = 10;
this->holdRate = 10;
}

int Sword::getBaceDamage()
{
return this->m_BaceDamage;
}

int Sword::getBaceDef()
{
return this->BaceDef;
}

bool Sword::getSuckBlood()
{
return isTrigger(this->suckRate);
}

bool Sword::getHold()
{
return isTrigger(this->holdRate);
}


Shield::Shield()
{
this->m_BaceDamage = 0;
this->m_WeaponName = "刑天巨盾";
this->BaceDef = 70;
}

int Shield::getBaceDamage()
{
return this->m_BaceDamage;
}

int Shield::getBaceDef()
{
return this->BaceDef;
}

bool Shield::getSuckBlood()
{
return false;
}

bool Shield::getHold()
{
return false;
}


Spear::Spear()
{
this->m_BaceDamage = 10;
this->m_WeaponName = "亮银长枪";
this->BaceDef =20;
this->suckRate = 20;
}

int Spear::getBaceDamage()
{
return this->m_BaceDamage;
}

int Spear::getBaceDef()
{
return this->BaceDef;
}

bool Spear::getSuckBlood()
{
return isTrigger(this->suckRate);
}

bool Spear::getHold()
{
return false;
}


Bow::Bow()
{
this->m_BaceDamage = 70;
this->m_WeaponName = "射日神弓";
this->BaceDef = 0;
}

int Bow::getBaceDamage()
{
return this->m_BaceDamage;
}

int Bow::getBaceDef()
{
return this->BaceDef;
}

bool Bow::getSuckBlood()
{
return false;
}

bool Bow::getHold()
{
return false;
}


Book::Book()
{
this->m_BaceDamage = 0;
this->m_WeaponName = "遁甲天书";
this->BaceDef = 10;
this->suckRate = 30;
}

int Book::getBaceDamage()
{
return this->m_BaceDamage;
}

int Book::getBaceDef()
{
return this->BaceDef;
}

bool Book::getSuckBlood()
{
return isTrigger(this->suckRate);
}

bool Book::getHold()
{
return false;
}


Fan::Fan()
{
this->m_BaceDamage = 30;
this->m_WeaponName = "朱雀羽扇";
this->BaceDef = 0;
this->suckRate = 10;
this->holdRate = 10;
}

int Fan::getBaceDamage()
{
return this->m_BaceDamage;
}

int Fan::getBaceDef()
{
return this->BaceDef;
}

bool Fan::getSuckBlood()
{
return isTrigger(this->suckRate);
}

bool Fan::getHold()
{
return isTrigger(this->holdRate);
}

Hero.h

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
#pragma once
#include<iostream>
#include<string>
#include"Weapon.h"
using namespace std;
class Hero {
public:
Hero();
int getHP();
int getMP();
int getAtk();
int getDef();
string getName();
bool action();
void getInf();
void attack(Hero*hero);
bool isRate(int rate);
void init_property();
virtual void skill(Hero * hero) = 0;
virtual void passive_skill() = 0;

bool isDeath; //是否死亡

Weapon*weapon;

protected:

int max_HP;
int HP; //血量
int MP; //蓝量
int atk; //攻击力
int def; //防御力
int vel; //速度

string name; //姓名
string ctry; //国家
int id; //编号
string sex; //性别
string skill_show;
string skill_name;

int wisdom; //智慧
int strategy; //谋略
int force; //力量
int agility; //敏捷

int crit; //暴击
int stun; //重击
int suckBlood; //回血
int miss; //闪避

bool isDiz; //眩晕
bool isBleed; //流血
};

Hero.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
#include"hero.h"
#include "Monster.h"
Hero::Hero()
{
this->m_HP = 500;
this->m_Atk = 50;
this->m_Def = 50;
this->m_Name = "靓仔";
this->weapon = NULL;
}

void Hero::EquipWeapon(Weapon * weapon)
{
this->weapon = weapon;
cout << "英雄" << this->m_Name << "装备了" << this->weapon->m_WeaponName << endl;
}

void Hero::Attack(Monster * monster)
{
int damage = 0;
int addHP = 0;
bool isHold = false;
bool isCrit = false;
if (this->weapon == NULL) {
damage = this->m_Atk;
}
else {
damage = this->m_Atk + this->weapon->getBaceDamage();
addHP = this->weapon->getSuckBlood();
isHold = this->weapon->getHold();
isCrit = this->weapon->getCrit();
if (addHP) {
cout << "英雄触发吸血效果,回血" << addHP << endl;
}
if (isCrit) {
damage *= 2;
cout << "英雄触发暴击效果,怪兽受到双倍伤害" << endl;
}
if (isHold) {
monster->m_Hold = isHold;
cout << "英雄触发定身效果,怪兽停止行动一回合" << endl;
}
}
damage = damage > monster->m_Def ? damage - monster->m_Def : 1;
monster->m_HP -= damage;
this->m_HP += addHP;
cout << "英雄" << this->m_Name << "对怪兽" << monster->m_Name << "造成了" << damage << "点伤害。" << endl;
}

Country.h

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
127
128
129
130
131
132
133
134
135
136
137
138
#pragma once
#include"Hero.h"
#include"Wei.h"
#include"Shu.h"
#include"Wu.h"
#include"Qun.h"
#define NUM_HERO 12
class Wei{
public:
Wei() {
for (int i = 0; i < NUM_HERO; i++) {
if (!vis[i]) {
wei[i]->getInf();
}
}
}
~Wei() {
for (int i = 0; i < NUM_HERO; i++) {
if (!vis[i]) {
delete wei[i];
}
}
}
Hero*wei[NUM_HERO] = {
new(CaoCao),
new(DianWei),
new(XuChu),
new(GuoJia),
new(XiaHouDun),
new(XiaHouYuan),
new(CaoRen),
new(ZhangLiao),
new(SiMaYi),
new(XuHuang),
new(ZhenJi),
new(CaiWenJi)
};
int vis[NUM_HERO] = { false };
};

class Shu{
public:
Shu() {
for (int i = 0; i < NUM_HERO; i++) {
if (!vis[i]) {
shu[i]->getInf();
}
}
}
~Shu() {
for (int i = 0; i < NUM_HERO; i++) {
if (!vis[i]) {
delete shu[i];
}
}
}
Hero*shu[NUM_HERO] = {
new(LiuBei),
new(GuanYu),
new(ZhangFei),
new(ZhuGeLiang),
new(ZhaoYun),
new(MaChao),
new(HuangZhong),
new(WeiYan),
new(HuangYueYing),
new(JiangWei),
new(PangTong),
new(SunShangXiang)
};
int vis[NUM_HERO] = {false};
};

class Wu{
public:
Wu() {
for (int i = 0; i < NUM_HERO; i++) {
if (!vis[i]) {
wu[i]->getInf();
}
}
}
~Wu() {
for (int i = 0; i < NUM_HERO; i++) {
if (!vis[i]) {
delete wu[i];
}
}
}
Hero*wu[NUM_HERO] = {
new(SunCe),
new(ZhouYu),
new(SunQuan),
new(DaQiao),
new(XiaoQiao),
new(HuangGai),
new(TaiShiCi),
new(GanNing),
new(LuSu),
new(LvMeng),
new(ZhangZhao),
new(ZhouTai)
};
int vis[NUM_HERO] = { false };
};

class Qun {
public:
Qun() {
for (int i = 0; i < NUM_HERO; i++) {
if (!vis[i]) {
qun[i]->getInf();
}
}
}
~Qun() {
for (int i = 0; i < NUM_HERO; i++) {
if (!vis[i]) {
delete qun[i];
}
}
}
Hero*qun[NUM_HERO] = {
new(LvBu),
new(DiaoChan),
new(HuaTuo),
new(YuanShao),
new(YanLiang),
new(WenChou),
new(ZuoCi),
new(HuaXiong),
new(GongSunZan),
new(ZhangJiao),
new(YuJi),
new(LingJu)
};
int vis[NUM_HERO] = { false };
};

User.h

1
2
3
4
5
6
#pragma once
#include"Country.h"
class User {
public:
Hero * hero[5];
};

main.cpp

1
2
3
4
5
6
#include"Play.h"
int main() {
play();
system("pause");
return 0;
}

Play.h

1
2
3
4
5
6
7
8
#pragma once
#include<iostream>
#include"Country.h"
#include"User.h"
void test();
void play();
void show(User &user);
bool isDeath(User & user);

Play.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#include"Play.h"
#include<time.h>
void test() {
Hero * hero_1 = new(ZhangFei);
Hero *hero_2 = new(GuanYu);

int round = 0;
while (true) {
getchar();
system("cls");
cout << "当前第" << ++round << "回合开始" << endl;
hero_1->attack(hero_2);
if (hero_2->getHP() <= 0) {
cout << "怪兽" << hero_2->getName() << "已死,游戏结束,你赢了" << endl;
break;
}
hero_2->attack(hero_1);
if (hero_1->getHP() <= 0) {
cout << "英雄" << hero_1->getName() << "已死,游戏结束,你输了" << endl;
break;
}
cout << "英雄" << hero_1->getName() << "剩余血量:" << hero_1->getHP() << endl;
cout << "怪兽" << hero_2->getName() << "剩余血量:" << hero_2->getHP() << endl;
}

delete(hero_1);
delete(hero_2);
}
void play() {
srand(time(NULL));
User user_1;
cout << "玩家一选择" << endl;
show(user_1);
User user_2;
cout << "玩家二选择" << endl;
show(user_2);
int round = 0;
while (true) {
getchar();
system("cls");
cout << "当前第" << ++round << "回合开始" << endl;

for (int i = 0; i < 5; i++) {
if (!user_1.hero[i]->isDeath) {
int Tmp = rand() % 5;
while (user_2.hero[Tmp]->isDeath) {
if (isDeath(user_2)) {
break;
}
Tmp = rand() % 5;
}
user_1.hero[i]->attack(user_2.hero[Tmp]);
}
else {
cout << "英雄" << user_1.hero[i]->getName() << "已阵亡。" << endl;
}
cout << "**********" << endl;
if (!user_2.hero[i]->isDeath) {
int Tmp = rand() % 5;
while (user_1.hero[Tmp]->isDeath) {
if (isDeath(user_1)) {
break;
}
Tmp = rand() % 5;
}
user_2.hero[i]->attack(user_1.hero[Tmp]);
}
else {
cout << "英雄" << user_2.hero[i]->getName() << "已阵亡。" << endl;
}
cout << "**********" << endl;
}
if (isDeath(user_2)) {
cout << "Victory!" << endl;
break;
}
if (isDeath(user_1)) {
cout << "Defeat!" << endl;
break;
}
cout << "-------------------" << endl;
for (int i = 0; i < 5; i++) {
if (!user_1.hero[i]->isDeath) {
cout << "玩家1英雄" << user_1.hero[i]->getName() << "剩余血量" << user_1.hero[i]->getHP() << endl;
}
else {
cout << "玩家1英雄" << user_1.hero[i]->getName() << "已阵亡。" << endl;
}
}
cout << "-------------------" << endl;
for (int i = 0; i < 5; i++) {
if (!user_2.hero[i]->isDeath) {
cout << "玩家2英雄" << user_2.hero[i]->getName() << "剩余血量" << user_2.hero[i]->getHP() << endl;
}
else {
cout << "玩家2英雄" << user_2.hero[i]->getName() << "已阵亡。" << endl;
}
}
}
}
bool isDeath(User & user) {
int cnt;
for (cnt = 0; cnt < 5; cnt++) {
if (!user.hero[cnt]->isDeath) {
break;
}
}
if (cnt >= 5) {
return true;
}
return false;
}
void show(User &user)
{
int flag;
cout << "----------" << "请选择您的阵营" << "----------" << endl << endl;
cout << "---" << "1.魏----2.蜀----3.吴----4.群" << "---" << endl << endl;
cout << "----------" << "--------------" << "----------" << endl;
cin >> flag;
int tmp[5];
Wei *wei;
Shu *shu;
Wu *wu;
Qun *qun;
switch (flag) {
case 1:
cout << "您已加入魏国阵营,请选择5位武将" << endl;
wei = new Wei;
for (int i = 0; i < 5; i++) {
cin >> tmp[i];
user.hero[i] = wei->wei[tmp[i]-1];
wei->vis[tmp[i]-1] = true;
}
delete wei;
break;
case 2:
cout << "您已加入蜀国阵营,请选择5位武将" << endl;
shu = new Shu;
for (int i = 0; i < 5; i++) {
cin >> tmp[i];
user.hero[i] = shu->shu[tmp[i]-1];
shu->vis[tmp[i]-1] = true;
}
delete shu;
break;
case 3:
cout << "您已加入吴国阵营,请选择5位武将" << endl;
wu = new Wu;
for (int i = 0; i < 5; i++) {
cin >> tmp[i];
user.hero[i] = wu->wu[tmp[i]-1];
wu->vis[tmp[i]-1] = true;
}
delete wu;
break;
default:
cout << "您已加入群雄阵营,请选择5位武将" << endl;
qun = new Qun;
for (int i = 0; i < 5; i++) {
cin >> tmp[i];
user.hero[i] = qun->qun[tmp[i]-1];
qun->vis[tmp[i]-1] = true;
}
delete qun;
break;
}
}

Wei.h

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
#pragma once
#include"Hero.h"

class CaoCao : public Hero {
public:
CaoCao();
void skill(Hero * hero);
void passive_skill();
};

class DianWei :public Hero {
public:
DianWei();
void skill(Hero * hero);
void passive_skill();
};

class XuChu : public Hero {
public:
XuChu();
void skill(Hero * hero);
void passive_skill();
};

class GuoJia : public Hero {
public:
GuoJia();
void skill(Hero * hero);
void passive_skill();
};

class XiaHouDun : public Hero {
public:
XiaHouDun();
void skill(Hero * hero);
void passive_skill();
};

class XiaHouYuan : public Hero {
public:
XiaHouYuan();
void skill(Hero * hero);
void passive_skill();
};

class CaoRen : public Hero {
public:
CaoRen();
void skill(Hero * hero);
void passive_skill();
};

class ZhangLiao : public Hero {
public:
ZhangLiao();
void skill(Hero * hero);
void passive_skill();
};

class SiMaYi : public Hero {
public:
SiMaYi();
void skill(Hero * hero);
void passive_skill();
};

class XuHuang : public Hero {
public:
XuHuang();
void skill(Hero * hero);
void passive_skill();
};

class ZhenJi : public Hero {
public:
ZhenJi();
void skill(Hero * hero);
void passive_skill();
};

class CaiWenJi : public Hero {
public:
CaiWenJi();
void skill(Hero * hero);
void passive_skill();
};

Wei.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
#include "Wei.h"

CaoCao::CaoCao()
{
name = "曹操"; //姓名
ctry = "魏"; //国家
sex = "男"; //性别
id = 1; //编号
wisdom = 90; //智慧
strategy = 92; //谋略
force = 55; //力量
agility = 28; //敏捷

skill_name = "天下归心";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Sword;
}

void CaoCao::skill(Hero * hero)
{
}

void CaoCao::passive_skill()
{
this->HP += this->strategy * 15 + this->wisdom * 10;
this->max_HP = this->HP;
this->atk += this->force;
}

DianWei::DianWei()
{
name = "典韦"; //姓名
ctry = "魏"; //国家
sex = "男"; //性别
id = 2; //编号
wisdom = 54; //智慧
strategy = 32; //谋略
force = 100; //力量
agility = 80; //敏捷

skill_name = "古之恶来";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Knife;
}

void DianWei::skill(Hero * hero)
{
}

void DianWei::passive_skill()
{
this->HP = ceil(this->HP*1.4);
this->max_HP = this->HP;
this->def += floor(this->force*0.7);
this->atk = ceil(this->atk * 0.9);
this->suckBlood += 10;
}

XuChu::XuChu()
{
name = "许褚"; //姓名
ctry = "魏"; //国家
sex = "男"; //性别
id = 3; //编号
wisdom = 50; //智慧
strategy = 20; //谋略
force = 98; //力量
agility = 72; //敏捷

skill_name = "虎痴卸甲";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new DragonSword;
}

void XuChu::skill(Hero * hero)
{
}

void XuChu::passive_skill()
{
this->atk = floor(this->atk*1.3);
this->crit += 30;
}

GuoJia::GuoJia()
{
name = "郭嘉"; //姓名
ctry = "魏"; //国家
sex = "男"; //性别
id = 4; //编号
wisdom = 100; //智慧
strategy = 98; //谋略
force = 5; //力量
agility = 10; //敏捷

skill_name = "鬼才";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Book;
}

void GuoJia::skill(Hero * hero)
{
}

void GuoJia::passive_skill()
{
this->vel += this->wisdom;
this->stun += 30;
}

XiaHouDun::XiaHouDun()
{
name = "夏侯惇"; //姓名
ctry = "魏"; //国家
sex = "男"; //性别
id = 5; //编号
wisdom = 78; //智慧
strategy = 56; //谋略
force = 85; //力量
agility = 72; //敏捷

skill_name = "";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new DragonSword;
}

void XiaHouDun::skill(Hero * hero)
{
}

void XiaHouDun::passive_skill()
{
this->atk += 20;
this->stun += 50;
}

XiaHouYuan::XiaHouYuan()
{
name = "夏侯渊"; //姓名
ctry = "魏"; //国家
sex = "男"; //性别
id = 6; //编号
wisdom = 72; //智慧
strategy = 65; //谋略
force = 80; //力量
agility = 95; //敏捷

skill_name = "";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Bow;
}

void XiaHouYuan::skill(Hero * hero)
{
}

void XiaHouYuan::passive_skill()
{
this->vel = ceil(this->vel*1.3);
this->atk += this->strategy;
}

CaoRen::CaoRen()
{
name = "曹仁"; //姓名
ctry = "魏"; //国家
sex = "男"; //性别
id = 7; //编号
wisdom = 77; //智慧
strategy = 80; //谋略
force = 72; //力量
agility = 70; //敏捷

skill_name = "无懈可击";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Shield;
}

void CaoRen::skill(Hero * hero)
{
}

void CaoRen::passive_skill()
{
this->HP += 2000;
this->max_HP = HP;
this->def = ceil(this->def*1.2);
this->atk = floor(this->atk*0.4);
this->suckBlood += 80;
}

ZhangLiao::ZhangLiao()
{
name = "张辽"; //姓名
ctry = "魏"; //国家
sex = "男"; //性别
id = 8; //编号
wisdom = 82; //智慧
strategy = 80; //谋略
force = 78; //力量
agility = 80; //敏捷

skill_name = "";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Spear;
}

void ZhangLiao::skill(Hero * hero)
{
}

void ZhangLiao::passive_skill()
{
this->HP += this->strategy * 15 + this->wisdom * 10;
this->max_HP = this->HP;
this->miss += 20;
}

SiMaYi::SiMaYi()
{
name = "司马懿"; //姓名
ctry = "魏"; //国家
sex = "男"; //性别
id = 9; //编号
wisdom = 99; //智慧
strategy = 100; //谋略
force = 34; //力量
agility = 45; //敏捷

skill_name = "狼顾之相";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Fan;
}

void SiMaYi::skill(Hero * hero)
{
}

void SiMaYi::passive_skill()
{
this->HP += this->strategy * 15 + this->wisdom * 10;
this->max_HP = this->HP;
this->atk += this->agility;
}

XuHuang::XuHuang()
{
name = "徐晃"; //姓名
ctry = "魏"; //国家
sex = "男"; //性别
id = 10; //编号
wisdom = 75; //智慧
strategy = 82; //谋略
force = 82; //力量
agility = 75; //敏捷

skill_name = "兵粮寸断";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new DragonSword;
}

void XuHuang::skill(Hero * hero)
{
}

void XuHuang::passive_skill()
{
this->atk += this->force;
this->stun += 15;
}

ZhenJi::ZhenJi()
{
name = "甄姬"; //姓名
ctry = "魏"; //国家
sex = "女"; //性别
id = 11; //编号
wisdom = 80; //智慧
strategy = 25; //谋略
force = 20; //力量
agility = 100; //敏捷

skill_name = "洛神降临";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Knife;
}

void ZhenJi::skill(Hero * hero)
{
}

void ZhenJi::passive_skill()
{
this->def += this->strategy * 0.5 + this->wisdom * 0.2;
this->miss += 30;
}

CaiWenJi::CaiWenJi()
{
name = "蔡文姬";//姓名
ctry = "魏"; //国家
sex = "女"; //性别
id = 12; //编号
wisdom = 95; //智慧
strategy = 35; //谋略
force = 25; //力量
agility = 55; //敏捷

skill_name = "胡笳之音";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Book;
}

void CaiWenJi::skill(Hero * hero)
{
}

void CaiWenJi::passive_skill()
{
this->HP += this->strategy * 15 + this->wisdom * 10;
this->max_HP = this->HP;
this->stun += 20;
}

Shu.h

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
#pragma once
#include"Hero.h"

class LiuBei : public Hero {
public:
LiuBei();
void skill(Hero * hero);
void passive_skill();
};

class GuanYu :public Hero {
public:
GuanYu();
void skill(Hero * hero);
void passive_skill();
};

class ZhangFei : public Hero {
public:
ZhangFei();
void skill(Hero * hero);
void passive_skill();
};

class ZhuGeLiang : public Hero {
public:
ZhuGeLiang();
void skill(Hero * hero);
void passive_skill();
};

class ZhaoYun : public Hero {
public:
ZhaoYun();
void skill(Hero * hero);
void passive_skill();
};

class MaChao : public Hero {
public:
MaChao();
void skill(Hero * hero);
void passive_skill();
};

class HuangZhong : public Hero {
public:
HuangZhong();
void skill(Hero * hero);
void passive_skill();
};

class WeiYan : public Hero {
public:
WeiYan();
void skill(Hero * hero);
void passive_skill();
};

class HuangYueYing : public Hero {
public:
HuangYueYing();
void skill(Hero * hero);
void passive_skill();
};

class JiangWei : public Hero {
public:
JiangWei();
void skill(Hero * hero);
void passive_skill();
};

class PangTong : public Hero {
public:
PangTong();
void skill(Hero * hero);
void passive_skill();
};

class SunShangXiang : public Hero {
public:
SunShangXiang();
void skill(Hero * hero);
void passive_skill();
};

Shu.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
#include "Shu.h"

LiuBei::LiuBei()
{
name = "刘备"; //姓名
ctry = "蜀"; //国家
sex = "男"; //性别
id = 1; //编号
wisdom = 72; //智慧
strategy = 62; //谋略
force = 60; //力量
agility = 25; //敏捷

skill_name = "唯贤唯德";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Sword;
}

void LiuBei::skill(Hero * hero)
{
this->MP = 0;
}

void LiuBei::passive_skill()
{
this->HP += this->strategy * 15 + this->wisdom * 10;
this->max_HP = this->HP;
this->atk += this->strategy;
}

GuanYu::GuanYu()
{
name = "关羽"; //姓名
ctry = "蜀"; //国家
sex = "男"; //性别
id = 2; //编号
wisdom = 60; //智慧
strategy = 60; //谋略
force = 98; //力量
agility = 90; //敏捷

skill_name = "春秋偃月";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new DragonSword;
}

void GuanYu::skill(Hero * hero)
{
this->MP = 0;
}

void GuanYu::passive_skill()
{
this->stun += 50;
}

ZhangFei::ZhangFei()
{
name = "张飞"; //姓名
ctry = "蜀"; //国家
sex = "男"; //性别
id = 3; //编号
wisdom = 70; //智慧
strategy = 77; //谋略
force = 100; //力量
agility = 72; //敏捷

skill_name = "雷霆咆哮";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Spear;
}

void ZhangFei::skill(Hero * hero)
{
this->MP = 0;
}

void ZhangFei::passive_skill()
{
this->atk = floor(this->atk*0.9);
this->crit += 50;
}


ZhuGeLiang::ZhuGeLiang()
{
name = "诸葛亮"; //姓名
ctry = "蜀"; //国家
sex = "男"; //性别
id = 4; //编号
wisdom = 100; //智慧
strategy = 100; //谋略
force = 10; //力量
agility = 32; //敏捷

skill_name = "卧龙啸天";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Fan;
}

void ZhuGeLiang::skill(Hero * hero)
{
this->MP = 0;
}

void ZhuGeLiang::passive_skill()
{
this->vel += 50;
this->atk += 50;
this->miss += 30;
}

ZhaoYun::ZhaoYun()
{
name = "赵云"; //姓名
ctry = "蜀"; //国家
sex = "男"; //性别
id = 5; //编号
wisdom = 75; //智慧
strategy = 80; //谋略
force = 98; //力量
agility = 100; //敏捷

skill_name = "七探蛇盘";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Spear;
}

void ZhaoYun::skill(Hero * hero)
{
this->MP = 0;
}

void ZhaoYun::passive_skill()
{
this->miss += 50;
}

MaChao::MaChao()
{
name = "马超"; //姓名
ctry = "蜀"; //国家
sex = "男"; //性别
id = 6; //编号
wisdom = 42; //智慧
strategy = 20; //谋略
force = 95; //力量
agility = 94; //敏捷

skill_name = "西凉铁骑";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Spear;
}

void MaChao::skill(Hero * hero)
{
}

void MaChao::passive_skill()
{
this->vel *= 2;
this->crit += 30;
this->stun += 10;
}

HuangZhong::HuangZhong()
{
name = "黄忠"; //姓名
ctry = "蜀"; //国家
sex = "男"; //性别
id = 7; //编号
wisdom = 50; //智慧
strategy = 45; //谋略
force = 98; //力量
agility = 72; //敏捷

skill_name = "百步穿杨";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Bow;
}

void HuangZhong::skill(Hero * hero)
{
}

void HuangZhong::passive_skill()
{
this->atk += 20;
this->stun += 50;
}

WeiYan::WeiYan()
{
name = "魏延"; //姓名
ctry = "蜀"; //国家
sex = "男"; //性别
id = 8; //编号
wisdom = 25; //智慧
strategy = 75; //谋略
force = 80; //力量
agility = 75; //敏捷

skill_name = "傲骨风凉";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Shield;
}

void WeiYan::skill(Hero * hero)
{
}

void WeiYan::passive_skill()
{
this->atk *= 1.5;
}

HuangYueYing::HuangYueYing()
{
name = "黄月英";//姓名
ctry = "蜀"; //国家
sex = "女"; //性别
id = 9; //编号
wisdom = 99; //智慧
strategy = 90; //谋略
force = 5; //力量
agility = 65; //敏捷

skill_name = "奇门遁甲";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Book;
}

void HuangYueYing::skill(Hero * hero)
{
}

void HuangYueYing::passive_skill()
{
this->def += 50;
this->miss += 30;
}

JiangWei::JiangWei()
{
name = "姜维"; //姓名
ctry = "蜀"; //国家
sex = "男"; //性别
id = 10; //编号
wisdom = 80; //智慧
strategy = 92; //谋略
force = 80; //力量
agility = 90; //敏捷

skill_name = "幼麟之风";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Knife;
}

void JiangWei::skill(Hero * hero)
{
}

void JiangWei::passive_skill()
{
}

PangTong::PangTong()
{
name = "庞统"; //姓名
ctry = "蜀"; //国家
sex = "男"; //性别
id = 11; //编号
wisdom = 90; //智慧
strategy = 94; //谋略
force = 5; //力量
agility = 18; //敏捷

skill_name = "火凤燎原";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Fan;
}

void PangTong::skill(Hero * hero)
{
}

void PangTong::passive_skill()
{
this->atk *= 1.2;
this->vel *= 1.2;
this->def *= 1.2;
this->miss += 10;
}

SunShangXiang::SunShangXiang()
{
name = "孙尚香"; //姓名
ctry = "蜀"; //国家
sex = "女"; //性别
id = 12; //编号
wisdom = 56; //智慧
strategy = 42; //谋略
force = 65; //力量
agility = 80; //敏捷

skill_name = "枭姬联姻";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Bow;
}

void SunShangXiang::skill(Hero * hero)
{
}

void SunShangXiang::passive_skill()
{
this->miss += 20;
this->stun += 20;
this->atk += 20;
}

Wu.h

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
#pragma once
#include"Hero.h"

class SunCe : public Hero {
public:
SunCe();
void skill(Hero * hero);
void passive_skill();
};

class ZhouYu :public Hero {
public:
ZhouYu();
void skill(Hero * hero);
void passive_skill();
};

class SunQuan : public Hero {
public:
SunQuan();
void skill(Hero * hero);
void passive_skill();
};

class DaQiao : public Hero {
public:
DaQiao();
void skill(Hero * hero);
void passive_skill();
};

class XiaoQiao : public Hero {
public:
XiaoQiao();
void skill(Hero * hero);
void passive_skill();
};

class HuangGai : public Hero {
public:
HuangGai();
void skill(Hero * hero);
void passive_skill();
};

class TaiShiCi : public Hero {
public:
TaiShiCi();
void skill(Hero * hero);
void passive_skill();
};

class GanNing : public Hero {
public:
GanNing();
void skill(Hero * hero);
void passive_skill();
};

class LuSu : public Hero {
public:
LuSu();
void skill(Hero * hero);
void passive_skill();
};

class LvMeng : public Hero {
public:
LvMeng();
void skill(Hero * hero);
void passive_skill();
};

class ZhangZhao : public Hero {
public:
ZhangZhao();
void skill(Hero * hero);
void passive_skill();
};

class ZhouTai : public Hero {
public:
ZhouTai();
void skill(Hero * hero);
void passive_skill();
};

Wu.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
#include "Wu.h"

SunCe::SunCe()
{
name = "孙策"; //姓名
ctry = "吴"; //国家
sex = "男"; //性别
id = 1; //编号
wisdom = 78; //智慧
strategy = 65; //谋略
force = 100; //力量
agility = 85; //敏捷

skill_name = "力拔山河";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Spear;
}

void SunCe::skill(Hero * hero)
{
}

void SunCe::passive_skill()
{
this->HP += this->strategy * 15 + this->wisdom * 10;
this->max_HP = this->HP;
this->atk += this->wisdom;
}

ZhouYu::ZhouYu()
{
name = "周瑜"; //姓名
ctry = "吴"; //国家
sex = "男"; //性别
id = 2; //编号
wisdom = 90; //智慧
strategy = 98; //谋略
force = 70; //力量
agility = 80; //敏捷

skill_name = "业火焚天";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Sword;
}

void ZhouYu::skill(Hero * hero)
{
}

void ZhouYu::passive_skill()
{
}

SunQuan::SunQuan()
{
name = "孙权"; //姓名
ctry = "吴"; //国家
sex = "男"; //性别
id = 3; //编号
wisdom = 80; //智慧
strategy = 80; //谋略
force = 50; //力量
agility = 60; //敏捷

skill_name = "气势汹汹";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Sword;
}

void SunQuan::skill(Hero * hero)
{
}

void SunQuan::passive_skill()
{
}

DaQiao::DaQiao()
{
name = "大乔"; //姓名
ctry = "吴"; //国家
sex = "女"; //性别
id = 4; //编号
wisdom = 85; //智慧
strategy = 45; //谋略
force = 30; //力量
agility = 75; //敏捷

skill_name = "国色天香";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Knife;
}

void DaQiao::skill(Hero * hero)
{
}

void DaQiao::passive_skill()
{
}

XiaoQiao::XiaoQiao()
{
name = "小乔"; //姓名
ctry = "吴"; //国家
sex = "女"; //性别
id = 5; //编号
wisdom = 80; //智慧
strategy = 40; //谋略
force = 25; //力量
agility = 85; //敏捷

skill_name = "玲珑之花";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Knife;
}

void XiaoQiao::skill(Hero * hero)
{
}

void XiaoQiao::passive_skill()
{
}

HuangGai::HuangGai()
{
name = "黄盖"; //姓名
ctry = "吴"; //国家
sex = "男"; //性别
id = 6; //编号
wisdom = 65; //智慧
strategy = 65; //谋略
force = 85; //力量
agility = 35; //敏捷

skill_name = "苦肉之计";
skill_show = "";
this->weapon = new Shield;

this->init_property();
this->passive_skill();
}

void HuangGai::skill(Hero * hero)
{
}

void HuangGai::passive_skill()
{
}

TaiShiCi::TaiShiCi()
{
name = "太史慈"; //姓名
ctry = "吴"; //国家
sex = "男"; //性别
id = 7; //编号
wisdom = 70; //智慧
strategy = 50; //谋略
force = 90; //力量
agility = 90; //敏捷

skill_name = "受宠打击";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Bow;
}

void TaiShiCi::skill(Hero * hero)
{
}

void TaiShiCi::passive_skill()
{
}

GanNing::GanNing()
{
name = "甘宁"; //姓名
ctry = "吴"; //国家
sex = "男"; //性别
id = 8; //编号
wisdom = 65; //智慧
strategy = 75; //谋略
force = 76; //力量
agility = 80; //敏捷

skill_name = "百骑袭营";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Bow;
}

void GanNing::skill(Hero * hero)
{
}

void GanNing::passive_skill()
{
}

LuSu::LuSu()
{
name = "鲁肃"; //姓名
ctry = "吴"; //国家
sex = "男"; //性别
id = 9; //编号
wisdom = 80; //智慧
strategy = 90; //谋略
force = 40; //力量
agility = 60; //敏捷

skill_name = "大智若愚";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Fan;
}

void LuSu::skill(Hero * hero)
{
}

void LuSu::passive_skill()
{
}

LvMeng::LvMeng()
{
name = "吕蒙"; //姓名
ctry = "吴"; //国家
sex = "男"; //性别
id = 10; //编号
wisdom = 80; //智慧
strategy = 80; //谋略
force = 80; //力量
agility = 80; //敏捷

skill_name = "白衣渡江";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new DragonSword;
}

void LvMeng::skill(Hero * hero)
{
}

void LvMeng::passive_skill()
{
}

ZhangZhao::ZhangZhao()
{
name = "张昭"; //姓名
ctry = "吴"; //国家
sex = "男"; //性别
id = 11; //编号
wisdom = 80; //智慧
strategy = 95; //谋略
force = 25; //力量
agility = 55; //敏捷

skill_name = "制衡之道";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Book;
}

void ZhangZhao::skill(Hero * hero)
{
}

void ZhangZhao::passive_skill()
{
}

ZhouTai::ZhouTai()
{
name = "周泰"; //姓名
ctry = "吴"; //国家
sex = "男"; //性别
id = 12; //编号
wisdom = 60; //智慧
strategy = 45; //谋略
force = 90; //力量
agility = 80; //敏捷

skill_name = "";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Shield;
}

void ZhouTai::skill(Hero * hero)
{
}

void ZhouTai::passive_skill()
{
}

Qun.h

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
#pragma once
#include"Hero.h"

class LvBu : public Hero {
public:
LvBu();
void skill(Hero * hero);
void passive_skill();
};

class DiaoChan :public Hero {
public:
DiaoChan();
void skill(Hero * hero);
void passive_skill();
};

class HuaTuo : public Hero {
public:
HuaTuo();
void skill(Hero * hero);
void passive_skill();
};

class YuanShao : public Hero {
public:
YuanShao();
void skill(Hero * hero);
void passive_skill();
};

class YanLiang : public Hero {
public:
YanLiang();
void skill(Hero * hero);
void passive_skill();
};

class WenChou : public Hero {
public:
WenChou();
void skill(Hero * hero);
void passive_skill();
};

class ZuoCi : public Hero {
public:
ZuoCi();
void skill(Hero * hero);
void passive_skill();
};

class HuaXiong : public Hero {
public:
HuaXiong();
void skill(Hero * hero);
void passive_skill();
};

class GongSunZan : public Hero {
public:
GongSunZan();
void skill(Hero * hero);
void passive_skill();
};

class ZhangJiao : public Hero {
public:
ZhangJiao();
void skill(Hero * hero);
void passive_skill();
};

class YuJi : public Hero {
public:
YuJi();
void skill(Hero * hero);
void passive_skill();
};

class LingJu : public Hero {
public:
LingJu();
void skill(Hero * hero);
void passive_skill();
};

Qun.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
#include "Qun.h"

LvBu::LvBu()
{
name = "吕布"; //姓名
ctry = "群"; //国家
sex = "男"; //性别
id = 1; //编号
wisdom = 35; //智慧
strategy = 10; //谋略
force = 100; //力量
agility = 100; //敏捷

skill_name = "方天画斩";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Spear;
}

void LvBu::skill(Hero * hero)
{
}

void LvBu::passive_skill()
{
this->HP += this->strategy * 15 + this->wisdom * 10;
this->max_HP = this->HP;
this->atk += this->agility;
}

DiaoChan::DiaoChan()
{
name = "貂蝉"; //姓名
ctry = "群"; //国家
sex = "女"; //性别
id = 2; //编号
wisdom = 96; //智慧
strategy = 60; //谋略
force = 10; //力量
agility = 100; //敏捷

skill_name = "闭月羞花";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Knife;
}

void DiaoChan::skill(Hero * hero)
{
}

void DiaoChan::passive_skill()
{
}

HuaTuo::HuaTuo()
{
name = "华佗"; //姓名
ctry = "群"; //国家
sex = "男"; //性别
id = 3; //编号
wisdom = 80; //智慧
strategy = 37; //谋略
force = 60; //力量
agility = 60; //敏捷

skill_name = "妙手回天";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Book;
}

void HuaTuo::skill(Hero * hero)
{
}

void HuaTuo::passive_skill()
{
}

YuanShao::YuanShao()
{
name = "袁绍"; //姓名
ctry = "群"; //国家
sex = "男"; //性别
id = 4; //编号
wisdom = 27; //智慧
strategy = 20; //谋略
force = 44; //力量
agility = 55; //敏捷

skill_name = "万箭齐发";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Sword;
}

void YuanShao::skill(Hero * hero)
{
}

void YuanShao::passive_skill()
{
}

YanLiang::YanLiang()
{
name = "颜良"; //姓名
ctry = "群"; //国家
sex = "男"; //性别
id = 5; //编号
wisdom = 60; //智慧
strategy = 60; //谋略
force = 90; //力量
agility = 90; //敏捷

skill_name = "致命一击";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Spear;
}

void YanLiang::skill(Hero * hero)
{
}

void YanLiang::passive_skill()
{
}

WenChou::WenChou()
{
name = "文丑"; //姓名
ctry = "群"; //国家
sex = "男"; //性别
id = 6; //编号
wisdom = 66; //智慧
strategy = 66; //谋略
force = 88; //力量
agility = 88; //敏捷

skill_name = "暗箭难防";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Bow;
}

void WenChou::skill(Hero * hero)
{
}

void WenChou::passive_skill()
{
}

ZuoCi::ZuoCi()
{
name = "左慈"; //姓名
ctry = "群"; //国家
sex = "男"; //性别
id = 7; //编号
wisdom = 100; //智慧
strategy = 90; //谋略
force = 55; //力量
agility = 20; //敏捷

skill_name = "道法自然";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Book;
}

void ZuoCi::skill(Hero * hero)
{
}

void ZuoCi::passive_skill()
{
}

HuaXiong::HuaXiong()
{
name = "华雄"; //姓名
ctry = "群"; //国家
sex = "男"; //性别
id = 8; //编号
wisdom = 60; //智慧
strategy = 67; //谋略
force = 90; //力量
agility = 70; //敏捷

skill_name = "豪情万丈";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new DragonSword;
}

void HuaXiong::skill(Hero * hero)
{
}

void HuaXiong::passive_skill()
{
}

GongSunZan::GongSunZan()
{
name = "公孙瓒";//姓名
ctry = "群"; //国家
sex = "男"; //性别
id = 9; //编号
wisdom = 60; //智慧
strategy = 65; //谋略
force = 80; //力量
agility = 90; //敏捷

skill_name = "白马义从";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Spear;
}

void GongSunZan::skill(Hero * hero)
{
}

void GongSunZan::passive_skill()
{
}

ZhangJiao::ZhangJiao()
{
name = "张角"; //姓名
ctry = "群"; //国家
sex = "男"; //性别
id = 10; //编号
wisdom = 45; //智慧
strategy = 65; //谋略
force = 55; //力量
agility = 70; //敏捷

skill_name = "天公降雷";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Fan;
}

void ZhangJiao::skill(Hero * hero)
{
}

void ZhangJiao::passive_skill()
{
}

YuJi::YuJi()
{
name = "于吉"; //姓名
ctry = "群"; //国家
sex = "男"; //性别
id = 11; //编号
wisdom = 90; //智慧
strategy = 80; //谋略
force = 40; //力量
agility = 10; //敏捷

skill_name = "太平要术";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Book;
}

void YuJi::skill(Hero * hero)
{
}

void YuJi::passive_skill()
{
}

LingJu::LingJu()
{
name = "灵雎"; //姓名
ctry = "群"; //国家
sex = "女"; //性别
id = 12; //编号
wisdom = 90; //智慧
strategy = 40; //谋略
force = 60; //力量
agility = 70; //敏捷

skill_name = "涅槃";
skill_show = "";

this->init_property();
this->passive_skill();
this->weapon = new Knife;
}

void LingJu::skill(Hero * hero)
{
}

void LingJu::passive_skill()
{
}

文章结束了,但我们的故事还在继续
坚持原创技术分享,您的支持将鼓励我继续创作!