如何编出一个大型游戏

如何编出一个大型游戏

第三部(2000~3000行)

									cout << people[x].name << "手中";
									color(people[x].weapon.lv);
									cout << people[x].weapon.name;
									color(16);
									cout << "击中对方手部,造成0点伤害!" << endl;
								} else {
									cout << people[x].name << "手中";
									color(people[x].weapon.lv);
									cout << people[x].weapon.name;
									color(16);
									cout << "击中对方手部,造成" << people[x].skills[i].damage + ran - defense <<
									"点伤害!" << endl;
									health -= people[x].skills[i].damage + ran - defense;
								}
							}
							if (health > maxhealth / 6 * 5) {
								cout << "(";
								color(10);
								cout << "你看起来一点也不累,充满了活力";
								color(16);
								cout << ")" << endl;
							} else if (health > maxhealth / 6 * 4) {
								cout << "(";
								color(14);
								cout << "你看上去受了一点小伤,但并不碍事";
								color(16);
								cout << ")" << endl;
							} else if (health > maxhealth / 6 * 3) {
								cout << "(";
								color(14);
								cout << "你气喘吁吁,有点累了";
								color(16);
								cout << ")" << endl;
							} else if (health > maxhealth / 6 * 2) {
								cout << "(";
								color(12);
								cout << "你摇头晃脑,但还能支撑一会";
								color(16);
								cout << ")" << endl;
							} else if (health > maxhealth / 6) {
								cout << "(";
								color(12);
								cout << "你已经力不从心,随时都可能倒下";
								color(16);
								cout << ")" << endl;
							} else {
								cout << "(";
								color(4);
								cout << "你已如风中残烛,生命危在旦夕";
								color(16);
								cout << ")" << endl;
							}
							if (health <= 0) {
								cout << "你大叫一声,倒在地上,死了!" << endl;
								make_corpse(me, nweapon);
								for (int i = 0; i < peoplenum; i++) {
									room[nowroomi].people[peoplei[i]].canmove = cm[i];
									inroom.people[peoplei[i]].canmove = cm[i];
								}
								return 1;
							} else if (isrebound) {
								int att = people[x].skills[i].damage * reboundnum / 1000 + ran -
								people[x].defense;
								if (att < 0) {
									att = 0;
								}
								cout << "你抽出";
								color(nweapon.lv);
								cout << nweapon.name;
								color(16);
								cout << "一挡,对方手中";
								color(people[x].weapon.lv);
								cout << people[x].weapon.name;
								color(16);
								cout << "往后一弹,把伤害打到了自己身上,造成" << att << "点伤害!" << endl;
								people[x].health -= att;
								inroom.people[peoplei[x]].health -= att;
								room[nowroomi].people[peoplei[x]].health -= att;
								if (people[x].health > people[x].maxhealth / 6 * 5) {
									cout << "(";
									color(10);
									cout << people[x].name << "看起来一点也不累,充满了活力";
									color(16);
									cout << ")" << endl;
								} else if (people[x].health > people[x].maxhealth / 6 * 4) {
									cout << "(";
									color(14);
									cout << people[x].name << "看上去受了一点小伤,但并不碍事";
									color(16);
									cout << ")" << endl;
								} else if (people[x].health > people[x].maxhealth / 6 * 3) {
									cout << "(";
									color(14);
									cout << people[x].name << "气喘吁吁,有点累了";
									color(16);
									cout << ")" << endl;
								} else if (people[x].health > people[x].maxhealth / 6 * 2) {
									cout << "(";
									color(12);
									cout << people[x].name << "摇头晃脑,但还能支撑一会";
									color(16);
									cout << ")" << endl;
								} else if (people[x].health > people[x].maxhealth / 6) {
									cout << "(";
									color(12);
									cout << people[x].name << "已经力不从心,随时都可能倒下";
									color(16);
									cout << ")" << endl;
								} else {
									cout << "(";
									color(4);
									cout << people[x].name << "已如风中残烛,生命危在旦夕";
									color(16);
									cout << ")" << endl;
								}
								if (people[x].health <= 0) {
									cout << people[x].name << "大叫一声,倒在地上,死了!" << endl;
									killnum++;
									make_corpse(people[x], people[x].weapon);
									for (int i = 0; i < 100; i++) {
										if (inroom.weapon[i].name == "") {
											inroom.weapon[i] = people[x].dropweapon;
											room[nowroomi].weapon[i] = people[x].dropweapon;
											break;
										}
									}
									for (int i = 0; i < 100; i++) {
										if (inroom.thing[i].name == "") {
											inroom.thing[i] = people[x].dropthing;
											room[nowroomi].thing[i] = people[x].dropthing;
											break;
										}
									}
									for (int i = 0; i < 100; i++) {
										if (inroom.book[i].name == "") {
											inroom.book[i] = people[x].dropbook;
											room[nowroomi].book[i] = people[x].dropbook;
											break;
										}
									}
									die[x] = true;
									lastpeople--;
									if (lastpeople == 0) {
										for (int i = 0; i < peoplenum; i++) {
											room[nowroomi].people[peoplei[i]].canmove = cm[i];
											inroom.people[peoplei[i]].canmove = cm[i];
										}
										return 0;
									}
								}
							}
						}
					}
				} else {
					for (int j = 0; j < GeneralAttack[people[x].weapon.type].size(); j++) {
						if (GeneralAttack[people[x].weapon.type][j] == 'a') {
							cout << people[x].name;
						} else if (GeneralAttack[people[x].weapon.type][j] == 'x') {
							color(people[x].weapon.lv);
							cout << people[x].weapon.name;
							color(16);
						} else if (GeneralAttack[people[x].weapon.type][j] == 'b') {
							cout << "你";
						} else {
							cout << GeneralAttack[people[x].weapon.type][j];
						}
					}
					cout << endl << endl;
					if (rand() % 10000 < dodge - people[x].hit) {
						if (nowdodgeskill.name != "") {
							for (int k = 0; k < nowdodgeskill.use.size(); k++) {
								if (nowdodgeskill.use[k] == 'w') {
									color(nweapon.lv);
									cout << nweapon.name;
									color(16);
								} else if (nowdodgeskill.use[k] == 'e') {
									cout << people[x].name;
								} else if (nowdodgeskill.use[k] == 'q') {
									color(people[x].weapon.lv);
									cout << people[x].weapon.name;
									color(16);
								} else if (nowdodgeskill.use[k] == '1') {
									color(1);
								} else if (nowdodgeskill.use[k] == '2') {
									color(2);
								} else if (nowdodgeskill.use[k] == '3') {
									color(3);
								} else if (nowdodgeskill.use[k] == '4') {
									color(4);
								} else if (nowdodgeskill.use[k] == '5') {
									color(5);
								} else if (nowdodgeskill.use[k] == '6') {
									color(6);
								} else if (nowdodgeskill.use[k] == '7') {
									color(7);
								} else if (nowdodgeskill.use[k] == '8') {
									color(8);
								} else if (nowdodgeskill.use[k] == '9') {
									color(9);
								} else if (nowdodgeskill.use[k] == 's') {
									color(16);
								} else {
									cout << nowdodgeskill.use[k];
								}
							}
							cout << endl;
						} else {
							cout << " 你轻轻一跳,躲过了着一招" << endl;
						}
					} else {
						int ran = rand() % 40 - 20;
						if (people[x].weapon.type == "拳") {
							if (people[x].damage + ran - defense < 0) {
								cout << people[x].name << "在你身上照成了一块於,造成0点伤害!" << endl;
							} else {
								cout << people[x].name << "在你身上照成了一块於,造成" << people[x].damage + ran
								- defense << "点伤害!" << endl;
								health -= people[x].damage + ran - defense;
							}
						} else {
							if (people[x].damage + ran - defense < 0) {
								cout << people[x].name << "手中";
								color(people[x].weapon.lv);
								cout << people[x].weapon.name;
								color(16);
								cout << "击中对方手部,造成0点伤害!" << endl;
							} else {
								cout << people[x].name << "手中";
								color(people[x].weapon.lv);
								cout << people[x].weapon.name;
								color(16);
								cout << "击中对方手部,造成" << people[x].damage + ran - defense << "点伤害!"
								<< endl;
								health -= people[x].damage + ran - defense;
							}
						}
						if (health > maxhealth / 6 * 5) {
							cout << "(";
							color(10);
							cout << "你看起来一点也不累,充满了活力";
							color(16);
							cout << ")" << endl;
						} else if (health > maxhealth / 6 * 4) {
							cout << "(";
							color(14);
							cout << "你看上去受了一点小伤,但并不碍事";
							color(16);
							cout << ")" << endl;
						} else if (health > maxhealth / 6 * 3) {
							cout << "(";
							color(14);
							cout << "你气喘吁吁,有点累了";
							color(16);
							cout << ")" << endl;
						} else if (health > maxhealth / 6 * 2) {
							cout << "(";
							color(12);
							cout << "你摇头晃脑,但还能支撑一会";
							color(16);
							cout << ")" << endl;
						} else if (health > maxhealth / 6) {
							cout << "(";
							color(12);
							cout << "你已经力不从心,随时都可能倒下";
							color(16);
							cout << ")" << endl;
						} else {
							cout << "(";
							color(4);
							cout << "你已如风中残烛,生命危在旦夕";
							color(16);
							cout << ")" << endl;
						}
						if (health <= 0) {
							cout << "你大叫一声,倒在地上,死了!" << endl;
							make_corpse(me, nweapon);
							for (int i = 0; i < peoplenum; i++) {
								room[nowroomi].people[peoplei[i]].canmove = cm[i];
								inroom.people[peoplei[i]].canmove = cm[i];
							}
							return 1;
						} else if (isrebound) {
							int att = people[x].damage * reboundnum / 1000 + ran - people[x].defense;
							if (att < 0) {
								att = 0;
							}
							cout << "你抽出";
							color(nweapon.lv);
							cout << nweapon.name;
							color(16);
							cout << "一挡,对方手中";
							color(people[x].weapon.lv);
							cout << people[x].weapon.name;
							color(16);
							cout << "往后一弹,把伤害打到了自己身上,造成" << att << "点伤害!" << endl;
							people[x].health -= att;
							inroom.people[peoplei[x]].health -= att;
							room[nowroomi].people[peoplei[x]].health -= att;
							if (people[x].health > people[x].maxhealth / 6 * 5) {
								cout << "(";
								color(10);
								cout << people[x].name << "看起来一点也不累,充满了活力";
								color(16);
								cout << ")" << endl;
							} else if (people[x].health > people[x].maxhealth / 6 * 4) {
								cout << "(";
								color(14);
								cout << people[x].name << "看上去受了一点小伤,但并不碍事";
								color(16);
								cout << ")" << endl;
							} else if (people[x].health > people[x].maxhealth / 6 * 3) {
								cout << "(";
								color(14);
								cout << people[x].name << "气喘吁吁,有点累了";
								color(16);
								cout << ")" << endl;
							} else if (people[x].health > people[x].maxhealth / 6 * 2) {
								cout << "(";
								color(12);
								cout << people[x].name << "摇头晃脑,但还能支撑一会";
								color(16);
								cout << ")" << endl;
							} else if (people[x].health > people[x].maxhealth / 6) {
								cout << "(";
								color(12);
								cout << people[x].name << "已经力不从心,随时都可能倒下";
								color(16);
								cout << ")" << endl;
							} else {
								cout << "(";
								color(4);
								cout << people[x].name << "已如风中残烛,生命危在旦夕";
								color(16);
								cout << ")" << endl;
							}
							if (people[x].health <= 0) {
								cout << people[x].name << "大叫一声,倒在地上,死了!" << endl;
								killnum++;
								make_corpse(people[x], people[x].weapon);
								for (int i = 0; i < 100; i++) {
									if (inroom.weapon[i].name == "") {
										inroom.weapon[i] = people[x].dropweapon;
										room[nowroomi].weapon[i] = people[x].dropweapon;
										break;
									}
								}
								for (int i = 0; i < 100; i++) {
									if (inroom.thing[i].name == "") {
										inroom.thing[i] = people[x].dropthing;
										room[nowroomi].thing[i] = people[x].dropthing;
										break;
									}
								}
								for (int i = 0; i < 100; i++) {
									if (inroom.book[i].name == "") {
										inroom.book[i] = people[x].dropbook;
										room[nowroomi].book[i] = people[x].dropbook;
										break;
									}
								}
								die[x] = true;
								lastpeople--;
								if (lastpeople == 0) {
									for (int i = 0; i < peoplenum; i++) {
										room[nowroomi].people[peoplei[i]].canmove = cm[i];
										inroom.people[peoplei[i]].canmove = cm[i];
									}
									return 0;
								}
							}
						}
					}
				}
			}
		}
		for (int i = 0; i < 100; i++) {
			if (cooldown[i] != 0) {
				cooldown[i] -= 1;
			}
			if (hcooldown[i] != 0) {
				hcooldown[i] -= 1;
			}
		}
	}
	return 0;
}
int fightall(pe people[100], int peoplenum, int peoplei[100]) {
	bool cm[100];
	for (int i = 0; i < peoplenum; i++) {
		cm[i] = inroom.people[peoplei[i]].canmove;
		room[nowroomi].people[peoplei[i]].canmove = false;
		inroom.people[peoplei[i]].canmove = false;
	}
	int yell = rand() % 3;
	int lastpeople = peoplenum;
	bool die[100];
	for (int i = 0; i < 100; i++) {
		die[i] = false;
	}
	cout << "你说:「";
	color(12);
	cout << "在下" << myname << ",敢问大侠是否愿意跟我比试一下?";
	color(16);
	cout << "」" << endl;
	int cooldown[100];
	int hcooldown[100];
	experience += rand() % 3;
	potential += rand() % 6;
	for (int i = 0; i < 100; i++) {
		cooldown[i] = 0;
		hcooldown[i] = 0;
	}
	while (1) {
		for (int i = 0; i < peoplenum; i++) {
			if (!die[i]) {
				cout << people[i].Englishname << "[" << people[i].health << "/" <<
				people[i].maxhealth << "]" << endl;
			}
		}
		cout << "请输入攻击者:";
		string who;
		cin >> who;
		int attackwho;
		for (int i = 0; i < peoplenum; i++) {
			if (!die[i]) {
				attackwho = i;
				break;
			}
		}
		for (int i = 0; i < peoplenum; i++) {
			if (people[i].Englishname == who && !die[i]) {
				attackwho = i;
				break;
			}
		}
		cout << "-1,普攻 技能:名字<冷却>[内力使用]" << endl;
		for (int i = 0; i < 100; i++) {
			if ((nweapon.type == myskill[i].weapon || myskill[i].weapon == "无")
				&& myskill[i].isattack == true) {
				cout << i << "," << myskill[i].name << "<" << cooldown[i] << ">[" <<
				myskill[i].forceneed << "]  ";
			}
		}
		int which;
		cin >> which;
		if (which == -1) {
			for (int i = 0; i < GeneralAttack[nweapon.type].size(); i++) {
				if (GeneralAttack[nweapon.type][i] == 'a') {
					cout << "你";
				} else if (GeneralAttack[nweapon.type][i] == 'x') {
					color(nweapon.lv);
					cout << nweapon.name;
					color(16);
				} else if (GeneralAttack[nweapon.type][i] == 'b') {
					cout << people[attackwho].name;
				} else {
					cout << GeneralAttack[nweapon.type][i];
				}
			}
			cout << endl << endl;
			if (rand() % 10000 < people[attackwho].dodge - hit) {
				cout << people[attackwho].name << "轻轻一跳,躲过了着一招" << endl;
			} else {
				int ran = rand() % 40 - 20;
				if (nweapon.type == "拳") {
					if (damage + ran - people[attackwho].defense < 0) {
						cout << "你在对方身上照成了一块於,造成0点伤害!" << endl;
					} else {
						cout << "你在对方身上照成了一块於,造成" << damage + ran -
						people[attackwho].defense << "点伤害!" << endl;
						people[attackwho].health -= damage + ran - people[attackwho].defense;
						inroom.people[peoplei[attackwho]].health -= damage + ran -
						people[attackwho].defense;
						room[nowroomi].people[peoplei[attackwho]].health -= damage + ran -
						people[attackwho].defense;
					}
				} else {
					if (damage + ran - people[attackwho].defense < 0) {
						cout << "你手中";
						color(nweapon.lv);
						cout << nweapon.name;
						color(16);
						cout << "击中对方手部,造成0点伤害!" << endl;
					} else {
						cout << "你手中";
						color(nweapon.lv);
						cout << nweapon.name;
						color(16);
						cout << "击中对方手部,造成" << damage + ran - people[attackwho].defense <<
						"点伤害!" << endl;
						people[attackwho].health -= damage + ran - people[attackwho].defense;
						inroom.people[peoplei[attackwho]].health -= damage + ran -
						people[attackwho].defense;
						room[nowroomi].people[peoplei[attackwho]].health -= damage + ran -
						people[attackwho].defense;
					}
				}
				if (people[attackwho].health > people[attackwho].maxhealth / 6 * 5) {
					cout << "(";
					color(10);
					cout << people[attackwho].name << "看起来一点也不累,充满了活力";
					color(16);
					cout << ")" << endl;
				} else if (people[attackwho].health > people[attackwho].maxhealth / 6 * 4) {
					cout << "(";
					color(14);
					cout << people[attackwho].name << "看上去受了一点小伤,但并不碍事";
					color(16);
					cout << ")" << endl;
				} else if (people[attackwho].health > people[attackwho].maxhealth / 6 * 3) {
					cout << "(";
					color(14);
					cout << people[attackwho].name << "气喘吁吁,有点累了";
					color(16);
					cout << ")" << endl;
				} else if (people[attackwho].health > people[attackwho].maxhealth / 6 * 2) {
					cout << "(";
					color(12);
					cout << people[attackwho].name << "摇头晃脑,但还能支撑一会";
					color(16);
					cout << ")" << endl;
				} else if (people[attackwho].health > people[attackwho].maxhealth / 6) {
					cout << "(";
					color(12);
					cout << people[attackwho].name << "已经力不从心,随时都可能倒下";
					color(16);
					cout << ")" << endl;
				} else {
					cout << "(";
					color(4);
					cout << people[attackwho].name << "已如风中残烛,生命危在旦夕";
					color(16);
					cout << ")" << endl;
				}
				if (people[attackwho].health <= 0) {
					cout << people[attackwho].name << "说:在下武艺实在不如大侠!" << endl;
					inroom.people[peoplei[attackwho]].health =
					inroom.people[peoplei[attackwho]].maxhealth / 2;
					room[nowroomi].people[peoplei[attackwho]].health =
					inroom.people[peoplei[attackwho]].health;
					lastpeople--;
					die[attackwho] = true;
					if (lastpeople == 0) {
						for (int i = 0; i < peoplenum; i++) {
							room[nowroomi].people[peoplei[i]].canmove = cm[i];
							inroom.people[peoplei[i]].canmove = cm[i];
						}
						return 0;
					}
				}
			}
		} else if (cooldown[which] == 0 && myskill[which].weapon == nweapon.type
			&& myskill[which].forceneed <= force) {
			force -= myskill[which].forceneed;
			cooldown[which] = myskill[which].cooldown;
			for (int i = 0; i < myskill[which].use.size(); i++) {
				if (myskill[which].use[i] == 'w') {
					color(nweapon.lv);
					cout << nweapon.name;
					color(16);
				} else if (myskill[which].use[i] == 'e') {
					cout << people[attackwho].name;
				} else if (myskill[which].use[i] == 'q') {
					color(people[attackwho].weapon.lv);
					cout << people[attackwho].weapon.name;
					color(16);
				} else if (myskill[which].use[i] == '1') {
					color(1);
				} else if (myskill[which].use[i] == '2') {
					color(2);
				} else if (myskill[which].use[i] == '3') {
					color(3);
				} else if (myskill[which].use[i] == '4') {
					color(4);
				} else if (myskill[which].use[i] == '5') {
					color(5);
				} else if (myskill[which].use[i] == '6') {
					color(6);
				} else if (myskill[which].use[i] == '7') {
					color(7);
				} else if (myskill[which].use[i] == '8') {
					color(8);
				} else if (myskill[which].use[i] == '9') {
					color(9);
				} else if (myskill[which].use[i] == 's') {
					color(16);
				} else {
					cout << myskill[which].use[i];
				}
			}
			cout << endl;
			cout << "使用了";
			color(1);
			cout << myskill[which].forceneed;
			color(16);
			cout << "点内力,剩余";
			color(6);
			cout << force;
			color(16);
			cout << "点";
			cout << endl;
			for (int i = 0; i < myskill[which].attacknum; i++) {
				if (rand() % 10000 < people[attackwho].dodge - hit) {
					cout << "对方轻轻一跳,躲过了着一招" << endl;
				} else {
					int ran = rand() % 40 - 20;
					if (nweapon.type == "拳") {
						if (myskill[which].damage + ran - people[attackwho].defense < 0) {
							cout << "你在对方身上照成了一块於,造成0点伤害!" << endl;
						} else {
							cout << "你在对方身上照成了一块於,造成" << myskill[which].damage + ran -
							people[attackwho].defense << "点伤害!" << endl;
							people[attackwho].health -= myskill[which].damage + ran -
							people[attackwho].defense;
							inroom.people[peoplei[attackwho]].health -= damage + ran -
							people[attackwho].defense;
							room[nowroomi].people[peoplei[attackwho]].health -= damage + ran -
							people[attackwho].defense;
						}
					} else {
						if (myskill[which].damage + ran - people[attackwho].defense < 0) {
							cout << "你手中";
							color(nweapon.lv);
							cout << nweapon.name;
							color(16);
							cout << "击中对方手部,造成0点伤害!" << endl;
						} else {
							cout << "你手中";
							color(nweapon.lv);
							cout << nweapon.name;
							color(16);
							cout << nweapon.name << "击中对方手部,造成" << myskill[which].damage + ran -
							people[attackwho].defense << "点伤害!" << endl;
							people[attackwho].health -= myskill[which].damage + ran -
							people[attackwho].defense;
							inroom.people[peoplei[attackwho]].health -= damage + ran -
							people[attackwho].defense;
							room[nowroomi].people[peoplei[attackwho]].health -= damage + ran -
							people[attackwho].defense;
						}
					}
					if (people[attackwho].health > people[attackwho].maxhealth / 6 * 5) {
						cout << "(";
						color(10);
						cout << people[attackwho].name << "看起来一点也不累,充满了活力";
						color(16);
						cout << ")" << endl;
					} else if (people[attackwho].health > people[attackwho].maxhealth / 6 * 4) {
						cout << "(";
						color(14);
						cout << people[attackwho].name << "看上去受了一点小伤,但并不碍事";
						color(16);
						cout << ")" << endl;
					} else if (people[attackwho].health > people[attackwho].maxhealth / 6 * 3) {
						cout << "(";
						color(14);
						cout << people[attackwho].name << "气喘吁吁,有点累了";
						color(16);
						cout << ")" << endl;
					} else if (people[attackwho].health > people[attackwho].maxhealth / 6 * 2) {
						cout << "(";
						color(12);
						cout << people[attackwho].name << "摇头晃脑,但还能支撑一会";
						color(16);
						cout << ")" << endl;
					} else if (people[attackwho].health > people[attackwho].maxhealth / 6) {
						cout << "(";
						color(12);
						cout << people[attackwho].name << "已经力不从心,随时都可能倒下";
						color(16);
						cout << ")" << endl;
					} else {
						cout << "(";
						color(4);
						cout << people[attackwho].name << "已如风中残烛,生命危在旦夕";
						color(16);
						cout << ")" << endl;
					}
					if (people[attackwho].health <= 0) {
						cout << people[attackwho].name << "说:在下武艺实在不如大侠!" << endl;
						inroom.people[peoplei[attackwho]].health =
						inroom.people[peoplei[attackwho]].maxhealth / 2;
						room[nowroomi].people[peoplei[attackwho]].health =
						inroom.people[peoplei[attackwho]].health;
						lastpeople--;
						die[attackwho] = true;
						if (lastpeople == 0) {
							for (int i = 0; i < peoplenum; i++) {
								room[nowroomi].people[peoplei[i]].canmove = cm[i];
								inroom.people[peoplei[i]].canmove = cm[i];
							}
							return 0;
						}
						break;
					}
				}
			}
		} else {
			for (int i = 0; i < GeneralAttack[nweapon.type].size(); i++) {
				if (GeneralAttack[nweapon.type][i] == 'a') {
					cout << "你";
				} else if (GeneralAttack[nweapon.type][i] == 'x') {
					color(nweapon.lv);
					cout << nweapon.name;
					color(16);
				} else if (GeneralAttack[nweapon.type][i] == 'b') {
					cout << people[attackwho].name;
				} else {
					cout << GeneralAttack[nweapon.type][i];
				}
			}
			cout << endl << endl;
			if (rand() % 10000 < people[attackwho].dodge - hit) {
				cout << people[attackwho].name << "轻轻一跳,躲过了着一招" << endl;
			} else {
				int ran = rand() % 40 - 20;
				if (nweapon.type == "拳") {
					if (damage + ran - people[attackwho].defense < 0) {
						cout << "你在对方身上照成了一块於,造成0点伤害!" << endl;
					} else {
						cout << "你在对方身上照成了一块於,造成" << damage + ran -
						people[attackwho].defense << "点伤害!" << endl;
						people[attackwho].health -= damage + ran - people[attackwho].defense;
						inroom.people[peoplei[attackwho]].health -= damage + ran -
						people[attackwho].defense;
						room[nowroomi].people[peoplei[attackwho]].health -= damage + ran -
						people[attackwho].defense;
					}
				} else {
					if (damage + ran - people[attackwho].defense < 0) {
						cout << "你手中";
						color(nweapon.lv);
						cout << nweapon.name;
						color(16);
						cout << "击中对方手部,造成0点伤害!" << endl;
					} else {
						cout << "你手中";
						color(nweapon.lv);
						cout << nweapon.name;
						color(16);
						cout << "击中对方手部,造成" << damage + ran - people[attackwho].defense <<
						"点伤害!" << endl;
						people[attackwho].health -= damage + ran - people[attackwho].defense;
						inroom.people[peoplei[attackwho]].health -= damage + ran -
						people[attackwho].defense;
						room[nowroomi].people[peoplei[attackwho]].health -= damage + ran -
						people[attackwho].defense;
					}
				}
				if (people[attackwho].health > people[attackwho].maxhealth / 6 * 5) {
					cout << "(";
					color(10);
					cout << people[attackwho].name << "看起来一点也不累,充满了活力";
					color(16);
					cout << ")" << endl;
				} else if (people[attackwho].health > people[attackwho].maxhealth / 6 * 4) {
					cout << "(";
					color(14);
					cout << people[attackwho].name << "看上去受了一点小伤,但并不碍事";
					color(16);
					cout << ")" << endl;
				} else if (people[attackwho].health > people[attackwho].maxhealth / 6 * 3) {
					cout << "(";
					color(14);
					cout << people[attackwho].name << "气喘吁吁,有点累了";
					color(16);
					cout << ")" << endl;
				} else if (people[attackwho].health > people[attackwho].maxhealth / 6 * 2) {
					cout << "(";
					color(12);
					cout << people[attackwho].name << "摇头晃脑,但还能支撑一会";
					color(16);
					cout << ")" << endl;
				} else if (people[attackwho].health > people[attackwho].maxhealth / 6) {
					cout << "(";
					color(12);
					cout << people[attackwho].name << "已经力不从心,随时都可能倒下";
					color(16);
					cout << ")" << endl;
				} else {
					cout << "(";
					color(4);
					cout << people[attackwho].name << "已如风中残烛,生命危在旦夕";
					color(16);
					cout << ")" << endl;
				}
				if (people[attackwho].health <= 0) {
					cout << people[attackwho].name << "说:在下武艺实在不如大侠!" << endl;
					inroom.people[peoplei[attackwho]].health =
					inroom.people[peoplei[attackwho]].maxhealth / 2;
					room[nowroomi].people[peoplei[attackwho]].health =
					inroom.people[peoplei[attackwho]].health;
					lastpeople--;
					die[attackwho] = true;
					if (lastpeople == 0) {
						for (int i = 0; i < peoplenum; i++) {
							room[nowroomi].people[peoplei[i]].canmove = cm[i];
							inroom.people[peoplei[i]].canmove = cm[i];
						}
						return 0;
					}
				}
			}
		}
		bool canuse = false;
		int i;
		for (i = 0; i < people[attackwho].skillsnum; i++) {
			if (hcooldown[i] == 0) {
				canuse = true;
				break;
			}
		}
		cout << endl;
		for (int x = 0; x < peoplenum; x++) {
			if (!die[x]) {
				if (canuse) {
					hcooldown[i] = people[x].skills[i].cooldown;
					for (int j = 0; j < people[x].skills[i].use.size(); j++) {
						if (people[x].skills[i].use[j] == 'w') {
							color(nweapon.lv);
							cout << nweapon.name;
							color(16);
						} else if (people[x].skills[i].use[j] == 'e') {
							cout << people[x].name;
						} else if (people[x].skills[i].use[j] == 'q') {
							color(people[x].weapon.lv);
							cout << people[x].weapon.name;
							color(16);
						} else if (people[x].skills[i].use[j] == '1') {
							color(1);
						} else if (people[x].skills[i].use[j] == '2') {
							color(2);
						} else if (people[x].skills[i].use[j] == '3') {
							color(3);
						} else if (people[x].skills[i].use[j] == '4') {
							color(4);
						} else if (people[x].skills[i].use[j] == '5') {
							color(5);
						} else if (people[x].skills[i].use[j] == '6') {
							color(6);
						} else if (people[x].skills[i].use[j] == '7') {
							color(7);
						} else if (people[x].skills[i].use[j] == '8') {
							color(8);
						} else if (people[x].skills[i].use[j] == '9') {
							color(9);
						} else if (people[x].skills[i].use[j] == 's') {
							color(16);
						} else {
							cout << people[x].skills[i].use[j];
						}
					}
					cout << endl;
					for (int j = 0; j < people[x].skills[i].attacknum; j++) {
						if (rand() % 10000 < dodge - people[x].hit) {
							if (nowdodgeskill.name != "") {
								for (int k = 0; k < nowdodgeskill.use.size(); k++) {
									if (nowdodgeskill.use[k] == 'w') {
										color(nweapon.lv);
										cout << nweapon.name;
										color(16);
									} else if (nowdodgeskill.use[k] == 'e') {
										cout << people[x].name;
									} else if (nowdodgeskill.use[k] == 'q') {
										color(people[x].weapon.lv);
										cout << people[x].weapon.name;
										color(16);
									} else if (nowdodgeskill.use[k] == '1') {
										color(1);
									} else if (nowdodgeskill.use[k] == '2') {
										color(2);
									} else if (nowdodgeskill.use[k] == '3') {
										color(3);
									} else if (nowdodgeskill.use[k] == '4') {
										color(4);
									} else if (nowdodgeskill.use[k] == '5') {
										color(5);
									} else if (nowdodgeskill.use[k] == '6') {
										color(6);
									} else if (nowdodgeskill.use[k] == '7') {
										color(7);
									} else if (nowdodgeskill.use[k] == '8') {
										color(8);
									} else if (nowdodgeskill.use[k] == '9') {
										color(9);
									} else if (nowdodgeskill.use[k] == 's') {
										color(16);
									} else {
										cout << nowdodgeskill.use[k];
									}
								}
								cout << endl;
							} else {
								cout << " 你轻轻一跳,躲过了着一招" << endl;
							}
						} else {
							int ran = rand() % 40 - 20;
							if (people[x].weapon.type == "拳") {
								if (people[x].skills[i].damage + ran - defense < 0) {
									cout << people[x].name << "在你身上照成了一块於,造成0点伤害!" << endl;
								} else {
									cout << people[x].name << "在你身上照成了一块於,造成" <<
									people[x].skills[i].damage + ran - defense << "点伤害!" << endl;
									health -= people[x].skills[i].damage + ran - defense;
								}
							} else {
								if (people[x].skills[i].damage + ran - defense < 0) {
									cout << people[x].name << "手中";
									color(people[x].weapon.lv);
									cout << people[x].weapon.name;
									color(16);
									cout << "击中对方手部,造成0点伤害!" << endl;
								} else {
									cout << people[x].name << "手中";
									color(people[x].weapon.lv);
									cout << people[x].weapon.name;
									color(16);
									cout << "击中对方手部,造成" << people[x].skills[i].damage + ran - defense <<
									"点伤害!" << endl;
									health -= people[x].skills[i].damage + ran - defense;
								}
							}
							if (health > maxhealth / 6 * 5) {
								cout << "(";
								color(10);
								cout << "你看起来一点也不累,充满了活力";
								color(16);
								cout << ")" << endl;
							} else if (health > maxhealth / 6 * 4) {
								cout << "(";
								color(14);
								cout << "你看上去受了一点小伤,但并不碍事";
								color(16);
								cout << ")" << endl;
							} else if (health > maxhealth / 6 * 3) {
								cout << "(";
								color(14);
								cout << "你气喘吁吁,有点累了";
								color(16);
								cout << ")" << endl;
							} else if (health > maxhealth / 6 * 2) {
								cout << "(";
								color(12);
								cout << "你摇头晃脑,但还能支撑一会";
								color(16);
								cout << ")" << endl;
							} else if (health > maxhealth / 6) {
								cout << "(";
								color(12);
								cout << "你已经力不从心,随时都可能倒下";
								color(16);
								cout << ")" << endl;
							} else {
								cout << "(";
								color(4);
								cout << "你已如风中残烛,生命危在旦夕";
								color(16);
								cout << ")" << endl;
							}
							if (health <= 0) {
								cout << "你说:在下实力实在不如大侠!" << endl;
								health = maxhealth / 2;
								for (int i = 0; i < peoplenum; i++) {
									room[nowroomi].people[peoplei[i]].canmove = cm[i];
									inroom.people[peoplei[i]].canmove = cm[i];
								}
								return 1;
							} else if (isrebound) {
								int att = people[x].skills[i].damage * reboundnum / 1000 + ran -
								people[x].defense;
								if (att < 0) {
									att = 0;
								}
								cout << "你抽出";
								color(nweapon.lv);
								cout << nweapon.name;
								color(16);
								cout << "一挡,对方手中";
								color(people[x].weapon.lv);
								cout << people[x].weapon.name;
								color(16);
								cout << "往后一弹,把伤害打到了自己身上,造成" << att << "点伤害!" << endl;
								people[x].health -= att;
								inroom.people[peoplei[x]].health -= att;
								room[nowroomi].people[peoplei[x]].health -= att;
								if (people[x].health > people[x].maxhealth / 6 * 5) {
									cout << "(";
									color(10);
									cout << people[x].name << "看起来一点也不累,充满了活力";
									color(16);
									cout << ")" << endl;
								} else if (people[x].health > people[x].maxhealth / 6 * 4) {
									cout << "(";
									color(14);
									cout << people[x].name << "看上去受了一点小伤,但并不碍事";
									color(16);
									cout << ")" << endl;
								} else if (people[x].health > people[x].maxhealth / 6 * 3) {
									cout << "(";
									color(14);
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值