作者十分推荐
1.哈利波特世界
#include <iostream>
#include <string>
#include <windows.h>
#include <conio.h>
#include <fstream>
#include <ctime>
#include <time.h>
#include <stdio.h>
using namespace std;
int D_Of_C, OK, ane, xy, D_Of_C1, OK1, ane1, xy1, nowM, MoralValue;
int ict = 0, nowlevel = 0;
int bag[44] = { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0};
//0抽奖券 1经验石R 2经验石SR 3经验石SSR 4经验石SSS 5经验石X
//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速度药水
string Material1name[9] = { "猫狸子胡须","媚娃头发","马形水怪的鬃毛","龙心腱","雷鸟尾羽","凤凰羽毛","独角兽尾毛","龙神经","夜骐的尾羽" };
string Material2name[10] = { "桦木","紫衫木","冬青木","山楂木柳条","橡木","械木","山毛榉木","栗木","樱桃木","桃花心木" };
int health = 1000, maxhealth = 1000, money=0, attack = 250, defense = 10, experience = 0, camp, level = 1, amm = 0, f = 0, speed = 0;
string Nwand = "空手";
int LE1 = 1, LE2 = 1, Sl[13];
bool dead = false;
string wandname[100] = { "柳条魔杖","胡桃魔杖","鹅耳枥木魔杖","柳条魔杖","花心木魔杖","冬青木魔杖","紫杉木魔杖","老魔杖" };
int wandpower[100] = { 200,500,1100,1300,2400,5000,9000,20000 }, wand[100], wandi = 8, wandnamei = 8, wandpoweri = 8;
string name, password;
int choose()
{
system("cls");
cout << "请选择您的阵营。" << endl;
cout << "0, 哈利.HarryPotter" << endl;
cout << "1, 伏地魔 LordVoldemort" << endl;
cin >> camp;
if (camp != 0 && camp != 1) {
cout << "输入错误。";
Sleep(250);
choose();
}
else {
if (MessageBox(0, TEXT("你确定?"), TEXT("请选择"), MB_OKCANCEL | MB_ICONINFORMATION) == IDOK) return 0;
choose();
}
return 0;
}
int login()
{
string DN, DPW;
bool isn = false;
cout << "请输入账号和密码" << endl;
cout << "账号:";
cin >> name;
cout << "密码:";
cin >> password;
ifstream fin("data2.txt");
while(fin >> DN) {
if (DN == name) {
fin >> DPW;
if (DPW != password) {
cout << "密码错误!" << endl; isn = true;
system("cls"); login();
}
else {
fin >> money >> attack >> defense >> health >> level >> experience >> LE1 >> LE2 >> camp >> maxhealth;
fin >> D_Of_C >> OK >> ane >> xy >> D_Of_C1 >> OK1 >> ane1 >> xy1 >> nowM;
fin >> bag[0] >> bag[1] >> bag[2] >> bag[3] >> bag[4] >> bag[5] >> bag[6] >> bag[7];
fin >> bag[8] >> bag[9] >> bag[10] >> bag[11] >> bag[12] >> bag[13] >> bag[14] >> bag[15];
fin >> bag[16] >> bag[17] >> bag[18] >> bag[19] >> bag[20] >> bag[21] >> bag[22] >> bag[23];
fin >> bag[24] >> bag[25] >> bag[26] >> bag[27] >> bag[28] >> bag[29] >> bag[30] >> bag[31];
fin >> bag[32] >> bag[33] >> bag[34] >> bag[35] >> bag[36] >> bag[37] >> bag[38] >> bag[39];
fin >> bag[40] >> bag[41] >> bag[42] >> bag[43];
fin >> Sl[0] >> Sl[1] >> Sl[2] >> Sl[3] >> Sl[4] >> Sl[5] >> Sl[6] >> Sl[7] >> Sl[8] >> Sl[9] >> Sl[10] >> Sl[11] >> Sl[12];
for (int i = 0; i < 100; i++) {
fin >> wandname[i];
fin >> wandpower[i];
fin >> wand[i];
}
fin >> Nwand >> amm >> f >> wandi >> wandnamei >> wandpoweri >> ict >> speed >> nowlevel;
isn = true;
}
}
}
if (!isn) {
cout << "无此用户!" << endl;
login();
}
cout << "登入成功!" << endl;
Sleep(1000);
return 0;
}
int save()
{
ofstream outfile("data2.txt", ios::binary | ios::app | ios::in | ios::out);
outfile << name << " " << password << " " << money << " " << attack << " " << defense << " " << health << " " << level << " " << experience << " " << LE1 << " " << LE2 << " " << camp << " " << maxhealth << " ";
outfile << D_Of_C << " " << OK << " " << ane << " " << xy << " " << D_Of_C1 << " " << OK1 << " " << ane1 << " " << xy1 << " " << nowM << " ";
outfile << bag[0] << " " << bag[1] << " " << bag[2] << " " << bag[3] << " " << bag[4] << " " << bag[5] << " " << bag[6] << " " << bag[7] << " ";
outfile << bag[8] << " " << bag[9] << " " << bag[10] << " " << bag[11] << " " << bag[12] << " " << bag[13] << " " << bag[14] << " " << bag[15] << " ";
outfile << bag[16] << " " << bag[17] << " " << bag[18] << " " << bag[19] << " " << bag[20] << " " << bag[21] << " " << bag[22] << " " << bag[23] << " ";
outfile << bag[24] << " " << bag[25] << " " << bag[26] << " " << bag[27] << " " << bag[28] << " " << bag[29] << " " << bag[30] << " " << bag[31] << " ";
outfile << bag[32] << " " << bag[33] << " " << bag[34] << " " << bag[35] << " " << bag[36] << " " << bag[37] << " " << bag[38] << " " << bag[39] << " ";
outfile << bag[40] << " " << bag[41] << " " << bag[42] << " " << bag[43] << " ";
outfile << Sl[0] << " " << Sl[1] << " " << Sl[2] << " " << Sl[3] << " " << Sl[4] << " " << Sl[5] << " " << Sl[6] << " " << Sl[7] << " " << Sl[8] << " " << Sl[9] << " " << Sl[10] << " " << Sl[11] << " " << Sl[12] << " ";
for (int i = 0; i < 100; i++) {
outfile << wandname[i] << " ";
outfile << wandpower[i] << " ";
outfile << wand[i] << " ";
}
outfile << Nwand << " " << amm << " " << f << " " << wandi << " " << wandnamei << " " << wandpoweri << " " << ict << " " << speed << " " << nowlevel << endl;
outfile.close();
return 0;
}
int Reg()
{
string DN, DPW;
cout << "请输入账号和密码 " << endl;
cout << "账号:";
cin >> name;
cout << endl << "密码:";
cin >> password;
ifstream fin("data2.txt");
while(fin >> DN) {
if (DN == name) {
cout << "用户名已被使用=====请重新起名";
Reg();
}
}
choose();
return 0;
}
int monsterfight(string Hname, int hisH, int hisA, int hisD, int hisS, int hisSP)
{
int mhealth = 10000, mdefense = 1000, mattack = 10000, mspeed = 500;
int hfaint = 0;
int mfaint = 0;
dead = false;
int ha = hisA;
while (1) {
if (hfaint > 0) hfaint -= 1;
if (mfaint > 0) {
if (rand() % 3 == 0)
{
mfaint = 0;
cout << "石怪使用技能咒立停,停止了魔咒!" << endl;
}
else mfaint -= 1;
}
if (mfaint <= 0) {
if (rand() % 3) {
cout << "石怪使用技能快快复苏 生命增加200" << endl;
mhealth += 200;
}
if (rand() % 3) {
cout << "石怪使用技能铁甲护身 生命增加100 防御增加50" << endl;
mhealth += 100;
mdefense += 50;
}
if (rand() % 3) {
cout << "石怪使用技能神锋无影 攻击增加200 对方扣血200滴" << endl;
hisH -= 200;
mattack += 200;
}
Sleep(1000);
int ran = rand() % 40 - 20;
if (rand() % 10000 > hisSP) {
if (attack + ran > hisD) {
cout << "石怪发起进攻 " << Hname << "扣血" << mattack - hisD + ran << "滴 剩余" << hisH - (mattack - hisD + ran) << "滴" << endl;
hisH -= mattack - hisD + ran;
}
else cout << "石怪发起进攻 " << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
else {
if (rand() % 2) cout << "石怪一脚踹了过去,但没有踢中" << endl;
else {
cout << "石怪一脚踹了过去,但只擦着了腰" << endl;
if ((mattack / 3) + ran > hisD) {
cout << Hname << "扣血" << (mattack / 3) + ran - hisD << "滴 剩余" << hisH - ((mattack / 3) + ran - hisD) << "滴" << endl;
hisH -= (mattack / 3) + ran - hisD;
}
else cout << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
}
}
Sleep(1000);
if (hisH <= 0) {
if (hisS == 20 && rand() % 3 == 0) {
cout << "对方发动技能:恢复如初 满血复活" << endl;
hisH = ha; Sleep(1000);
}
else {
cout << "对方死亡" << endl;
return 0;
}
}
if (hfaint <= 0) {
if (hisS != 0) {
if (rand() % 3 == 0) {
if (hisS == 14) {
cout << "对方发动技能:快快复苏 生命加200" << endl;
hisH += 200;
}
if (hisS == 15) {
cout << "对方发动技能:盔甲护身 生命加50 防御增加50" << endl;
hisH += 50;
hisD += 50;
}
if (hisS == 17) {
cout << "对方发动技能神锋无影 攻击增加200 扣血200滴" << endl;
health -= 200;
hisA += 200;
}
}
Sleep(1000);
}
int ran = rand() % 40 - 20;
if (rand() % 10000 > mspeed) {
if (hisA + ran > defense) {
cout << Hname << "发起进攻 " << "石怪扣血" << hisA - defense + ran << "滴 剩余" << mhealth - (hisA - defense + ran) << "滴" << endl;
mhealth -= hisA - defense + ran;
}
else cout << Hname << "发起进攻 " << "石怪扣血0滴 剩余" << mhealth << "滴" << endl;
}
else {
if (rand() % 2) cout << Hname << "一脚踹了过来,但没有踢中" << endl;
else {
cout << "对方一脚踹了过来,但只擦着了石怪的腰" << endl;
if ((hisA / 3) + ran > hisD) {
cout << "石怪扣血" << (hisA / 3) + ran - defense << "滴 剩余" << mhealth - ((hisA / 3) + ran - defense) << "滴" << endl;
mhealth -= ((hisA / 3) + ran - defense);
}
else cout << "石怪扣血0滴 剩余" << mhealth << "滴" << endl;
}
}
Sleep(1000);
if (mhealth <= 0) {
cout << "石怪死亡" << endl;
return hisH;
}
}
}
return 0;
}
int fight1(string Hname, int hisH, int hisA, int hisD, int hisS, int hisSP)
{
int hfaint = 0, hhurt = 0, hbeat = 0;
int mfaint = 0, mhurt = 0;
dead = false;
int ha = hisA;
int his = hisA + hisD + hisH;
while (1) {
if (hfaint > 0) {
if (rand() % 3 == 0) {
cout << "对方使用技能:咒立停!停止了魔咒" << endl;
hfaint = 1;
}
hfaint -= 1;
}
if (hbeat == 1) {
if (rand() % 10 == 0) {
cout << "对方一躲,躲过了你的石头" << endl;
hbeat = 0;
}
else {
cout << "对方躲闪不急,石头正好撞在他的鼻子上 扣血50滴" << endl;
hisH -= 50;
}
}
if (mfaint > 0) {
if (Sl[6]) mfaint = 0;
else mfaint -= 1;
}
if (mhurt > 0) {
if (Sl[6]) mhurt = 0;
else mhurt -= 1;
cout << "你的心像被一把刀刺穿了一样 扣血200滴" << endl;
health -= 200;
}
if (mfaint <= 0) {
if (rand() % 3 && Sl[0]) {
cout << "你使用技能快快复苏 生命增加200" << endl;
health += 200;
}
if (rand() % 3 && Sl[1]) {
cout << "你使用技能铁甲护身 生命增加100 防御增加50" << endl;
health += 100; defense += 50;
}
if (rand() % 3 && Sl[2]) {
cout << "你使用技能昏昏倒地 " << Hname << "一回合之内不能攻击" << endl;
hfaint += 1;
}
if (rand() % 3 && Sl[3]) {
cout << "你使用技能神锋无影 攻击增加200 扣血200滴" << endl;
hisH -= 200; attack += 200;
}
if (rand() % 3 && Sl[5]) {
if (rand() % 10) {
cout << "你使用技能统统石化 " << Hname << "二回合之内不能攻击" << endl;
hfaint += 2;
}
else {
cout << "你使用技能统统石化 " << Hname << "十回合之内不能攻击" << endl;
hfaint += 10;
}
}
if (rand() % 4 == 0 && Sl[7])
{
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
hisH = monsterfight(Hname, hisH, hisA, hisD, hisS, hisSP);
if (hisH < 1) return 0;
if (Sl[0]) {
cout << "在对方和石怪的战斗中,你已经恢复了2000生命" << endl;
if (maxhealth < health + 2000) health = maxhealth;
else health += 2000;
}
}
if (rand() % 4 == 0 && Sl[8]) {
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
}
if (rand() % 3 && Sl[9]) {
cout << "你使用技能万弹齐发!变出几十块石头" << endl;
hbeat = 1;
}
if (rand() % 3 && Sl[10]) {
cout << "你使用技能钻心咒!对方将疼痛5回合" << endl;
hhurt += 5;
}
if (rand() % 3 && Sl[11]) {
cout << "魂魄出窍!你使用夺魂咒,企图让" << Hname << "自己攻击自己!" << endl;
Sleep((rand() % 1000) + 1000);
cout << Hname << "被你控制了,开始攻击自己" << endl;
Sleep(700);
int ran = rand() % 40 - 20;
if (hisA + ran > hisD) {
cout << "对方发起进攻 自己扣血" << hisH - hisD + ran << "滴 剩余" << hisH - (hisA - hisD + ran) << "滴" << endl;
hisH -= hisA - hisD + ran;
}
else cout << "对方发起进攻 自己扣血0滴 剩余" << hisH << "滴" << endl;
}
if (rand() % 2 && Sl[12]) {
cout << "你使用技能阿瓦达索命 " << Hname << "扣血" << hisH - hisH / 4 << "滴" << endl;
hisH /= 4;
}
Sleep(1000);
int ran = rand() % 40 - 20;
if (rand() % 10000 > hisSP) {
if (attack + ran > hisD) {
cout << "你发起进攻 " << Hname << "扣血" << attack - hisD + ran << "滴 剩余" << hisH - (attack - hisD + ran) << "滴" << endl;
hisH -= attack - hisD + ran;
}
else cout << "你发起进攻 " << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
else {
if (rand() % 2) cout << "你一脚踹了过去,但没有踢中" << endl;
else {
cout << "你一脚踹了过去,但只擦着了腰" << endl;
if ((attack / 3) + ran > hisD) {
cout << Hname << "扣血" << (attack / 3) + ran - hisD << "滴 剩余" << hisH - ((attack / 3) + ran - hisD) << "滴" << endl;
hisH -= (attack / 3) + ran - hisD;
}
else cout << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
}
}
Sleep(700);
if (hhurt > 0) {
hhurt -= 1;
cout << "对方因中了你的钻心咒,正捂着心大叫呢 扣血200滴" << endl;
hisH -= 200;
}
if (hisH <= 0) {
if (hisS == 20 && rand() % 3 == 0) {
cout << "对方发动技能:恢复如初 满血复活" << endl;
hisH = ha;
Sleep(1000);
}
else {
cout << "对方死亡\n获得" << (his / 30) << "经验" << endl;
experience += (his / 30);
if (ane == 3) D_Of_C++;
if (ane1 == 3) D_Of_C1++;
return 0;
}
}
if (hfaint <= 0) {
if (rand() % 3 == 0) {
if (hisS == 14) {
cout << "对方发动技能:快快复苏 生命加200" << endl;
hisH += 200;
}
if (hisS == 15) {
cout << "对方发动技能:盔甲护身 生命加50 防御增加50" << endl;
hisH += 50; hisD += 50;
}
if (hisS == 17) {
cout << "对方发动技能神锋无影 攻击增加200 扣血200滴" << endl;
health -= 200; hisA += 200;
}
Sleep(1000);
}
int ran = rand() % 40 - 20;
if (rand() % 10000 > speed) {
if (hisA + ran > defense) {
cout << Hname << "发起进攻 " << "你扣血" << hisA - defense + ran << "滴 剩余" << health - (hisA - defense + ran) << "滴" << endl;
health -= hisA - defense + ran;
}
else cout << Hname << "发起进攻 " << "你扣血0滴 剩余" << health << "滴" << endl;
}
else {
if (rand() % 2) cout << Hname << "一脚踹了过来,但没有踢中" << endl;
else {
cout << "对方一脚踹了过来,但只擦着了你的腰" << endl;
if ((hisA / 3) + ran > hisD) {
cout << "你扣血" << (hisA / 3) + ran - defense << "滴 剩余" << health - ((hisA / 3) + ran - defense) << "滴" << endl;
health -= ((hisA / 3) + ran - defense);
}
else cout << "你扣血0滴 剩余" << health << "滴" << endl;
}
}
Sleep(700);
if (health <= 0) {
if (Sl[6] && rand() % 2) {
cout << "你发动技能:恢复如初 满血复活" << endl;
health = maxhealth;
Sleep(1000);
}
else {
cout << "你死亡";
health = 20;
dead = true;
return 0;
}
}
}
}
return 0;
}
int fight2(string Hname, int hisH, int hisA, int hisD, int hisS, int hisSP)
{
int hfaint = 0, hhurt = 0, hbeat = 0;
int mfaint = 0, mhurt = 0;
dead = false;
int ha = hisA;
int his = hisA + hisD + hisH;
while (1) {
if (hfaint > 0) {
if (rand() % 3 == 0) {
cout << "对方使用技能:咒立停!停止了魔咒";
hfaint = 1;
}
hfaint -= 1;
}
if (hbeat == 1) {
if (rand() % 10 == 0) {
cout << "对方一躲,躲过了你的石头" << endl;
hbeat = 0;
}
else {
cout << "对方躲闪不急,石头正好撞在他的鼻子上 扣血50滴" << endl;
hisH -= 50;
}
}
if (mfaint > 0) {
if (Sl[6]) mfaint = 0;
else mfaint -= 1;
}
if (mhurt > 0) {
if (Sl[6]) mhurt = 0;
else mhurt -= 1;
cout << "你的心像被一把刀刺穿了一样 扣血200滴" << endl;
health -= 200;
}
if (mfaint <= 0) {
if (rand() % 3 && Sl[0]) {
cout << "你使用技能快快复苏 生命增加200" << endl;
health += 200;
}
if (rand() % 3 && Sl[1]) {
cout << "你使用技能铁甲护身 生命增加100 防御增加50" << endl;
health += 100;
defense += 50;
}
if (rand() % 3 && Sl[2]) {
cout << "你使用技能昏昏倒地 " << Hname << "一回合之内不能攻击" << endl;
hfaint += 1;
}
if (rand() % 3 && Sl[3]) {
cout << "你使用技能神锋无影 攻击增加200 扣血200滴" << endl;
hisH -= 200;
attack += 200;
}
if (rand() % 3 && Sl[5]) {
if (rand() % 10) {
cout << "你使用技能统统石化 " << Hname << "二回合之内不能攻击" << endl;
hfaint += 2;
}
else {
cout << "你使用技能统统石化 " << Hname << "十回合之内不能攻击" << endl;
hfaint += 10;
}
}
if (rand() % 4 == 0 && Sl[7]) {
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
hisH = monsterfight(Hname, hisH, hisA, hisD, hisS, hisSP);
if (hisH < 1) return 0;
if (Sl[0]) {
cout << "在对方和石怪的战斗中,你已经恢复了2000生命" << endl;
if (maxhealth < health + 2000) health = maxhealth;
else health += 2000;
}
Sleep(1000);
}
if (rand() % 4 == 0 && Sl[8]) {
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
}
if (rand() % 3 && Sl[9]) {
cout << "你使用技能万弹齐发!变出几十块石头" << endl;
hbeat = 1;
}
if (rand() % 3 && Sl[10]) {
cout << "你使用技能钻心咒!对方将疼痛5回合" << endl;
hhurt += 5;
}
if (rand() % 3 && Sl[11]) {
cout << "魂魄出窍!你使用夺魂咒,企图让" << Hname << "自己攻击自己!" << endl;
Sleep((rand() % 1000) + 1000);
cout << Hname << "被你控制了,开始攻击自己" << endl;
Sleep(700);
int ran = rand() % 40 - 20;
if (hisA + ran > hisD) {
cout << "对方发起进攻 自己扣血" << hisH - hisD + ran << "滴 剩余" << hisH - (hisA - hisD + ran) << "滴" << endl;
hisH -= hisA - hisD + ran;
}
else cout << "对方发起进攻 自己扣血0滴 剩余" << hisH << "滴" << endl;
}
if (rand() % 2 && Sl[12]) {
cout << "你使用技能阿瓦达索命 " << Hname << "扣血" << hisH - hisH / 4 << "滴" << endl;
hisH /= 4;
}
Sleep(1000);
int ran = rand() % 40 - 20;
if (rand() % 10000 > hisSP) {
if (attack + ran > hisD) {
cout << "你发起进攻 " << Hname << "扣血" << attack - hisD + ran << "滴 剩余" << hisH - (attack - hisD + ran) << "滴" << endl;
hisH -= attack - hisD + ran;
}
else cout << "你发起进攻 " << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
else {
if (rand() % 2) cout << "你一脚踹了过去,但没有踢中" << endl;
else {
cout << "你一脚踹了过去,但只擦着了腰" << endl;
if ((attack / 3) + ran > hisD) {
cout << Hname << "扣血" << (attack / 3) + ran - hisD << "滴 剩余" << hisH - ((attack / 3) + ran - hisD) << "滴" << endl;
hisH -= (attack / 3) + ran - hisD;
}
else cout << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
}
}
Sleep(700);
if (hhurt > 0) {
hhurt -= 1;
cout << "对方因中了你的钻心咒,正捂着心大叫呢 扣血200滴" << endl;
hisH -= 200;
}
if (hisH <= 0) {
if (hisS == 20 && rand() % 3 == 0) {
cout << "对方发动技能:恢复如初 满血复活" << endl;
hisH = ha;
Sleep(1000);
}
else {
cout << "对方死亡\n获得" << (his / 200) << "金币" << endl;
money += (his / 200);
if (ane == 3) D_Of_C++;
if (ane1 == 3) D_Of_C1++;
return 0;
}
}
if (hfaint <= 0) {
if (rand() % 3 == 0) {
if (hisS == 14) {
cout << "对方发动技能:快快复苏 生命加200" << endl;
hisH += 200;
}
if (hisS == 15) {
cout << "对方发动技能:盔甲护身 生命加50 防御增加50" << endl;
hisH += 50; hisD += 50;
}
if (hisS == 17) {
cout << "对方发动技能神锋无影 攻击增加200 扣血200滴" << endl;
health -= 200; hisA += 200;
}
Sleep(1000);
}
int ran = rand() % 40 - 20;
if (rand() % 10000 > speed) {
if (hisA + ran > defense) {
cout << Hname << "发起进攻 " << "你扣血" << hisA - defense + ran << "滴 剩余" << health - (hisA - defense + ran) << "滴" << endl;
health -= hisA - defense + ran;
}
else cout << Hname << "发起进攻 " << "你扣血0滴 剩余" << health << "滴" << endl;
}
else {
if (rand() % 2) cout << Hname << "一脚踹了过来,但没有踢中" << endl;
else {
cout << "对方一脚踹了过来,但只擦着了你的腰" << endl;
if ((hisA / 3) + ran > hisD) {
cout << "你扣血" << (hisA / 3) + ran - defense << "滴 剩余" << health - ((hisA / 3) + ran - defense) << "滴" << endl;
health -= ((hisA / 3) + ran - defense);
}
else cout << "你扣血0滴 剩余" << health << "滴" << endl;
}
}
Sleep(700);
if (health <= 0) {
if (Sl[6] && rand() % 2) {
cout << "你发动技能:恢复如初 满血复活" << endl;
health = maxhealth;
Sleep(1000);
}
else {
cout << "你死亡";
health = 20;
dead = true;
return 0;
}
}
}
}
return 0;
}
int fight(string Hname, int hisH, int hisA, int hisD, int hisS, int hisSP)
{
int hfaint = 0, hhurt = 0, hbeat = 0;
int mfaint = 0, mhurt = 0;
dead = false;
int ha = hisA;
int his = hisA + hisD + hisH;
while (1)
{
if (hfaint > 0) {
if (rand() % 3 == 0) {
cout << "对方使用技能:咒立停!停止了魔咒" << endl;
hfaint = 0;
}
else hfaint -= 1;
}
if (hbeat == 1) {
if (rand() % 10 == 0) {
cout << "对方一躲,躲过了你的石头" << endl;
hbeat = 0;
}
else {
cout << "对方躲闪不急,石头正好撞在他的鼻子上 扣血50滴" << endl;
hisH -= 50;
}
}
if (mfaint > 0) {
if (Sl[6]) mfaint = 0;
else mfaint -= 1;
}
if (mhurt > 0) {
if (Sl[6]) mhurt = 0;
else mhurt -= 1;
cout << "你的心像被一把刀刺穿了一样 扣血200滴" << endl;
health -= 200;
}
if (mfaint <= 0) {
if (rand() % 3 && Sl[0]) {
cout << "你使用技能快快复苏 生命增加200" << endl;
health += 200;
}
if (rand() % 3 && Sl[1]) {
cout << "你使用技能铁甲护身 生命增加100 防御增加50" << endl;
health += 100;
defense += 50;
}
if (rand() % 3 && Sl[2]) {
cout << "你使用技能昏昏倒地 " << Hname << "一回合之内不能攻击" << endl;
hfaint += 1;
}
if (rand() % 3 && Sl[3]) {
cout << "你使用技能神锋无影 攻击增加200 扣血200滴" << endl;
hisH -= 200; attack += 200;
}
if (rand() % 3 && Sl[5]) {
if (rand() % 10) {
cout << "你使用技能统统石化 " << Hname << "二回合之内不能攻击" << endl;
hfaint += 2;
}
else {
cout << "你使用技能统统石化 " << Hname << "十回合之内不能攻击" << endl;
hfaint += 10;
}
}
if (rand() % 4 == 0 && Sl[7]) {
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
hisH = monsterfight(Hname, hisH, hisA, hisD, hisS, hisSP);
if (hisH < 1) return 0;
if (Sl[0]) {
cout << "在对方和石怪的战斗中,你已经恢复了2000生命" << endl;
if (maxhealth < health + 2000) health = maxhealth;
else health += 2000;
}
}
if (rand() % 4 == 0 && Sl[8]) {
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
}
if (rand() % 3 && Sl[9]) {
cout << "你使用技能万弹齐发!变出几十块石头" << endl;
hbeat = 1;
}
if (rand() % 3 && Sl[10]) {
cout << "你使用技能钻心咒!对方将疼痛5回合" << endl;
hhurt += 5;
}
if (rand() % 3 && Sl[11]) {
cout << "魂魄出窍!你使用夺魂咒,企图让" << Hname << "自己攻击自己!" << endl;
Sleep((rand() % 1000) + 1000);
cout << Hname << "被你控制了,开始攻击自己" << endl;
Sleep(700);
int ran = rand() % 40 - 20;
if (hisA + ran > hisD) {
cout << "对方发起进攻 自己扣血" << hisH- hisD + ran << "滴 剩余" << hisH - (hisA - hisD + ran) << "滴" << endl;
hisH -= hisA - hisD + ran;
}
else cout << "对方发起进攻 自己扣血0滴 剩余" << hisH << "滴" << endl;
}
if (rand() % 2 && Sl[12]) {
cout << "你使用技能阿瓦达索命 " << Hname << "扣血" << hisH - hisH / 4 << "滴" << endl;
hisH /= 4;
}
Sleep(1000);
int ran = rand() % 40 - 20;
if (rand() % 10000 > hisSP) {
if (attack + ran > hisD) {
cout << "你发起进攻 " << Hname << "扣血" << attack - hisD + ran << "滴 剩余" << hisH - (attack - hisD + ran) << "滴" << endl;
hisH -= attack - hisD + ran;
}
else cout << "你发起进攻 " << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
else {
if (rand() % 2) cout << "你一脚踹了过去,但没有踢中" << endl;
else {
cout << "你一脚踹了过去,但只擦着了腰" << endl;
if ((attack / 3) + ran > hisD) {
cout << Hname << "扣血" << (attack / 3) + ran - hisD << "滴 剩余" << hisH - ((attack / 3) + ran - hisD) << "滴" << endl;
hisH -= (attack / 3) + ran - hisD;
}
else cout << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
}
}
Sleep(700);
if (hhurt > 0) {
hhurt -= 1;
cout << "对方因中了你的钻心咒,正捂着心大叫呢 扣血200滴" << endl;
hisH -= 200;
}
if (hisH <= 0) {
if (hisS == 20 && rand() % 3 == 0) {
cout << "对方发动技能:恢复如初 满血复活" << endl;
hisH = ha;
Sleep(1000);
}
else {
cout << "对方死亡\n获得" << his / 30 << "元" << endl;
money += his / 30;
experience += (his / 30) * 10;
if (ane == 3) D_Of_C++;
if (ane1 == 3) D_Of_C1++;
return 0;
}
}
if (hfaint <= 0) {
if (rand() % 3 == 0) {
if (hisS == 14) {
cout << "对方发动技能:快快复苏 生命加200" << endl;
hisH += 200;
}
if (hisS == 15) {
cout << "对方发动技能:盔甲护身 生命加50 防御增加50" << endl;
hisH += 50;
hisD += 50;
}
if (hisS == 17)
{
cout << "对方发动技能神锋无影 攻击增加200 扣血200滴" << endl;
health -= 200;
hisA += 200;
}
Sleep(1000);
}
int ran = rand() % 40 - 20;
if (rand() % 10000 > speed) {
if (hisA + ran > defense) {
cout << Hname << "发起进攻 " << "你扣血" << hisA - defense + ran << "滴 剩余" << health - (hisA - defense + ran) << "滴" << endl;
health -= hisA - defense + ran;
}
else cout << Hname << "发起进攻 " << "你扣血0滴 剩余" << health << "滴" << endl;
}
else {
if (rand() % 2) cout << Hname << "一脚踹了过来,但没有踢中" << endl;
else {
cout << "对方一脚踹了过来,但只擦着了你的腰" << endl;
if ((hisA / 3) + ran > hisD) {
cout <<"你扣血" << (hisA / 3) + ran - defense << "滴 剩余" << health - ((hisA / 3) + ran - defense) << "滴" << endl;
health -= ((hisA / 3) + ran - defense);
}
else cout << "你扣血0滴 剩余" << health << "滴" << endl;
}
}
Sleep(700);
if (health <= 0) {
if (Sl[6] && rand() % 2) {
cout << "你发动技能:恢复如初 满血复活" << endl;
health = maxhealth;
Sleep(1000);
}
else {
cout << "你死亡" << endl;
health = 20;
dead = true;
return 0;
}
}
}
}
return 0;
}
int street()
{
switch (rand() % 6)
{
case 0:
if (camp) {
int f;
cout << "你遇到了一个路人" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("路人", 500, 110, 0, 14, 1000);
if (!dead && rand() % 2) {
if (rand() % 4 == 0) {
cout << "获得一瓶经验药水" << endl;
bag[22] += 1;
}
else if (rand() % 4 == 1) {
cout << "获得一瓶攻击药水" << endl;
bag[21] += 1;
}
else if (rand() % 4 == 2) {
cout << "获得一瓶生命药水" << endl;
bag[19] += 1;
}
else {
cout << "获得一瓶防御药水" << endl;
bag[20] += 1;
}
}
}
}
else {
int f;
cout << "你遇到了一个小混混" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("小混混", 500, 110, 0, 15, 1000);
if (!dead && rand() % 2) {
if (rand() % 4 == 0) {
cout << "获得一瓶经验药水" << endl;
bag[22] += 1;
}
else if (rand() % 4 == 1) {
cout << "获得一瓶攻击药水" << endl;
bag[21] += 1;
}
else if (rand() % 4 == 2) {
cout << "获得一瓶生命药水" << endl;
bag[19] += 1;
}
else {
cout << "获得一瓶防御药水" << endl;
bag[20] += 1;
}
}
}
}
break;
case 1:
if (camp) {
int f;
cout << "你遇到了一个警察" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("警察", 2000, 500, 15, 15, 1000);
if (!dead && rand() % 3 != 0) {
if (rand() % 5 == 0) {
cout << "获得两瓶经验药水" << endl;
bag[22] += 2;
}
else if (rand() % 5 == 1) {
cout << "获得两瓶攻击药水" << endl;
bag[21] += 2;
}
else if (rand() % 5 == 2) {
cout << "获得两瓶生命药水" << endl;
bag[19] += 2;
}
else if (rand() % 5 == 3) {
cout << "获得一瓶全幅药水" << endl;
bag[23] += 1;
}
else {
cout << "获得两瓶防御药水" << endl;
bag[20] += 2;
}
}
}
}
else {
int f;
cout << "你遇到了一个小食死徒" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("食死徒", 2000, 500, 15, 15, 1000);
if (!dead && rand() % 3 != 0) {
if (rand() % 5 == 0) {
cout << "获得两瓶经验药水" << endl;
bag[22] += 2;
}
else if (rand() % 5 == 1) {
cout << "获得两瓶攻击药水" << endl;
bag[21] += 2;
}
else if (rand() % 5 == 2) {
cout << "获得两瓶生命药水" << endl;
bag[19] += 2;
}
else if (rand() % 5 == 3) {
cout << "获得一瓶全幅药水" << endl;
bag[23] += 1;
}
else {
cout << "获得两瓶防御药水" << endl;
bag[20] += 2;
}
}
}
}
break;
case 2:
if (camp) {
int f;
cout << "你遇到了一个凤凰社成员" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("凤凰社成员", 5000, 700, 50, 16, 1500);
if (!dead && rand() % 4 != 0) {
if (rand() % 5 == 0) {
cout << "获得三瓶经验药水" << endl;
bag[22] += 3;
}
else if (rand() % 5 == 1) {
cout << "获得三瓶攻击药水" << endl;
bag[21] += 3;
}
else if (rand() % 5 == 2) {
cout << "获得三瓶生命药水" << endl;
bag[19] += 3;
}
else if (rand() % 5 == 3) {
cout << "获得两瓶全幅药水" << endl;
bag[23] += 2;
}
else {
cout << "获得三瓶防御药水" << endl;
bag[20] += 3;
}
}
}
}
else {
int f;
cout << "你遇到了一个真食死徒" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("食死徒", 5000, 700, 50, 15, 1500);
if (!dead && rand() % 4 != 0) {
if (rand() % 5 == 0) {
cout << "获得三瓶经验药水" << endl;
bag[22] += 3;
}
else if (rand() % 5 == 1) {
cout << "获得三瓶攻击药水" << endl;
bag[21] += 3;
}
else if (rand() % 5 == 2) {
cout << "获得三瓶生命药水" << endl;
bag[19] += 3;
}
else if (rand() % 5 == 3) {
cout << "获得两瓶全幅药水" << endl;
bag[23] += 2;
}
else {
cout << "获得三瓶防御药水" << endl;
bag[20] += 3;
}
}
}
}
break;
case 3:
if (camp) {
int f;
cout << "你遇到了一个傲罗·穆迪" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("穆迪", 10000, 1200, 250, 17, 2000);
if (!dead) {
if (rand() % 3) {
if (rand() % 2) {
cout << "获得技能书神锋无影" << endl;
bag[9]++;
}
else {
cout << "获得技能书快快复苏" << endl;
bag[6]++;
}
}
if (rand() % 4) {
if (rand() % 5 == 0) {
cout << "获得四瓶经验药水" << endl;
bag[22] += 4;
}
else if (rand() % 5 == 1) {
cout << "获得四瓶攻击药水" << endl;
bag[21] += 4;
}
else if (rand() % 5 == 2) {
cout << "获得四瓶生命药水" << endl;
bag[19] += 4;
}
else if (rand() % 5 == 3) {
cout << "获得三瓶全幅药水" << endl;
bag[23] += 3;
}
else {
cout << "获得四瓶防御药水" << endl;
bag[20] += 4;
}
}
}
}
}
else {
int f;
cout << "你遇到了卢修斯·马尔福" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("马尔福", 10000, 1200, 250, 17, 2000);
if (!dead) {
if (rand() % 3) {
if (rand() % 2) {
cout << "获得技能书神锋无影" << endl;
bag[9]++;
}
else {
cout << "获得技能书快快复苏" << endl;
bag[6]++;
}
}
if (rand() % 4) {
if (rand() % 5 == 0) {
cout << "获得四瓶经验药水" << endl;
bag[22] += 4;
}
else if (rand() % 5 == 1) {
cout << "获得四瓶攻击药水" << endl;
bag[21] += 4;
}
else if (rand() % 5 == 2) {
cout << "获得四瓶生命药水" << endl;
bag[19] += 4;
}
else if (rand() % 5 == 3) {
cout << "获得三瓶全幅药水" << endl;
bag[23] += 3;
}
else {
cout << "获得四瓶防御药水" << endl;
bag[20] += 4;
}
}
}
}
}
if (!dead)
if (ane1 == 2) D_Of_C1++;
break;
case 4:
if (camp) {
int f;
cout << "你遇到了卢平" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("卢平", 100000, 12000, 2500, 17, 4000);
if (!dead) {
if (rand() % 3) {
if (rand() % 2) {
cout << "获得技能书恢复如初" << endl;
bag[12]++;
}
else {
cout << "获得技能书阿瓦达索命" << endl;
bag[18]++;
}
}
if (rand() % 5) {
if (rand() % 5 == 0) {
cout << "获得四瓶经验药水" << endl;
bag[22] += 4;
}
else if (rand() % 5 == 1) {
cout << "获得四瓶攻击药水" << endl;
bag[21] += 4;
}
else if (rand() % 5 == 2) {
cout << "获得四瓶生命药水" << endl;
bag[19] += 4;
}
else if (rand() % 5 == 3) {
cout << "获得三瓶全幅药水" << endl;
bag[23] += 3;
}
else {
cout << "获得四瓶防御药水" << endl;
bag[20] += 4;
}
}
}
}
}
else {
int f;
cout << "你遇到了食死徒·卡卡洛夫" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("卡卡洛夫", 100000, 12000, 2500, 170, 4000);
if (!dead) {
if (rand() % 3) {
if (rand() % 2) {
cout << "获得技能书恢复如初" << endl;
bag[12]++;
}
else {
cout << "获得技能书阿瓦达索命" << endl;
bag[18]++;
}
}
if (rand() % 5) {
if (rand() % 5 == 0) {
cout << "获得四瓶经验药水" << endl;
bag[22] += 4;
}
else if (rand() % 5 == 1) {
cout << "获得四瓶攻击药水" << endl;
bag[21] += 4;
}
else if (rand() % 5 == 2) {
cout << "获得四瓶生命药水" << endl;
bag[19] += 4;
}
else if (rand() % 5 == 3) {
cout << "获得三瓶全幅药水" << endl;
bag[23] += 3;
}
else {
cout << "获得四瓶防御药水" << endl;
bag[20] += 4;
}
}
}
}
}
break;
case 5:
if (camp) {
int f;
cout << "你遇到了邓布利多" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("邓布利多", 300000, 36000, 7500, 20, 5000);
if (!dead) {
if (rand() % 3) {
if (rand() % 2) {
cout << "获得技能书恢复如初" << endl;
bag[12]++;
}
else {
cout << "获得技能书阿瓦达索命" << endl;
bag[18]++;
}
}
if (rand() % 5) {
if (rand() % 5 == 0) {
cout << "获得四瓶经验药水" << endl;
bag[22] += 4;
}
else if (rand() % 5 == 1) {
cout << "获得四瓶攻击药水" << endl;
bag[21] += 4;
}
else if (rand() % 5 == 2) {
cout << "获得四瓶生命药水" << endl;
bag[19] += 4;
}
else if (rand() % 5 == 3) {
cout << "获得三瓶全幅药水" << endl;
bag[23] += 3;
}
else {
cout << "获得四瓶防御药水" << endl;
bag[20] += 4;
}
}
}
}
}
else {
int f;
cout << "你遇到了纳尼吉" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("纳尼吉", 300000, 36000, 7500, 20, 5000);
if (!dead) {
if (rand() % 3) {
if (rand() % 2) {
cout << "获得技能书恢复如初" << endl;
bag[12]++;
}
else {
cout << "获得技能书阿瓦达索命" << endl;
bag[18]++;
}
}
if (rand() % 5) {
if (rand() % 5 == 0) {
cout << "获得四瓶经验药水" << endl;
bag[22] += 4;
}
else if (rand() % 5 == 1) {
cout << "获得四瓶攻击药水" << endl;
bag[21] += 4;
}
else if (rand() % 5 == 2) {
cout << "获得四瓶生命药水" << endl;
bag[19] += 4;
}
else if (rand() % 5 == 3) {
cout << "获得三瓶全幅药水" << endl;
bag[23] += 3;
}
else {
cout << "获得四瓶防御药水" << endl;
bag[20] += 4;
}
}
}
}
}
if (!dead)
if (ane1 == 0) D_Of_C1++;
break;
}
Sleep(1000);
return 0;
}
int buy(int p, int m)
{
if (money < m) {
cout << "没钱,打出去!" << endl;
if (camp) {
cout << "1抢劫 2逃离" << endl;
int a;
cin >> a;
if (a == 1) {
fight("员工", 1000, 100, 10, 0, 1000);
if (dead) return 0;
cout << "另外一个员工冲了过来" << endl;
fight("员工", 1000, 100, 10, 14, 1000);
if (dead) return 0;
cout << "另外一个员工冲了过来" << endl;
fight("员工", 1000, 100, 10, 14, 2000);
if (dead) return 0;
cout << "员工头冲了过来" << endl;
fight("员工头", 5000, 5000, 10, 14, 2000);
if (dead) return 0;
cout << "店主冲了过来" << endl;
fight("店主", 10000, 1000, 100, 15, 4000);
if (dead) return 0;
cout << "获得100元" << endl;
money += 100;
if (rand() % 10 < 3) {
Sleep(3000);
cout << "你翻了半天,终于找到了你要卖的东西" << endl;
bag[p]++;
}
else {
Sleep(3000);
cout << "你翻了半天,还是没找到你要卖的东西" << endl;
cout << "你要不要到大街上消消气(杀人)" << endl;
cout << "1要! 2不必了" << endl;
int q;
cin >> q;
if (q == 1) street();
}
}
}
}
else {
cout << "购买成功" << endl;
bag[p]++;
money -= m;
if (ane == 1) D_Of_C++;
if (ane1 == 1) D_Of_C1 += m;
}
Sleep(1000);
return 0;
}
int buywand(int p, int m)
{
if (money < m) cout << "没钱,打出去!" << endl;
else {
cout << "购买成功" << endl;
wand[p - 6]++;
money -= m;
if (ane == 1) D_Of_C++;
if (ane1 == 1) D_Of_C1 += m;
}
Sleep(1000);
return 0;
}
int make(int w1, int w2, int c1, int c2)
{
if (w1 < 24 || w2 < 33) {
cout << "根本就没有这种材料,你眼瞎啊!" << endl;
Sleep(1000);
return 0;
}
if (c1 == 0||c2 == 0) {
cout << "你想拿0个材料来造魔杖!没门!" << endl;
Sleep(1000);
return 0;
}
if (bag[w1] < c1) {
if (bag[w2] < c2) cout << "你木材和杖芯都不够";
else cout << "杖芯不够";
}
else if (bag[w2] < c2) cout << "木材不够";
else {
cout << "制作成功" << endl;
string wn;
wn = Material1name[w1 - 24] + Material2name[w2 - 33] + "魔杖";
bag[w1] -= c1;
bag[w2] -= c2;
wand[wandi++]++;
wandpower[wandpoweri++] = c1 * 20 * (w1 - 4) + c1 * 10 * (w2 - 13);
wandname[wandnamei++] = wn;
}
Sleep(1000);
return 0;
}
int levelup()
{
if (experience >= level * 100) {
experience -= level * 100;
level++;
maxhealth += 100; health += 100; attack += 10; defense += 5; speed += 10;
if (rand() % 2 && level > 4) bag[0] += 1;
cout << "你升了1级" << endl;
levelup();
if (ane1 == 4) D_Of_C1++;
}
return 0;
}
int Hos()
{
int a;
if (health < maxhealth) {
cout << "剩余生命:(" << health << "/" << maxhealth << ")" << endl;
cout << "需要" << ((maxhealth) - health) / 16 << "元 是否恢复. 等级小于等于10免费恢复" << endl;
cout << "1,是 2,否" << endl;
cin >> a;
if (a == 1) {
if (level > 10) {
if (money >= ((maxhealth) - health) / 16) {
money -= ((maxhealth) - health) / 16;
cout << "恢复成功\n剩余:" << money << "元";
if (ane == 2) D_Of_C++;
if (ane1 == 1) D_Of_C1 += ((maxhealth) - health) / 16;
health = maxhealth;
}
else cout << "钱不足" << endl;
}
else {
health = maxhealth;
cout << "恢复成功" << endl;
if (ane == 2) D_Of_C++;
}
}
else if (a == 2) return 0;
else {
cout << "请别乱输";
Hos();
}
}
else {
cout << "生命已满";
Sleep(1000);
}
return 0;
}
int w()
{
int aaaa = 1;
while (aaaa) {
for (int i = 0; i < wandi; i++) {
if (wandname[i] == Nwand) cout << "o";
else cout << " ";
cout << i + 1 << "," << wandname[i] << " " << wand[i] << "个" << " 力量:" << wandpower[i] << endl;
}
cout << "1,装备魔杖 2,卸下现有魔杖 0,退出" << endl;
cin >> aaaa;
if (aaaa == 1) {
cout << "请输入魔杖编号" << endl;
int bbbb;
cin >> bbbb;
if (wand[bbbb - 1]) {
if (Nwand != "空手") {
cout << "已装备魔杖";
Sleep(1000);
}
else {
cout << "装备成功";
Nwand = wandname[bbbb - 1];
attack += wandpower[bbbb - 1];
}
}
else {
cout << "您还未拥有此魔杖";
}
Sleep(1000);
}
else if (aaaa == 2) {
for (int ia = 0; ia < wandi - 1; ia++) {
if (Nwand == wandname[ia]) {
cout << "成功卸下";
attack -= wandpower[ia];
break;
}
}
Nwand = "空手";
Sleep(1000);
}
else if (aaaa == 0) break;
else cout << "请别乱输";
levelup();
system("cls");
cout << "魔法人士:" << name << endl;
cout << "势力:";
if (camp) cout << "伏地魔" << endl;
else cout << "哈利波特" << endl;
cout << "生命:" << health << "/" << maxhealth << endl;
cout << "攻击:" << attack << endl;
cout << "防御:" << defense << endl;
cout << "速度:" << speed << endl;
cout << "等级:" << level << endl;
cout << "经验:" << experience << "/" << level * 100 << endl;
cout << "金币:" << money << endl;
cout << "1,魔法部(攻击即可占领) 2,大街(杀人/阻止食死徒) 3,";
if (camp) cout << "霍格沃茨(哈利波特不在) ";
else cout << "伏地魔总部(伏地魔不在) ";
cout << "4,霍格沃茨(最后战场) 5,奥利凡德魔杖商店 6,抽奖 7,经验石店 8,背包 9,工厂 10,材料店 11,任务 12,终极任务 13,副本 14,保存 ";
if (camp) cout << "15, 医疗兵(伏地魔的)";
else cout << "15, 庞弗雷女士 ";
cout << "16,改变参数(测试专用 需要密码) 17,设置 18,登出" << endl;
cout << "8" << endl;
cout << "1,查看魔杖 2,查看药水 3,查看经验石 4,学习技能" << endl;
cout << "1" << endl;
}
return 0;
}
int e()
{
int bbbb = 1;
while (bbbb) {
cout << "1,经验石R " << bag[1] << "个" << endl;
cout << "2,经验石SR " << bag[2] << "个" << endl;
cout << "3,经验石SSR " << bag[3] << "个" << endl;
cout << "4,经验石SSS " << bag[4] << "个" << endl;
cout << "5,经验石X " << bag[5] << "个" << endl;
cout << "0,退出 6,一键使用";
int aaaa;
cin >> bbbb;
switch (bbbb)
{
case 1:
cout << "几个?";
cin >> aaaa;
if (bag[1] >= aaaa) {
cout << "服用成功";
experience += aaaa * 100;
bag[1] -= aaaa;
Sleep(1000);
break;
}
break;
case 2:
cout << "几个?";
cin >> aaaa;
if (bag[2] >= aaaa) {
cout << "服用成功";
experience += aaaa * 250;
bag[2] -= aaaa;
Sleep(1000);
break;
}
break;
case 3:
cout << "几个?";
cin >> aaaa;
if (bag[3] >= aaaa) {
cout << "服用成功";
experience += aaaa * 500;
bag[3] -= aaaa;
Sleep(1000);
break;
}
break;
case 4:
cout << "几个?";
cin >> aaaa;
if (bag[4] >= aaaa) {
cout << "服用成功";
experience += aaaa * 1200;
bag[4] -= aaaa;
Sleep(1000);
break;
}
break;
case 5:
cout << "几个?";
cin >> aaaa;
if (bag[5] >= aaaa) {
cout << "服用成功";
experience += aaaa * 2500;
bag[5] -= aaaa;
Sleep(1000);
break;
}
break;
case 0:
break;
case 6:
cout << "服用成功";
experience += bag[1] * 100;
experience += bag[2] * 250;
experience += bag[3] * 500;
experience += bag[4] * 1200;
experience += bag[5] * 2500;
bag[1] = bag[2] = bag[3] = bag[4] = bag[5] = 0;
break;
default:
cout << "请别乱输";
Sleep(1000);
break;
}
levelup();
system("cls");
cout << "魔法人士:" << name << endl;
cout << "势力:";
if (camp) cout << "伏地魔" << endl;
else cout << "哈利波特" << endl;
cout << "生命:" << health << "/" << maxhealth << endl;
cout << "攻击:" << attack << endl;
cout << "防御:" << defense << endl;
cout << "速度:" << speed << endl;
cout << "等级:" << level << endl;
cout << "经验:" << experience << "/" << level * 100 << endl;
cout << "金币:" << money << endl;
cout << "1,魔法部(攻击即可占领) 2,大街(杀人/阻止食死徒) 3,";
if (camp) cout << "霍格沃茨(哈利波特不在) ";
else cout << "伏地魔总部(伏地魔不在) ";
cout << "4,霍格沃茨(最后战场) 5,奥利凡德魔杖商店 6,抽奖 7,经验石店 8,背包 9,工厂 10,材料店 11,任务 12,终极任务 13,副本 14,保存 ";
if (camp) cout << "15, 医疗兵(伏地魔的)";
else cout << "15, 庞弗雷女士 ";
cout << "16,改变参数(测试专用 需要密码) 17,设置 18,登出" << endl;
cout << "8" << endl;
cout << "1,查看魔杖 2,查看药水 3,查看经验石 4,学习技能" << endl;
cout << "3" << endl;
}
return 0;
}
int p()
{
int bbbb = 1;
while (bbbb) {
cout << "1,生命药水 " << bag[19] << "个" << endl;
cout << "2,防御药水 " << bag[20] << "个" << endl;
cout << "3,攻击药水 " << bag[21] << "个" << endl;
cout << "4,经验药水 " << bag[22] << "个" << endl;
cout << "5,速度药水 " << bag[23] << "个" << endl;
cout << "6,全幅药水 " << bag[23] << "个" << endl;
cout << "0,退出 7,一键使用";
cin >> bbbb;
int aaaa;
switch (bbbb)
{
case 1:
cout << "几个?";
cin >> aaaa;
if (bag[19] >= aaaa) {
cout << "服用成功";
health += aaaa * 50;
maxhealth += aaaa * 50;
bag[19] -= aaaa;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 2:
cout << "几个?";
cin >> aaaa;
if (bag[20] >= aaaa) {
cout << "服用成功";
defense += aaaa * 10;
bag[20] -= aaaa;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 3:
cout << "几个?";
cin >> aaaa;
if (bag[21] >= aaaa) {
cout << "服用成功";
attack += aaaa * 25;
bag[21] -= aaaa;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 4:
cout << "几个?";
cin >> aaaa;
if (bag[22] >= aaaa) {
cout << "服用成功";
experience += aaaa * 200;
bag[22] -= aaaa;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 5:
cout << "几个?";
cin >> aaaa;
if (bag[43] >= aaaa) {
cout << "服用成功";
speed += aaaa;
bag[43] -= aaaa;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 6:
cout << "几个?";
cin >> aaaa;
if (bag[23] >= aaaa) {
cout << "服用成功";
health += aaaa * 50;
maxhealth += aaaa * 50;
defense += aaaa * 10;
attack += aaaa * 25;
experience += aaaa * 200;
speed += aaaa;
bag[23] -= aaaa;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 7:
cout << "服用成功";
health += bag[19] * 50;
maxhealth += bag[19] * 50;
defense += bag[20] * 10;
attack += bag[21] * 25;
experience += bag[22] * 200;
speed += bag[43];
health += bag[23] * 50;
maxhealth += bag[23] * 50;
defense += bag[23] * 10;
attack += bag[23] * 25;
experience += bag[23] * 200;
speed += bag[23];
bag[19] = 0;
bag[20] = 0;
bag[21] = 0;
bag[22] = 0;
bag[23] = 0;
bag[43] = 0;
break;
case 0:
break;
default:
cout << "请别乱输";
Sleep(1000);
break;
}
levelup();
system("cls");
cout << "魔法人士:" << name << endl;
cout << "势力:";
if (camp) cout << "伏地魔" << endl;
else cout << "哈利波特" << endl;
cout << "生命:" << health << "/" << maxhealth << endl;
cout << "攻击:" << attack << endl;
cout << "防御:" << defense << endl;
cout << "速度:" << speed << endl;
cout << "等级:" << level << endl;
cout << "经验:" << experience << "/" << level * 100 << endl;
cout << "金币:" << money << endl;
cout << "1,魔法部(攻击即可占领) 2,大街(杀人/阻止食死徒) 3,";
if (camp) cout << "霍格沃茨(哈利波特不在) ";
else cout << "伏地魔总部(伏地魔不在) ";
cout << "4,霍格沃茨(最后战场) 5,奥利凡德魔杖商店 6,抽奖 7,经验石店 8,背包 9,工厂 10,材料店 11,任务 12,终极任务 13,副本 14,保存 ";
if (camp) cout << "15, 医疗兵(伏地魔的)";
else cout << "15, 庞弗雷女士 ";
cout << "16,改变参数(测试专用 需要密码) 17,设置 18,登出" << endl;
cout << "8" << endl;
cout << "1,查看魔杖 2,查看药水 3,查看经验石 4,学习技能" << endl;
cout << "2" << endl;
}
return 0;
}
int s()
{
int bbbb = 1;
while (bbbb) {
cout << "1,快快复苏 " << bag[6] << "个" << endl;
cout << "2,盔甲护身 " << bag[7] << "个" << endl;
cout << "3,昏昏倒地 " << bag[8] << "个" << endl;
cout << "4,神锋无影 " << bag[9] << "个" << endl;
cout << "5,咒立停 " << bag[10] << "个" << endl;
cout << "6,统统石化 " << bag[11] << "个" << endl;
cout << "7,恢复如初 " << bag[12] << "个" << endl;
cout << "8,召唤咒 " << bag[13] << "个" << endl;
cout << "9,一忘皆空 " << bag[14] << "个" << endl;
cout << "10,万箭齐发 " << bag[15] << "个" << endl;
cout << "11,钻心剜骨 " << bag[16] << "个" << endl;
cout << "12,魂魄出窍 " << bag[17] << "个" << endl;
cout << "13,阿瓦达索命 " << bag[18] << "个" << endl;
cout << "0,退出";
cin >> bbbb;
switch (bbbb)
{
case 1:
if (bag[6] >= 1) {
cout << "学习成功" << endl;
cout << "能够恢复200滴血" << endl;
bag[6] -= 1;
Sl[0] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 2:
if (bag[7] >= 1) {
cout << "学习成功" << endl;
cout << "能恢复100滴血并加50防御" << endl;
bag[7] -= 1;
Sl[1] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 3:
if (bag[8] >= 1) {
cout << "学习成功" << endl;
cout << "能使对方暂停一回合" << endl;
bag[8] -= 1;
Sl[2] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 4:
if (bag[9] >= 1) {
cout << "学习成功" << endl;
cout << "攻击加250并扣对方500滴血" << endl;
bag[9] -= 1;
Sl[3] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 5:
if (bag[10] >= 1) {
cout << "学习成功" << endl;
cout << "能使对方对你施加的状态没用" << endl;
bag[10] -= 1;
Sl[4] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 6:
if (bag[11] >= 1) {
cout << "学习成功" << endl;
cout << "%10概率能事对方冻结10回合" << endl;
cout << "%90概率能事对方冻结2回合" << endl;
bag[11] -= 1;
Sl[5] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 7:
if (bag[12] >= 1) {
cout << "学习成功" << endl;
cout << "%50概率能起死回生" << endl;
bag[12] -= 1;
Sl[6] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 8:
if (bag[13] >= 1) {
cout << "学习成功" << endl;
cout << "能召唤生物进攻" << endl;
bag[13] -= 1;
Sl[7] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 9:
if (bag[14] >= 1) {
cout << "学习成功" << endl;
cout << "%90能使对方无技能" << endl;
cout << "%10能使对方防御变为0" << endl;
bag[14] -= 1;
Sl[8] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 10:
if (bag[15] >= 1) {
cout << "学习成功" << endl;
cout << "对方一直减10滴血直到对方躲过(%10躲过)" << endl;
bag[15] -= 1;
Sl[9] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 11:
if (bag[16] >= 1) {
cout << "学习成功" << endl;
cout << "对方扣血5回合,每回合扣200滴" << endl;
bag[16] -= 1;
Sl[10] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 12:
if (bag[17] >= 1) {
cout << "学习成功" << endl;
cout << "让对方自己攻击自己(当然不攻击你)" << endl;
bag[17] -= 1;
Sl[11] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 13:
if (bag[18] >= 1) {
cout << "学习成功" << endl;
cout << "让对方直接扣3/4的血" << endl;
bag[18] -= 1;
Sl[12] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 0:
break;
default:
cout << "请别乱输";
Sleep(1000);
break;
}
system("cls");
cout << "魔法人士:" << name << endl;
cout << "势力:";
if (camp) cout << "伏地魔" << endl;
else cout << "哈利波特" << endl;
cout << "生命:" << health << "/" << maxhealth << endl;
cout << "攻击:" << attack << endl;
cout << "防御:" << defense << endl;
cout << "速度:" << speed << endl;
cout << "等级:" << level << endl;
cout << "经验:" << experience << "/" << level * 100 << endl;
cout << "金币:" << money << endl;
cout << "1,魔法部(攻击即可占领) 2,大街(杀人/阻止食死徒) 3,";
if (camp) cout << "霍格沃茨(哈利波特不在) ";
else cout << "伏地魔总部(伏地魔不在) ";
cout << "4,霍格沃茨(最后战场) 5,奥利凡德魔杖商店 6,抽奖 7,经验石店 8,背包 9,工厂 10,材料店 11,任务 12,终极任务 13,副本 14,保存 ";
if (camp) cout << "15, 医疗兵(伏地魔的)";
else cout << "15, 庞弗雷女士 ";
cout << "16,改变参数(测试专用 需要密码) 17,设置 18,登出" << endl;
cout << "8" << endl;
cout << "1,查看魔杖 2,查看药水 3,查看经验石 4,学习技能" << endl;
cout << "4" << endl;
}
return 0;
}
int LD()
{
cout << "剩余抽奖券:" << bag[0] << "张" << endl;
cout << "1,抽奖 2,退出" << endl;
int a;
cin >> a;
if (a == 1) {
cout << "抽几次?";
int num;
cin >> num;
if (bag[0] >= num) {
bag[0] -= num;
int num1 = 0, num2 = 0, num3 = 0, num4 = 0, num5 = 0;
int num6 = 0, num7 = 0, num8 = 0, num9 = 0, num10 = 0;
int num11 = 0;
for (int i = 0; i < num; i++)
{
switch (rand() % 20)
{
case 0:
case 1:
num1++;
bag[1]++;
break;
case 2:
case 3:
num2++;
bag[2]++;
break;
case 4:
case 5:
num3++;
bag[3]++;
break;
case 6:
case 7:
num4++;
bag[4]++;
break;
case 8:
num5++;
bag[5]++;
break;
case 9:
case 10:
num6++;
bag[19]++;
break;
case 11:
case 12:
num7++;
bag[20]++;
break;
case 13:
case 14:
num8++;
bag[21]++;
break;
case 15:
case 16:
num9++;
bag[22]++;
break;
case 17:
num10++;
bag[23]++;
break;
case 18:
num11 += 50;
money += 50;
break;
case 19:
num11 += 100;
money += 100;
break;
}
}
cout << "你获得了经验石R " << num1 << "个" << endl;
cout << "经验石SR " << num2 << "个" << endl;
cout << "经验石SSR " << num3 << "个" << endl;
cout << "经验石SSS " << num4 << "个" << endl;
cout << "经验石X " << num5 << "个" << endl;
cout << "生命药水 " << num6 << "个" << endl;
cout << "防御药水 " << num7 << "个" << endl;
cout << "攻击药水 " << num8 << "个" << endl;
cout << "经验药水 " << num9 << "个" << endl;
cout << "全幅药水 " << num10 << "个" << endl;
cout << "金币 " << num11 << "个" << endl;
}
else cout << "您的抽奖券不足" << endl;
}
else if (a == 2) return 0;
else {
cout << "请别乱输。";
system("cls");
LD();
}
_getch();
return 0;
}
int dig()
{
cout << "进入挖矿状态";
Sleep(1000);
system("cls");
int x = 0;
while (1) {
system("cls");
cout << "挖";Sleep(200);
cout << "矿";Sleep(200);
cout << "中";Sleep(200);
cout << ".";Sleep(100);
cout << ".";Sleep(100);
cout << "." << endl;
x++;Sleep(500);
int ad = rand() % 3;
if (ad == 2) {
ad = rand() % 100;
if (ad < 6) {
switch (rand() % 3)
{
case 0:
cout << "你挖到了技能书铁甲咒!!!" << endl;
bag[7]++;
break;
case 1:
cout << "你挖到了技能书咒立停!!!" << endl;
bag[10]++;
break;
case 2:
cout << "你挖到了技能书石化咒!!!" << endl;
bag[11]++;
break;
}
Sleep(500);
}
else if (ad >= 6 && ad < 20) {
switch (rand() % 20)
{
case 0:
cout << "你挖到了夜琪的尾羽!!!" << endl;
bag[32]++;
break;
case 1:
case 2:
cout << "你挖到了独角兽尾毛!" << endl;
bag[30]++;
break;
case 3:
case 4:
cout << "你挖到了龙神经!" << endl;
bag[31]++;
break;
case 5:
case 6:
cout << "你挖到了凤凰羽毛!" << endl;
bag[29]++;
break;
case 7:
case 8:
cout << "你挖到了龙心腱" << endl;
bag[27]++;
break;
case 9:
case 10:
cout << "你挖到了雷鸟尾羽" << endl;
bag[28]++;
break;
case 11:
case 12:
case 13:
cout << "你挖到了马形水怪的鬃毛" << endl;
bag[26]++;
break;
case 14:
case 15:
case 16:
cout << "你挖到了猫狸子胡须" << endl;
bag[24]++;
break;
case 17:
case 18:
case 19:
cout << "你挖到了媚娃头发" << endl;
bag[25]++;
break;
}
Sleep(500);
}
else if (ad >= 20 && ad < 50) {
switch (rand() % 10)
{
case 0:
cout << "你挖到了桦木" << endl;
bag[33]++;
break;
case 1:
cout << "你挖到了紫衫木" << endl;
bag[34]++;
break;
case 2:
cout << "你挖到了冬青木" << endl;
bag[35]++;
break;
case 3:
cout << "你挖到了山楂木柳条" << endl;
bag[36]++;
break;
case 4:
cout << "你挖到了橡木" << endl;
bag[37]++;
break;
case 5:
cout << "你挖到了械木" << endl;
bag[38]++;
break;
case 6:
cout << "你挖到了山毛榉木" << endl;
bag[39]++;
break;
case 7:
cout << "你挖到了栗木" << endl;
bag[40]++;
break;
case 8:
cout << "你挖到了樱桃木" << endl;
bag[41]++;
break;
case 9:
cout << "你挖到了桃花心木" << endl;
bag[42]++;
break;
}
Sleep(500);
}
else if (ad >= 50 && ad <= 100) {
int as = rand() % 20 + 30;
cout << "你挖到了" << as << "金币" << endl;
money += as;
Sleep(500);
}
}
else if (ad == 1) {
ad = rand() % 3;
if (ad == 0) {
cout << "你遇到了大老鼠" << endl;
fight("大老鼠", 5000, 500, 50, 20, 1000);
if (dead)
{
cout << "你死了" << endl;
return 0;
}
}
if (ad == 1) {
cout<<"你遇到了食死徒" << endl;
fight("食死徒", 10000, 1000, 100, 17, 1000);
if (dead)
{
cout << "你死了" << endl;
return 0;
}
}
if (ad == 2) {
cout << "你遇到了坏矿工" << endl;
fight("矿工", 5000, 2000, 200, 17, 1000);
if (dead)
{
cout << "你死了" << endl;
return 0;
}
}
cout << "是否继续挖矿?" << endl;
cout << "1,是 2,否" << endl;
int ans;
cin >> ans;
if (ans == 2) return 0;
}
}
return 0;
}
int clearance()
{
system("cls");
cout << "你在出口处发现了一张纸条,上面写着:";
if (camp) {
cout << "伏地魔,我知道你在找我...我就告诉你吧,我在霍格沃茨等你!" << endl;
cout << " ————哈利·波特" << endl;
}
else {
cout << "哈利·波特, 你看到这张纸条的时候, 你们的校已经掌握在我手中, 要么你前来送死,要么我就会把你的同们统统杀死!!!"<<endl;
cout << " ——伏地魔" << endl;
}
_getch();
f = 1;
return 0;
}
int maze()
{
bool is[101][101];
for (int i = 0; i < 100; i++)
for (int j = 0; j < 100; j++)
is[i][j] = false;
int x = 8, y = 1;
string a[100] = {
"##################################################",
"# 1 # 2 2 3# # 1 #89#1#1# 1 1 #12 #3 #1#",
"#2#1#5 # #1# # ## # ##91 6 #9#7#11## # # 11#",
"# ## ## # # # #### # ##### # ####5## # # #####",
"#2########### # 4 # ## #####4 5##1# #189o",
"# 1 1# #2# ## # ## 5# ######### # #7#8#",
"#1# #1 2# # # #9 # ### # ##2## # ## 5#167#",
"# 1## ## # # ### #4## ## 6 # 3 ### #####5##",
"I 2 #### #### # 1 6 #1# ## 5###6## # #11134##",
"I 1 # 7 # # # # 227# # # # #2 #2#21#5#",
"##1 #1 #1# ## 5 # # #3#### # 1#5# # 1 111#6 #",
"# 2##3##1# ### ## ### # ## #### # #1####### #",
"# ##3 ##1###7# ##### ## # ###3 4## 9 # #",
"#23 # 3 # ##9 ##6 6## ### 9## ##1 # #3 #",
"# # # # # ## # ## ##7 ## # 9 ###9#11##2## ##",
"### # ####### # 2 # #3 # # # 1## 1 1## ##1 #3 #",
"#5 #2 ## # #### # #5# # ### #8###1 #1# #1# #",
"# # # # # # 4 5 # # # 7 # # # #### 8 #9#",
"# 2 # #42 # ## # 11#2#3 9 # ##9 # #999#",
"##################################################",
};
while (1) {
is[x - 1][y - 1] = true;
is[x - 1][y] = true;
is[x - 1][y + 1] = true;
is[x][y - 1] = true;
is[x][y] = true;
is[x][y + 1] = true;
is[x + 1][y - 1] = true;
is[x + 1][y] = true;
is[x + 1][y + 1] = true;
system("cls");
cout << "生命:" << health << "/" << maxhealth << endl;
for (int i = 0; i < 20; i++) {
for (int j = 0; j < 50; j++) {
if (is[i][j]) cout << a[i][j];
else cout << "0";
}
cout << endl;
}
int ch;
ch = _getch();
if (ch == 'a') {
if (a[x][y - 1] == ' ')
{
a[x][y - 1] = '@';
a[x][y] = ' ';
y -= 1;
}
else if ('0' <= a[x][y - 1] && a[x][y - 1] <= '9')
{
cout << "你遇到了" << (int)(a[x][y - 1] - '0') << "级怪物,迎战吧!";
fight("怪物", 10000 * (a[x][y - 1] - '0'), 2500 * (a[x][y - 1] - '0'), 100 * (a[x][y - 1] - '0'), 20, 500 * (a[x][y - 1] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x][y - 1] = '@';
a[x][y] = ' ';
y -= 1;
a[x][y] = ' ';
}
else if (a[x][y - 1] == 'I')
{
cout << "你是否要退出这个奇怪的世界,如果退出,你现在闯下的江湖都会重置" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x][y - 1] == 'o')
{
cout << "你通关了" << endl;
_getch();
clearance();
}
}
if (ch == 'd') {
if (a[x][y + 1] == ' ')
{
a[x][y + 1] = '@';
a[x][y] = ' ';
y += 1;
}
else if ('0' <= a[x][y + 1] && a[x][y + 1] <= '9')
{
cout << "你遇到了" << (int)(a[x][y + 1] - '0') << "级怪物,迎战吧!";
fight("怪物", 10000 * (a[x][y + 1] - '0'), 2500 * (a[x][y + 1] - '0'), 100 * (a[x][y + 1] - '0'), 20, 500 * (a[x][y + 1] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x][y + 1] = '@';
a[x][y] = ' ';
y += 1;
a[x][y] = ' ';
}
else if (a[x][y + 1] == 'I')
{
cout << "你是否要退出这个奇怪的世界,如果退出,你现在闯下的江湖都会重置" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x][y + 1] == 'o')
{
cout << "你通关了" << endl;
_getch();
clearance();
}
}
if (ch == 'w') {
if (a[x - 1][y] == ' ')
{
a[x - 1][y] = '@';
a[x][y] = ' ';
x -= 1;
}
else if ('0' <= a[x - 1][y] && a[x - 1][y] <= '9')
{
cout << "你遇到了" << (int)(a[x - 1][y] - '0') << "级怪物,迎战吧!";
fight("怪物", 10000 * (a[x - 1][y] - '0'), 2500 * (a[x - 1][y] - '0'), 100 * (a[x - 1][y] - '0'), 20, 500 * (a[x - 1][y] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x - 1][y] = '@';
a[x][y] = ' ';
x -= 1;
a[x][y] = ' ';
}
else if (a[x - 1][y] == 'I')
{
cout << "你是否要退出这个奇怪的世界,如果退出,你现在闯下的江湖都会重置" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x - 1][y] == 'o')
{
cout << "你通关了" << endl;
_getch();
clearance();
}
}
if (ch == 's') {
if (a[x + 1][y] == ' ')
{
a[x + 1][y] = '@';
a[x][y] = ' ';
x += 1;
}
else if ('0' <= a[x + 1][y] && a[x + 1][y] <= '9')
{
cout << "你遇到了" << (int)(a[x + 1][y] - '0') << "级怪物,迎战吧!";
fight("怪物", 10000 * (a[x + 1][y] - '0'), 2500 * (a[x + 1][y] - '0'), 100 * (a[x + 1][y] - '0'), 20, 500 * (a[x + 1][y] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x + 1][y] = '@';
a[x][y] = ' ';
x += 1;
a[x][y] = ' ';
}
else if (a[x + 1][y] == 'I')
{
cout << "你是否要退出这个奇怪的世界,如果退出,你现在闯下的江湖都会重置" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x + 1][y] == 'o')
{
cout << "你通关了" << endl;
_getch();
clearance();
}
}
}
return 0;
}
int DriveOut()
{
switch (rand() % 3)
{
case 1:
cout << "店主:没钱还敢卖!!!打出去!!!" << endl;
break;
case 2:
cout << "店主:什么!没钱!!!" << endl;
break;
case 3:
cout << "你:可不可以降一降价?" << endl;
cout << "店主:不行!哪有那么简单!" << endl;
break;
}
Sleep(1000);
return 0;
}
int poisonshop()
{
system("cls");
cout << "店主:这位客人,您要卖什么?" << endl;
cout << "1,购买 |小生命药水+200| 100元" << endl;
cout << "2,购买 ||大生命药水+500|| 200元" << endl;
cout << "3,购买 |小防御药水 +20| 100元" << endl;
cout << "4,购买 ||大防御药水 +50|| 200元" << endl;
cout << "5,购买 |小攻击药水+100| 100元" << endl;
cout << "6,购买 ||大攻击药水+250|| 200元" << endl;
cout << "7,购买 |小全幅药水| 500元" << endl;
cout << "8,购买 ||中全幅药水|| 1000元" << endl;
cout << "9,购买 |||大全幅药水||| 2000元" << endl;
cout << "10,购买 *|||||极·全幅药水|||||* 10000元" << endl;
cout << "你掏了掏自己的钱包,发现有" << money << "元" << endl;
int which;
cin >> which;
switch (which)
{
case 1:
if (money < 100) DriveOut();
else {
money -= 100;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
health += 200;
maxhealth += 200;
}
break;
case 2:
if (money < 200) DriveOut();
else {
money -= 200;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
health += 500;
maxhealth += 500;
}
break;
case 3:
if (money < 100) DriveOut();
else {
money -= 100;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
defense += 20;
}
break;
case 4:
if (money < 200) DriveOut();
else {
money -= 200;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
defense += 50;
}
break;
case 5:
if (money < 100) DriveOut();
else {
money -= 100;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
attack += 100;
}
break;
case 6:
if (money < 200) DriveOut();
else {
money -= 200;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
attack += 250;
}
break;
case 7:
if (money < 500) DriveOut();
else {
money -= 500;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
health += 50;
defense += 5;
attack += 25;
experience += 1000;
}
break;
case 8:
if (money < 1000) DriveOut();
else {
money -= 1000;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
health += 150;
defense += 15;
attack += 75;
experience += 3000;
}
break;
case 9:
if (money < 2000) DriveOut();
else {
money -= 2000;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
health += 450;
defense += 45;
attack += 225;
experience += 9000;
}
break;
case 10:
if (money < 10000) DriveOut();
else {
money -= 10000;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
health += 2500;
defense += 250;
attack += 1250;
experience += 50000;
}
break;
default:
break;
}
Sleep(1000);
return 0;
}
int bookshop()
{
system("cls");
cout << "店主:这里是巫师们卖书的地方,您要卖什么?" << endl;
cout << "1,购买 ||||恢复如初技能书|||| 40000元 现货大量供应" << endl;
cout << "2,购买 ||遗忘咒技能书|| 10000元 已经售完" << endl;
cout << "3,购买 |||钻心咒技能书||| 15000元 现货大量供应" << endl;
cout << "4,购买 |||召唤咒技能书||| 20000元 现货大量供应" << endl;
cout << "5,购买 *|||||咒立停技能书|||||* 25000元 现货大量供应" << endl;
cout << "6,购买 ||||夺魂咒技能书|||| 20000元 现货大量供应" << endl;
cout << "7,购买 ||万弹齐发技能书|| 15000元 现货大量供应" << endl;
cout << "你掏了掏自己的钱包,发现有" << money << "元" << endl;
int which;
cin >> which;
switch (which)
{
case 1:
if (money < 40000) DriveOut();
else {
money -= 40000;
cout << "店主:一路走好!" << endl;
bag[12]++;
}
break;
case 2:
cout << "店主:对不起,本书已经售完" << endl;
break;
case 3:
if (money < 20000) DriveOut();
else {
money -= 20000;
cout << "店主:一路走好!" << endl;
bag[16]++;
}
break;
case 4:
if (money < 20000) DriveOut();
else {
money -= 20000;
cout << "店主:一路走好!" << endl;
bag[13]++;
}
break;
case 5:
if (money < 25000) DriveOut();
else {
money -= 25000;
cout << "店主:一路走好!" << endl;
bag[10]++;
}
break;
case 6:
if (money < 20000) DriveOut();
else {
money -= 20000;
cout << "店主:一路走好!" << endl;
bag[17]++;
}
break;
case 7:
if (money < 15000) DriveOut();
else {
money -= 15000;
cout << "店主:一路走好!" << endl;
bag[15]++;
}
break;
default:
break;
}
return 0;
}
int NoticeBoard(int l, int x, int y)
{
if (l == 10 && x == 6 && y == 1) {
system("cls");
cout << "跟着'*'走" << endl;
cout << " ——作者" << endl;
_getch();
}
if (l == 10 && x == 8 && y == 12) {
system("cls");
cout << "走吧,谁叫你不听命令呢..." << endl;
cout << " ——作者" << endl;
_getch();
}
if (l == 12 && x == 3 && y == 1) {
system("cls");
cout << "杀出重围!" << endl;
cout << " ——作者" << endl;
_getch();
}
if (l == 12 && x < 4 && y == 20) {
system("cls");
cout << "恭喜通过一半!往下走继续..." << endl;
cout << " ——作者" << endl;
_getch();
}
if (l == 12 && x > 4 && y == 20) {
system("cls");
cout << "恭喜通过一半!往上走继续..." << endl;
cout << " ——作者" << endl;
_getch();
}
if (l == 12 && x == 10) {
system("cls");
cout << "拿走全部奖励吧!" << endl;
cout << " ——作者" << endl;
_getch();
}
else {
system("cls");
cout << "回去吧,你来错地方了..." << endl;
_getch();
}
return 0;
}
int checkpoint(int l)
{
bool is[101][101];
for (int i = 0; i < 100; i++)
for (int j = 0; j < 100; j++)
is[i][j] = false;
int x = 1, y = 1;
string a[100];
if (l == 1) {
a[0] = "######";
a[1] = "I o";
a[2] = "######";
}
else if (l == 2) {
a[0] = "#######";
a[1] = "I 1#";
a[2] = "#### ##";
a[3] = "##1 ##";
a[4] = "#### ##";
a[5] = "#P o";
a[6] = "#######";
}
else if (l == 3) {
a[0] = "#########";
a[1] = "I # 1#S#";
a[2] = "# ## ##1#";
a[3] = "# 2 #";
a[4] = "#### ## #";
a[5] = "#P1 #o #";
a[6] = "#########";
}
else if (l == 4) {
a[0] = "#######o#######";
a[1] = "I #P3 #";
a[2] = "# ##### #";
a[3] = "# 1P #";
a[4] = "# ##### #";
a[5] = "#S # 2#";
a[6] = "######### #####";
a[7] = "#P121 2 1 11P#";
a[8] = "###############";
}
else if (l == 5) {
a[0] = "###############";
a[1] = "I 3 #P3 #";
a[2] = "# 3 # ##### #";
a[3] = "# 2 # 1 #";
a[4] = "# 2 # # ##### #";
a[5] = "# 1 # #P# 2#";
a[6] = "#####2S## ###o#";
a[7] = "#P1 1 # 1 1P#";
a[8] = "###############";
}
else if (l == 6) {
a[0] = "###############";
a[1] = "# 11 2 6PP#";
a[2] = "#2# #P#########";
a[3] = "#2##### #S# o";
a[4] = "I #2# ###";
a[5] = "# ##### 11 ###";
a[6] = "# #P##### #####";
a[7] = "#1112 4P#";
a[8] = "###############";
x = 4;
}
else if (l == 7) {
a[0] = "###############";
a[1] = "#3 4# P# # B#";
a[2] = "#1# #9## 1# 3#";
a[3] = "#1#6# 9# # ###";
a[4] = "I #7 94 # # o";
a[5] = "# #1 3 ## P# #";
a[6] = "# ########### #";
a[7] = "# 1 P #";
a[8] = "###############";
x = 4;
}
else if (l == 8) {
a[0] = "#################";
a[1] = "#PPPPPPPPPPPPPPP#";
a[2] = "#P#############P#";
a[3] = "#PPPP 9999999 PP#";
if (rand() % 100 < 7) a[4] = "#################";
else a[4] = "######### #######";
a[5] = "#2 2#2 2#9##2 P#";
a[6] = "# # # # # #22# #";
a[7] = "# # # # # # #22##";
a[8] = "I # # # # # # # o";
a[9] = "##22# # # # # # #";
a[10] = "# #22# #3# # # #";
a[11] = "#P 2##2 5 2#2 2#";
a[12] = "#################";
x = 8;
}
else if (l == 9) {
a[0] = "#################";
a[1] = "I 9###9 I";
a[2] = "# # # #";
a[3] = "# ##P9P## #";
a[4] = "# 9# 9o9 #9 #";
a[5] = "# ##P9P## #";
a[6] = "# # # #";
a[7] = "I 9###9 I";
a[8] = "#################";
if (rand() % 2) x = 7;
if (rand() % 2) y = 15;
}
else if (l == 10) {
a[0] = "#############################";
a[1] = "#00*****009***P0000000000000#";
a[2] = "#0*9000*00*000*0**P000000000#";
a[3] = "#0*000**00*0#0*0900*****00**o";
a[4] = "#0*00**00*90#0******000****0#";
a[5] = "#0*00*00**00#0000000***00000#";
a[6] = "#T*00*90*00##################";
a[7] = "I**000***00#================I";
a[8] = "############T################";
x = 7;
y = 1;
}
else if (l == 11) {
a[0] = "#############################";
a[1] = "# 33344555#P #";
a[2] = "#22222P 33344566#P ##";
a[3] = "#11 2 33344567#7 8 8 8 8 9######################";
a[4] = "I 1 2 33344567 999999999999999 PPPPo#";
a[5] = "#11 2 33344567#7 8 8 8 8 9######################";
a[6] = "#22222P 33344566#P ##";
a[7] = "# 33344555#P #";
a[8] = "#############################";
x = 4;
y = 1;
}
else if (l == 12) {
a[0] = "###################################################";
a[1] = "#999999999999999999.T.999999999P999999999999999999#";
a[2] = "#9999999999.99.99.99T.999999999P999999999999999999#";
a[3] = "#T9...99.99999999999T.999999999P9999999999999999..#";
a[4] = "I...9.9.9999.999.99...999999999P9999999999999999.X#";
a[5] = "#T9...99999999.99999T.999999999P9999999999999999..#";
a[6] = "#9999999.99.999.99.9T.999999999P999999999999999999#";
a[7] = "#99999.9999999999999T.999999999P999999999999999999#";
a[8] = "###################################################";
a[9] = "#oPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP #";
a[10] = "#################################################T#";
x = 4;
y = 1;
}
else {
a[0] = "#############################";
a[1] = "#T T#";
a[2] = "# #";
a[3] = "# #";
a[4] = "# #";
a[5] = "# #";
a[6] = "# #";
a[7] = "I T#";
a[8] = "#############################";
x = 7;
y = 1;
for (int i = 0; i < 100; i++)
for (int j = 0; j < 100; j++) is[i][j] = true;
}
a[x][y] = '@';
while (1) {
is[x - 1][y - 1] = true;
is[x - 1][y] = true;
is[x - 1][y + 1] = true;
is[x][y - 1] = true;
is[x][y] = true;
is[x][y + 1] = true;
is[x + 1][y - 1] = true;
is[x + 1][y] = true;
is[x + 1][y + 1] = true;
system("cls");
cout << "生命:" << health << "/" << maxhealth << endl;
cout << "攻击:" << attack << endl;
cout << "防御:" << defense << endl;
for (int i = 0; i < 25; i++) {
for (int j = 0; j < 50; j++) {
if (is[i][j]) cout << a[i][j];
else cout << "0";
}
cout << endl;
}
int ch;
ch = _getch();
if (ch == 'a') {
if ('0' < a[x][y - 1] && a[x][y - 1] <= '9')
{
cout << "你遇到了" << (int)(a[x][y - 1] - '0') << "级怪物,迎战吧!";
fight("怪物", 1000 * (a[x][y - 1] - '0'), 250 * (a[x][y - 1] - '0'), 10 * (a[x][y - 1] - '0'), 12, 50 * (a[x][y - 1] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x][y - 1] = '@';
a[x][y] = ' ';
y--;
a[x][y] = ' ';
}
else if (a[x][y - 1] == 'I')
{
cout << "你是否要退出?" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x][y - 1] == 'o')
{
cout << "你通关了" << endl;
if (nowlevel + 1 == l)
{
nowlevel++;
}
_getch();
return 0;
}
else if (a[x][y - 1] == 'P')
{
int m1 = rand() % 50;
int m2 = rand() % 2;
int m3 = rand() % 2;
int m4 = rand() % 2;
int m5 = rand() % 2;
int m6 = rand() % 2;
cout << "你获得了:" << endl;
cout << m1 << "元" << endl;
cout << m2 << "瓶生命药水" << endl;
cout << m3 << "瓶防御药水" << endl;
cout << m4 << "瓶攻击药水" << endl;
cout << m5 << "瓶经验药水" << endl;
cout << m6 << "瓶全幅药水" << endl;
money += m1;
bag[19] += m2;
bag[20] += m3;
bag[21] += m4;
bag[22] += m5;
bag[23] += m6;
_getch();
a[x][y - 1] = '@';
a[x][y] = ' ';
y--;
}
else if (a[x][y - 1] == 'S')
{
poisonshop();
}
else if (a[x][y - 1] == 'B')
{
bookshop();
}
else if (a[x][y - 1] == 'T')
{
NoticeBoard(l, x, y - 1);
}
else if (a[x][y - 1] == '0' && l == 10)
{
a[x][y] = '0';
x = 7;
y = 12;
a[x][y] = '@';
}
else if (a[x][y - 1] == 'X' && l == 12)
{
a[x][y] = ' ';
x = 9;
y = 49;
a[x][y] = '@';
}
else if (a[x][y - 1] != '#')
{
a[x][y - 1] = '@';
a[x][y] = ' ';
y -= 1;
}
if (l == 9 && x == 4 && y == 12)
{
a[x][y - 2] = '@';
a[x][y] = ' ';
y -= 2;
}
}
if (ch == 'd') {
if ('0' < a[x][y + 1] && a[x][y + 1] <= '9')
{
cout << "你遇到了" << (int)(a[x][y + 1] - '0') << "级怪物,迎战吧!";
fight("怪物", 1000 * (a[x][y + 1] - '0'), 250 * (a[x][y + 1] - '0'), 10 * (a[x][y + 1] - '0'), 12, 50 * (a[x][y + 1] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x][y + 1] = '@';
a[x][y] = ' ';
y++;
a[x][y] = ' ';
}
else if (a[x][y + 1] == 'I')
{
cout << "你是否要退出?" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x][y + 1] == 'o')
{
cout << "你通关了" << endl;
if (nowlevel + 1 == l)
{
nowlevel++;
}
_getch();
return 0;
}
else if (a[x][y + 1] == 'P')
{
int m1 = rand() % 50;
int m2 = rand() % 2;
int m3 = rand() % 2;
int m4 = rand() % 2;
int m5 = rand() % 2;
int m6 = rand() % 2;
cout << "你获得了:" << endl;
cout << m1 << "元" << endl;
cout << m2 << "瓶生命药水" << endl;
cout << m3 << "瓶防御药水" << endl;
cout << m4 << "瓶攻击药水" << endl;
cout << m5 << "瓶经验药水" << endl;
cout << m6 << "瓶全幅药水" << endl;
money += m1;
bag[19] += m2;
bag[20] += m3;
bag[21] += m4;
bag[22] += m5;
bag[23] += m6;
_getch();
a[x][y + 1] = '@';
a[x][y] = ' ';
y++;
}
else if (a[x][y + 1] == 'S')
{
poisonshop();
}
else if (a[x][y + 1] == 'B')
{
bookshop();
}
else if (a[x][y + 1] == 'T')
{
NoticeBoard(l, x, y + 1);
}
else if (a[x][y + 1] == '0' && l == 10)
{
a[x][y] = '0';
x = 7;
y = 12;
a[x][y] = '@';
}
else if (a[x][y + 1] == 'X' && l == 12)
{
a[x][y] = ' ';
x = 9;
y = 49;
a[x][y] = '@';
}
else if (a[x][y + 1] != '#')
{
a[x][y + 1] = '@';
a[x][y] = ' ';
y++;
}
if (l == 9 && x == 4 && y == 4)
{
a[x][y + 2] = '@';
a[x][y] = ' ';
y += 2;
}
}
if (ch == 'w') {
if ('0' < a[x - 1][y] && a[x - 1][y] <= '9')
{
cout << "你遇到了" << (int)(a[x - 1][y] - '0') << "级怪物,迎战吧!";
fight("怪物", 1000 * (a[x - 1][y] - '0'), 250 * (a[x - 1][y] - '0'), 10 * (a[x - 1][y] - '0'), 12, 50 * (a[x - 1][y] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x - 1][y] = '@';
a[x][y] = ' ';
x--;
a[x][y] = ' ';
}
else if (a[x - 1][y] == 'I')
{
cout << "你是否要退出?" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x - 1][y] == 'o')
{
cout << "你通关了" << endl;
if (nowlevel + 1 == l)
{
nowlevel++;
}
_getch();
return 0;
}
else if (a[x - 1][y] == 'P')
{
int m1 = rand() % 50;
int m2 = rand() % 2;
int m3 = rand() % 2;
int m4 = rand() % 2;
int m5 = rand() % 2;
int m6 = rand() % 2;
cout << "你获得了:" << endl;
cout << m1 << "元" << endl;
cout << m2 << "瓶生命药水" << endl;
cout << m3 << "瓶防御药水" << endl;
cout << m4 << "瓶攻击药水" << endl;
cout << m5 << "瓶经验药水" << endl;
cout << m6 << "瓶全幅药水" << endl;
money += m1;
bag[19] += m2;
bag[20] += m3;
bag[21] += m4;
bag[22] += m5;
bag[23] += m6;
_getch();
a[x - 1][y] = '@';
a[x][y] = ' ';
x--;
}
else if (a[x - 1][y] == 'S')
{
poisonshop();
}
else if (a[x - 1][y] == 'B')
{
bookshop();
}
else if (a[x - 1][y] == 'T')
{
NoticeBoard(l, x - 1, y);
}
else if (a[x - 1][y] == '0' && l == 10)
{
a[x][y] = '0';
x = 7;
y = 12;
a[x][y] = '@';
}
else if (a[x - 1][y] == 'X' && l == 12)
{
a[x][y] = ' ';
x = 9;
y = 49;
a[x][y] = '@';
}
else if (a[x - 1][y] != '#')
{
a[x - 1][y] = '@';
a[x][y] = ' ';
x -= 1;
}
}
if (ch == 's') {
if (a[x + 1][y] == ' ')
{
a[x + 1][y] = '@';
a[x][y] = ' ';
x += 1;
}
else if ('0' < a[x + 1][y] && a[x + 1][y] <= '9')
{
cout << "你遇到了" << (int)(a[x + 1][y] - '0') << "级怪物,迎战吧!";
fight("怪物", 1000 * (a[x + 1][y] - '0'), 250 * (a[x + 1][y] - '0'), 10 * (a[x + 1][y] - '0'), 12, 50 * (a[x + 1][y] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x + 1][y] = '@';
a[x][y] = ' ';
x++;
a[x][y] = ' ';
}
else if (a[x + 1][y] == 'I')
{
cout << "你是否要退出?" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x + 1][y] == 'o')
{
cout << "你通关了" << endl;
if (nowlevel + 1 == l)
{
nowlevel++;
}
_getch();
return 0;
}
else if (a[x + 1][y] == 'P')
{
int m1 = rand() % 50;
int m2 = rand() % 2;
int m3 = rand() % 2;
int m4 = rand() % 2;
int m5 = rand() % 2;
int m6 = rand() % 2;
cout << "你获得了:" << endl;
cout << m1 << "元" << endl;
cout << m2 << "瓶生命药水" << endl;
cout << m3 << "瓶防御药水" << endl;
cout << m4 << "瓶攻击药水" << endl;
cout << m5 << "瓶经验药水" << endl;
cout << m6 << "瓶全幅药水" << endl;
money += m1;
bag[19] += m2;
bag[20] += m3;
bag[21] += m4;
bag[22] += m5;
bag[23] += m6;
_getch();
a[x + 1][y] = '@';
a[x][y] = ' ';
x++;
}
else if (a[x + 1][y] == 'S')
{
poisonshop();
}
else if (a[x + 1][y] == 'B')
{
bookshop();
}
else if (a[x + 1][y] == 'T')
{
NoticeBoard(l, x + 1, y);
}
else if (a[x + 1][y] == '0' && l == 10)
{
a[x][y] = '0';
x = 7;
y = 12;
a[x][y] = '@';
}
else if (a[x + 1][y] == 'X' && l == 12)
{
a[x][y] = ' ';
x = 9;
y = 49;
a[x][y] = '@';
}
else if (a[x + 1][y] != '#')
{
a[x + 1][y] = '@';
a[x][y] = ' ';
x++;
}
}
}
return 0;
}
int MM()
{
if (amm == 0) {
int lie = 0;
cout << "....建议45级打,飘升80级...." << endl;
cout << "攻击即可获得:" << endl;
cout << "抽奖券*100 技能书昏昏倒地或技能书铁甲咒 全幅药水*50";
cout << " 金币*2000 经验石X*50" << endl;
cout << " 1攻击 2变强后再来" << endl;
int a;
cin >> a;
if (a == 1) {
cout << "你来到了魔法部大门" << endl;
Sleep(1000);
cout << "魔法部大门看守:你来这干嘛!" << endl;
Sleep(1000);
cout << "1抢劫! 2办事的。" << endl;
cin >> a;
if (a == 1) cout << "魔法部大门看守:拦下他!" << endl;
else {
if (camp) cout << "魔法部大门看守:不可能,你是伏地魔的人!" << endl;
else {
cout << "魔法部大门看守仔细一看。" << endl;
Sleep(1000);
cout << "魔法部大门看守:他是哈利波特的人,抓了他问哈利波特下落!" << endl;
}
}
Sleep(1000);
fight("大门看守", 2000, 200, 20, 0, 1000);
if (dead) return 0;
fight("大门看守", 2000, 200, 20, 0, 1000);
if (dead) return 0;
cout << "增加100滴血" << endl;
health += 100;
Sleep(1000);
cout << "你踢开了大门" << endl;
Sleep(1000);
cout << "里面的几个雕像活了" << endl;
Sleep(1000);
fight("雕像", 10000, 200, 20, 0, 500);
if (dead) return 0;
fight("雕像", 10000, 200, 20, 0, 500);
if (dead) return 0;
fight("雕像", 10000, 200, 20, 0, 500);
if (dead) return 0;
cout << "增加500滴血" << endl;
health += 500;
cout << "你杀死了雕像后, 正准备往楼上走" << endl;
Sleep(1000);
cout << "突然一群员工跑了过来" << endl;
Sleep(1000);
cout << "员工:这是你干你的吗" << endl;
Sleep(1000);
cout << "1,撒谎 其他,是!" << endl;
cin >> a;
if (a == 1) {
cout << "员工:是谁干的?" << endl;
Sleep(1000);
cout << "你随便指了一个员工" << endl;
Sleep(1000);
cout << "他!" << endl;
Sleep(1000);
cout << "那群员工匆匆跑了过去" << endl;
Sleep(1000);
cout << "你赶快跑上楼梯" << endl;
Sleep(1000);
lie = 1;
}
else {
cout << "员工:干掉他!" << endl;
Sleep(1000);
fight("员工", 3000, 200, 100, 14, 1000);
if (dead) return 0;
fight("员工", 3000, 200, 100, 14, 1000);
if (dead) return 0;
fight("员工", 3000, 200, 100, 14, 1000);
if (dead) return 0;
fight("员工", 3000, 200, 100, 15, 1000);
if (dead) return 0;
fight("员工", 3000, 200, 100, 17, 1000);
if (dead) return 0;
if (rand() % 3 == 0) {
cout << "你获得了技能书铁甲咒" << endl;
bag[7]++;
Sleep(1000);
}
cout << "你赶快跑上楼梯" << endl;
health += 500;
}
Sleep(1000);
cout << "你遇到了副部长" << endl;
Sleep(1000);
fight("副部长", 10000, 1000, 100, 20, 3000);
health += 5000;
if (dead) return 0;
if (lie) {
cout << "上次的员工跑了过来" << endl;
Sleep(1000);
cout << "员工:你,你骗了我们!" << endl;
Sleep(1000);
fight("员工", 3000, 200, 100, 14, 1000);
if (dead) return 0;
fight("员工", 3000, 200, 100, 14, 1000);
if (dead) return 0;
fight("员工", 3000, 200, 100, 14, 1000);
if (dead) return 0;
fight("员工", 3000, 200, 100, 15, 1500);
if (dead) return 0;
fight("员工", 3000, 200, 100, 17, 2000);
if (dead) return 0;
if (rand() % 3 == 0){
cout << "你获得了技能书铁甲咒" << endl;
bag[7]++;
Sleep(1000);
}
health += 500;
}
cout << "你遇到了部长";
fight("部长", 15000, 1500, 150, 20, 4000);
if (dead) return 0;
cout << "你获得:" << endl;
cout << "抽奖券*100 技能书昏昏倒地或技能书铁甲咒 全幅药水*50";
cout << " 金币*2000 经验石X*50" << endl;
bag[0] += 100; bag[8]++; bag[23] += 50; money += 2000; bag[5] += 50; amm = 1;
Sleep(3000);
}
else if (a == 2) return 0;
else {
cout << "请勿乱输";
Sleep(1000);
}
}
else {
cout << "你已占领魔法部 可以进入以下地方" << endl;
cout << "0,退出 1,泡温泉 2,矿洞" << endl;
int b;
cin >> b;
switch (b)
{
case 0:
break;
case 1:
time_t c_start, t_start, c_end, t_end;
c_start = clock();
t_start = time(NULL);
cout << "正在泡温泉 按下任意键停止" << endl;
_getch();
c_end = clock();
t_end = time(NULL);
cout << "你获得" << (int)difftime(c_end, c_start) / 100 << "元" << endl;
cout << "你获得" << (int)difftime(c_end, c_start) / 10 << "经验" << endl;
experience += (int)difftime(c_end, c_start) / 10;
money += (int)difftime(c_end, c_start) / 100;
_getch();
break;
case 2:
cout << "你走进矿洞" << endl;
Sleep(1000);
ict++;
if (ict == 5) cout << "你不小心靠在墙上,触发了机关" << endl;
else if (ict > 5) cout << "你找到原来触发机关的地方,按下那块岩石,密道又出现了" << endl;
cout << "0,退出 1,挖矿";
if (ict > 4) cout << " 2,暗道";
cout << endl;
int c;
cin >> c;
if (c == 1) dig();
else if (c == 2 && ict > 4) {
cout << "你走进暗道" << endl;
_getch();
cout << "你发现了一个完全不同的世界,里面充满了怪物" << endl;
_getch();
cout << "每去一个地方都有可能遇到他们" << endl;
_getch();
cout << "但你有一种直觉,穿过这个森林,就能找到某些东西" << endl;
_getch();
MessageBox(0, TEXT("建议 生命>60000 攻击>20000 防御>2000 速度>1000 时来打"), TEXT("重要提示"), MB_OK);
if (MessageBox(0, TEXT("用 wasd 移动,o出口,I入口,@你"), TEXT("重要提示"), MB_OKCANCEL | MB_ICONINFORMATION) != IDOK){
MessageBox(0, TEXT("下次再来吧!"), TEXT("重要提示"), MB_OK);
return 0;
};
cout << "开始吧!" << endl;
maze();
}
else cout << "请勿乱输" << endl;
Sleep(1000);
break;
}
}
return 0;
}
int finalfight(string Hname)
{
int hisH = 1000000000, hisA = 1000000, hisD = 500000, hisSP = 5000;
int hfaint = 0, hhurt = 0, hbeat = 0;
int mfaint = 0, mhurt = 0;
dead = false;
int ha = hisA;
int his = hisA + hisD + hisH;
while (1)
{
if (hfaint > 0) {
if (rand() % 3 == 0) {
cout << "对方使用技能:咒立停!停止了魔咒" << endl;
hfaint = 1;
}
hfaint -= 1;
}
if (hbeat == 1) {
if (rand() % 10 == 0) {
cout << "对方一躲,躲过了你的石头" << endl;
hbeat = 0;
}
else {
cout << "对方躲闪不急,石头正好撞在他的鼻子上 扣血50滴" << endl;
hisH -= 50;
}
}
if (mfaint > 0) {
if (Sl[6]) mfaint = 0;
else mfaint -= 1;
}
if (mhurt > 0) {
if (Sl[6]) mhurt = 0;
else {
mhurt -= 1;
cout << "你的心像被一把刀刺穿了一样 扣血200滴" << endl;
health -= 200;
}
}
if (mfaint <= 0) {
if (rand() % 3 && Sl[0]) {
cout << "你使用技能快快复苏 生命增加200" << endl;
health += 200;
}
if (rand() % 3 && Sl[1]) {
cout << "你使用技能铁甲护身 生命增加100 防御增加50" << endl;
health += 100;
defense += 50;
}
if (rand() % 3 && Sl[2]) {
cout << "你使用技能昏昏倒地 " << Hname << "一回合之内不能攻击" << endl;
hfaint += 1;
}
if (rand() % 3 && Sl[3]) {
cout << "你使用技能神锋无影 攻击增加200 对方扣血200滴" << endl;
hisH -= 200;
attack += 200;
}
if (rand() % 3 && Sl[5]) {
if (rand() % 10) {
cout << "你使用技能统统石化 " << Hname << "二回合之内不能攻击" << endl;
hfaint += 2;
}
else {
cout << "你使用技能统统石化 " << Hname << "十回合之内不能攻击" << endl;
hfaint += 10;
}
}
if (rand() % 4 == 0 && Sl[7]) {
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
hisH = monsterfight(Hname, hisH, hisA, hisD, 23, hisSP);
if (hisH < 1)
{
cout << "对方死亡" << endl; Sleep(1000);
cout << "全部人都来庆祝你" << endl; Sleep(1000);
cout << "突然," << Hname << "的魔杖一转,指向了你。" << endl; Sleep(1000);
cout << "里面发出一束红色的光柱" << endl; Sleep(1000);
cout << "你连忙拿魔杖一挡" << endl; Sleep(1000);
cout << "那光柱击中你的魔杖,爆炸了" << endl; Sleep(1000);
cout << "你的魔杖断了" << endl; Sleep(1000);
cout << "你被炸出20多米" << endl; Sleep(1000);
cout << "未完待续..." << endl; Sleep(10000);
return 0;
}
if (Sl[0]) {
cout << "在对方和石怪的战斗中,你已经恢复了2000生命" << endl;
if (maxhealth < health + 2000) health = maxhealth;
else health += 2000;
}
}
if (rand() % 4 == 0 && Sl[8]) {
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
}
if (rand() % 3 && Sl[9]) {
cout << "你使用技能万弹齐发!变出几十块石头" << endl;
hbeat = 1;
}
if (rand() % 3 && Sl[10]) {
cout << "你使用技能钻心咒!对方将疼痛5回合" << endl;
hhurt += 5;
}
if (rand() % 3 && Sl[11]) {
cout << "魂魄出窍!你使用夺魂咒,企图让" << Hname << "自己攻击自己!" << endl;
Sleep((rand() % 2000) + 1000);
cout << Hname << "被你控制了,开始攻击自己" << endl;
Sleep(700);
int ran = rand() % 40 - 20;
if (hisA + ran > hisD) {
cout << "对方发起进攻 自己扣血" << hisH - hisD + ran << "滴 剩余" << hisH - (hisA - hisD + ran) << "滴" << endl;
hisH -= hisA - hisD + ran;
}
else cout << "对方发起进攻 自己扣血0滴 剩余" << hisH << "滴" << endl;
}
if (rand() % 2 && Sl[12]) {
cout << "你使用技能阿瓦达索命 " << Hname << "扣血" << hisH - hisH / 4 << "滴" << endl;
hisH /= 4;
}
Sleep(1000);
int ran = rand() % 40 - 20;
if (rand() % 10000 > hisSP) {
if (attack + ran > hisD) {
cout << "你发起进攻 " << Hname << "扣血" << attack - hisD + ran << "滴 剩余" << hisH - (attack - hisD + ran) << "滴" << endl;
hisH -= attack - hisD + ran;
}
else cout << "你发起进攻 " << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
else
{
if (rand() % 2) cout << "你一脚踹了过去,但没有踢中" << endl;
else {
cout << "你一脚踹了过去,但只擦着了腰" << endl;
if ((attack / 3) + ran > hisD) {
cout << Hname << "扣血" << (attack / 3) + ran - hisD << "滴 剩余" << hisH - ((attack / 3) + ran - hisD) << "滴" << endl;
hisH -= (attack / 3) + ran - hisD;
}
else cout << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
}
}
Sleep(700);
if (hhurt > 0) {
hhurt -= 1;
cout << "对方因中了你的钻心咒,正捂着心大叫呢 扣血200滴" << endl;
hisH -= 200;
}
if (hisH <= 0) {
if (rand() % 3 == 0) {
cout << "对方发动技能:恢复如初 满血复活" << endl;
hisH = ha;
Sleep(1000);
}
else {
cout << "对方死亡"<< endl; Sleep(1000);
cout << "全部人都来庆祝你" << endl; Sleep(1000);
cout << "突然," << Hname << "的魔杖一转,指向了你。" << endl; Sleep(1000);
cout << "里面发出一束红色的光柱" << endl; Sleep(1000);
cout << "你连忙拿魔杖一挡" << endl; Sleep(1000);
cout << "那光柱击中你的魔杖,爆炸了" << endl; Sleep(1000);
cout << "你的魔杖断了" << endl; Sleep(1000);
cout << "你被炸出20多米" << endl; Sleep(1000);
cout << "未完待续..." << endl; Sleep(10000);
return 0;
}
}
if (rand() % 3 == 0) {
cout << "对方发动技能:快快复苏 生命加200" << endl;
hisH += 200;
}
if (rand() % 3 == 0) {
cout << "对方发动技能:盔甲护身 生命加50 防御增加50" << endl;
hisH += 50;
hisD += 50;
}
if (rand() % 3 == 0) {
cout << "对方使用技能神锋无影 攻击增加200 扣血200滴" << endl;
health -= 200;
hisA += 200;
}
if (rand() % 3 == 0) {
cout << "对方使用技能昏昏倒地 " << name << "一回合之内不能攻击" << endl;
mfaint += 1;
}
if (rand() % 3 == 0)
{
if (rand() % 10) {
cout << "对方使用技能统统石化 " << name << "二回合之内不能攻击" << endl;
mfaint += 2;
}
else {
cout << "对方使用技能统统石化 " << name << "十回合之内不能攻击" << endl;
mfaint += 10;
}
}
if (rand() % 3 == 0) {
cout << "对方使用技能阿瓦达索命 " << name << "扣血" << health - health / 4 << "滴" << endl;
health /= 4;
}
Sleep(1000);
if (hfaint <= 0) {
int ran = rand() % 40 - 20;
if (rand() % 10000 > speed) {
if (hisA + ran > defense) {
cout << Hname << "发起进攻 " << "你扣血" << hisA - defense + ran << "滴 剩余" << health - (hisA - defense + ran) << "滴" << endl;
health -= hisA - defense + ran;
}
else cout << Hname << "发起进攻 " << "你扣血0滴 剩余" << health << "滴" << endl;
}
else {
if (rand() % 2) cout << Hname << "一脚踹了过来,但没有踢中" << endl;
else {
if ((hisA / 3) + ran > hisD) {
cout << Hname << "发起进攻 你扣血" << (hisA / 3) + ran - defense << "滴 剩余" << health - ((hisA / 3) + ran - defense) << "滴" << endl;
health -= ((hisA / 3) + ran - defense);
}
else cout << Hname << "发起进攻 " << "你扣血0滴 剩余" << health << "滴" << endl;
}
}
Sleep(1000);
if (health <= 0) {
if (Sl[6] && rand() % 2) {
cout << "你发动技能:恢复如初 满血复活" << endl;
health = maxhealth;
Sleep(1000);
}
else {
cout << "你死亡";
health = 20;
dead = true;
return 0;
}
}
}
}
return 0;
}
int main()
{
int isbreak;
isbreak = false;
if (MessageBox(0, TEXT("除输入名字外,请不要输入任何字符,否则将导致游戏崩溃!"), TEXT("重要提示"), MB_OKCANCEL | MB_ICONINFORMATION) != IDOK)
{
MessageBox(0, TEXT("既然你不同意,那就别玩了"), TEXT("重要提示"), MB_OK);
return 0;
};
srand((unsigned)time(NULL));
cout << " 1.2.9 \n";
cout << " MagicWorld--HarryPotter \n";
cout << " \n";
cout << " / > \n";
cout << " / > / \n";
cout << " < _____ > / \n";
cout << " |-O--O-| / \n";
cout << " / == - . / \n";
cout << " / . [ ] \n";
cout << " / /` ___/ \n";
cout << " \n";
cout << " by evan\n";
cout << "输入‘start’开始游戏 \n";
string start;
cin >> start;
for (int i = 8; i < 100; i++) wandname[i] = "1";
if (start == "start") {
int i;
system("cls");
for (i = 0; i < 20; i++) {
cout << "loading..." << endl << "--------------------------" << endl << " ";
for (int j = 0; j <= i % 5; j++) cout << "+==+";
cout << " " << endl << "--------------------------" << endl;
switch (rand() % 4)
{
case 0:
cout << "打怪是升级和提升战力的好方法。" << endl;
break;
case 1:
cout << "开始游戏时记得选择阵营。" << endl;
break;
case 2:
cout << "退出时要保存。" << endl;
break;
case 3:
cout << "新手开始游戏时会有3瓶经验药水1张抽奖券。" << endl;
break;
}
Sleep(250);
system("cls");
}
while (1)
{
isbreak = false;
cout << "1,登录 2,注册";
int a;
cin >> a;
if (a == 1) login();
else Reg();
while (1) {
if (isbreak)
{
break;
}
system("cls");
cout << "魔法人士:" << name << endl;
cout << "势力:";
if (camp) cout << "伏地魔" << endl;
else cout << "哈利波特" << endl;
cout << "生命:" << health << "/" << maxhealth << endl;
cout << "攻击:" << attack << endl;
cout << "防御:" << defense << endl;
cout << "速度:" << speed << endl;
cout << "等级:" << level << endl;
cout << "经验:" << experience << "/" << level * 100 << endl;
cout << "金币:" << money << endl;
cout << "1,魔法部(攻击即可占领) 2,大街(杀人/阻止食死徒) 3,";
if (camp) cout << "霍格沃茨(哈利波特不在) ";
else cout << "伏地魔总部(伏地魔不在) ";
cout << "4,霍格沃茨(最后战场) 5,奥利凡德魔杖商店 6,抽奖 7,经验石店 8,背包 9,工厂 10,材料店 11,任务 12,终极任务 13,副本 14,保存 ";
if (camp) cout << "15, 医疗兵(伏地魔的)";
else cout << "15, 庞弗雷女士 ";
cout << "16,改变参数(测试专用 需要密码) 17,设置 18,登出" << endl;
cin >> a;
switch (a)
{
case 1:
MM();
break;
case 2:
street();
break;
case 3:
for (int i = 1; i < 100; i++) {
cout << "|";
for (int j = 0; j < 10 && i < 100; j++, i++) {
if (nowlevel + 1 < i) cout << " " << i << " |";
else cout << ":" << i << ":|";
}
cout << endl;
}
int num;
cin >> num;
if (nowlevel + 1 < num) cout << "你未解锁这关" << endl;
else checkpoint(num);
Sleep(1000);
break;
case 4:
if (camp) {
if (f) finalfight("哈利·波特");
else cout << "你需要先寻找哈利波特的下落" << endl;
}
else {
if (f) finalfight("伏地魔");
else cout << "你需要先寻找伏地魔的下落" << endl;
}
Sleep(1000);
break;
case 5:
cout << "1 柳条独角兽尾毛魔杖 100元" << endl;
cout << "2 胡桃木龙神经魔杖 200元" << endl;
cout << "3 鹅耳枥木魔杖 550元" << endl;
cout << "4 柳条魔杖 1200元" << endl;
cout << "5 花心木魔杖 3650元" << endl;
cout << "6 冬青木凤凰羽毛魔杖 5780元" << endl;
cout << "7 紫杉木凤凰羽毛魔杖 7120元" << endl;
cout << "8 老魔杖 50000元" << endl;
cout << "0 退出 0元" << endl;
int b;
cin >> b;
switch (b)
{
case 1:
buywand(6, 100);
system("cls");
break;
case 2:
buywand(7, 200);
system("cls");
break;
case 3:
buywand(8, 550);
system("cls");
break;
case 4:
buywand(9, 1200);
system("cls");
break;
case 5:
buywand(10, 3650);
system("cls");
break;
case 6:
buywand(11, 5780);
system("cls");
break;
case 7:
buywand(12, 7120);
system("cls");
break;
case 8:
buywand(13, 50000);
system("cls");
break;
default:
break;
}
break;
case 6:
LD();
break;
case 7:
cout << "1 经验石R 100元 100经验" << endl;
cout << "2 经验石SR 200元 250经验" << endl;
cout << "3 经验石SSR 400元 500经验" << endl;
cout << "4 经验石SSS 1000元 1200经验" << endl;
cout << "5 经验石X 2000元 2500经验" << endl;
cout << "0 退出 0元 0经验" << endl;
int c;
cin >> c;
switch (c)
{
case 1:
buy(1, 100);
system("cls");
break;
case 2:
buy(2, 200);
system("cls");
break;
case 3:
buy(3, 550);
system("cls");
break;
case 4:
buy(4, 1200);
system("cls");
break;
case 5:
buy(5, 3650);
system("cls");
break;
default:
break;
}
break;
case 8:
cout << "1,查看魔杖 2,查看药水 3,查看经验石 4,学习技能" << endl;
cin >> b;
if (b == 1) w();
else if (b == 2) p();
else if (b == 3) e();
else if (b == 4) s();
else {
cout << "请勿乱输" << endl;
Sleep(1000);
}
break;
case 9:
int material1, material2, mn1, mn2;
cout << "1,制作 2,查看材料";
cin >> material1;
if (material1 == 1) {
cout << "你要用什么杖芯?" << endl;
for (int ij = 0; ij < 9; ij++) cout << ij + 1 << "," << Material1name[ij] << " " << bag[ij + 24] << "个" << endl;
cin >> material1;
cout << "几个?" << endl;
cin >> mn1;
cout << "你要用什么木材?" << endl;
for (int ij = 0; ij < 10; ij++) cout << ij + 1 << "," << Material2name[ij] << " " << bag[ij + 33] << "个" << endl;
cin >> material2;
cout << "几个?" << endl;
cin >> mn2;
make(material1 + 23, material2 + 32, mn1, mn2);
break;
}
else if (material1 == 2) {
cout << "杖芯:" << endl;
for (int ij = 0; ij < 9; ij++) cout << ij + 1 << "," << Material1name[ij] << " " << bag[ij + 24] << "个" << endl;
cout << "木材:" << endl;
for (int ij = 0; ij < 10; ij++) cout << ij + 1 << "," << Material2name[ij] << " " << bag[ij + 33] << "个" << endl;
_getch();
}
else cout << "请勿乱输";
break;
case 10:
break;
case 11:
if (xy == 1) {
if (ane == 0) cout << "再闯 1 关副本";
else if (ane == 1) cout << "买两件商品";
else if (ane == 2) cout << "回血一次";
else if (ane == 3) cout << "杀死10个人";
cout << "(" << D_Of_C << "/" << OK << ")" << endl;
if (D_Of_C >= OK) {
cout << "任务完成!!"; maxhealth += 200; health += 200; defense += 20; xy = 0; bag[43]++;
}
Sleep(1000);
}
else {
ane = rand() % 4;
D_Of_C = 0;
xy = 1;
if (ane == 0) {
cout << "再闯 1 关副本"; OK = 1;
}
else if (ane == 1) {
cout << "买两件商品"; OK = 2;
}
else if (ane == 2) {
cout << "回血一次"; OK = 1;
}
else if (ane == 3) {
cout << "杀死10个人"; OK = 10;
}
Sleep(1000);
}
break;
case 12:
if (xy1 == 1) {
if (ane1 == 0) {
if (camp) cout << "杀死1个邓布利多";
else cout << "杀死1个纳尼吉";
}
else if (ane1 == 1) cout << "消耗5000元";
else if (ane1 == 2) {
if (camp) cout << "杀死5个穆迪";
else cout << "杀死5个卢修斯·马尔福";
}
else if (ane1 == 3) cout << "杀死100个生物";
else if (ane1 == 4) cout << "再升10级";
cout << "(" << D_Of_C1 << "/" << OK1 << ")" << endl;
if (D_Of_C1 >= OK1) {
cout << "任务完成!!" << endl;
xy1 = 0;
cout << "增加500元 攻击力+10 防御力+10 生命+500" << endl;
money += 500; attack += 200; health += 1000; maxhealth += 1000; defense += 150; bag[43] += 5;
}
Sleep(1000);
}
else {
ane1 = rand() % 5;
D_Of_C1 = 0;
xy1 = 1;
if (ane1 == 0) {
if (camp) cout << "杀死1个邓布利多";
else cout << "杀死1个纳尼吉";
OK1 = 1;
}
else if (ane1 == 1) {
cout << "消耗5000元"; OK1 = 5000;
}
else if (ane1 == 2) {
if (camp) cout << "杀死5个穆迪";
else cout << "杀死5个卢修斯·马尔福";
OK1 = 5;
}
else if (ane1 == 3) {
cout << "杀死100个生物"; OK1 = 100;
}
else if (ane1 == 4) {
cout << "再升10级"; OK1 = 10;
}
Sleep(1000);
}
break;
case 13:
cout << "1 金钱副本" << LE1 << "级 2 经验副本" << LE2 << "级" << endl;
int y;
cin >> y;
if (y == 1) {
for (int i = 0; i < LE1 % 5; i++) {
if (rand() % 3 == 0) fight2("木人桩", 1500, 100, 10, 0, 1000);
else if (rand() % 3 == 1) fight2("沙包", 3000, 50, 20, 0, 1000);
else fight2("木板", 1000, 100, 10, 0, 1000);
if (dead) break;
}
for (int i = 0; i < (LE1 / 5) % 25; i++) {
if (dead) break;
if (rand() % 3 == 0) fight2("石人桩(这有吗)", 3000, 200, 20, 0, 2000);
else if (rand() % 3 == 1) fight2("石包(这有吗)", 6000, 100, 60, 0, 2000);
else fight2("石板", 3000, 300, 30, 0, 2000);
}
for (int i = 0; i < (LE1 / 25) % 125; i++) {
if (dead) break;
if (rand() % 3 == 0) fight2("铁人桩(这有吗)", 6000, 400, 40, 0, 4000);
else if (rand() % 3 == 1) fight2("铁包(这有吗)", 12000, 200, 120, 0, 4000);
else fight2("铁板", 6000, 400, 40, 0, 4000);
}
for (int i = 0; i < (LE1 / 125) % 625; i++) {
if (dead) break;
if (rand() % 3 == 0) fight2("金人桩(这有吗)", 12000, 800, 80, 0, 6500);
else if (rand() % 3 == 1) fight2("金包(这有吗)", 24000, 400, 240, 0, 6500);
else fight2("金板", 12000, 800, 80, 0, 6500);
}
if (!dead) {
LE1++;
if (ane == 0) D_Of_C++;
}
}
if (y == 2) {
for (int i = 0; i < LE2 % 5; i++) {
if (rand() % 3 == 0) fight1("木人桩", 1500, 100, 10, 0, 1000);
else if (rand() % 3 == 1) fight1("沙包", 3000, 50, 20, 0, 1000);
else fight1("木板", 1000, 100, 10, 0, 1000);
if (dead) break;
}
for (int i = 0; i < (LE2 / 5) % 25; i++) {
if (dead) break;
if (rand() % 3 == 0) fight1("石人桩(这有吗)", 3000, 200, 20, 0, 1000);
else if (rand() % 3 == 1) fight1("石包(这有吗)", 6000, 100, 60, 0, 1000);
else fight1("石板", 3000, 300, 30, 0, 1000);
}
for (int i = 0; i < (LE2 / 25) % 125; i++) {
if (dead) break;
if (rand() % 3 == 0) fight1("铁人桩(这有吗)", 6000, 400, 40, 0, 4000);
else if (rand() % 3 == 1) fight1("铁包(这有吗)", 12000, 200, 120, 0, 4000);
else fight1("铁板", 6000, 400, 40, 0, 4000);
}
for (int i = 0; i < (LE2 / 125) % 625; i++) {
if (dead) break;
if (rand() % 3 == 0) fight1("金人桩(这有吗)", 12000, 800, 80, 0, 6500);
else if (rand() % 3 == 1) fight1("金包(这有吗)", 24000, 400, 240, 0, 6500);
else fight1("金板", 12000, 800, 80, 0, 6500);
}
if (!dead) {
LE2++;
if (ane == 0) D_Of_C++;
}
}
break;
case 14:
save();
cout << "保存成功!";
Sleep(1000);
break;
case 15:
Hos();
Sleep(1000);
break;
case 16:
int pw;
cout << "密码:";
cin >> pw;
if (pw == 1212) {
cout << "0~42,改变背包 43,金币 44,等级 45,经验 46,生命 47,防御 48,攻击 49,最大生命 50,进入魔法部权力(0没有 0<有) 51,速度" << endl;
int num1, num2;
cout << "几号:";
cin >> num1;
cout << "改变成:";
cin >> num2;
if (num1 <= 42) bag[num1] = num2;
else {
switch (num1)
{
case 43:
money = num2;
break;
case 44:
level = num2;
break;
case 45:
experience = num2;
break;
case 46:
health = num2;
break;
case 47:
defense = num2;
break;
case 48:
attack = num2;
break;
case 49:
maxhealth = num2;
break;
case 50:
amm = num2;
break;
case 51:
speed = num2;
break;
default:
break;
}
}
levelup();
cout << "改变成功";
}
else cout << "密码错误" << endl;
Sleep(1000);
break;
case 17:
cout << "1,关卡攻略 2,关卡功能" << endl;
int xd;
cin >> xd;
if (xd == 1) system("start https://paste.ubuntu.com/p/2YQBCmYvSb/");
if (xd == 2) {
cout << "我们先介绍一下图标" << endl;
cout << "╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗" << endl;
cout << "║ @ ║ ║ I ║ ║ o ║ ║ # ║" << endl;
cout << "╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝" << endl;
cout << "你自己 出口 入口 墙" << endl;
cout << "╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗" << endl;
cout << "║ 1 ║ ║ 2 ║ ║ 3 ║ ║ 4 ║" << endl;
cout << "╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝" << endl;
cout << "1级怪 2级怪 3级怪 4级怪" << endl;
cout << "命1000 命2000 命3000 命4000" << endl;
cout << "攻250 攻500 攻750 攻1000" << endl;
cout << "防10 防20 防30 防40" << endl;
cout << "速50 速100 速150 速200" << endl;
cout << "╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗" << endl;
cout << "║ 5 ║ ║ 6 ║ ║ 7 ║ ║ 8 ║" << endl;
cout << "╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝" << endl;
cout << "5级怪 6级怪 7级怪 8级怪" << endl;
cout << "命5000 命6000 命7000 命8000" << endl;
cout << "攻1250 攻1500 攻1750 攻2000" << endl;
cout << "防50 防60 防70 防80" << endl;
cout << "速250 速300 速350 速400" << endl;
cout << "╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗" << endl;
cout << "║ 9 ║ ║ S ║ ║ B ║ ║ T ║" << endl;
cout << "╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝" << endl;
cout << "9级怪 药水商店 书店 告示牌" << endl;
cout << "命9000" << endl;
cout << "攻2250" << endl;
cout << "防90" << endl;
cout << "速450" << endl;
cout << "╔═══╗" << endl;
cout << "║ X ║" << endl;
cout << "╚═══╝" << endl;
cout << "传送机" << endl;
cout << "输入图标了解详细,0退出" << endl;
string st;
cin >> st;
if (st == "@") system("start https://paste.ubuntu.com/p/cdJPnhXddT/");
else if (st == "I" || st == "i") system("start https://paste.ubuntu.com/p/h5npMzvDBX/");
else if (st == "o" || st == "O") system("start https://paste.ubuntu.com/p/By6Fdyq9wq/");
else if (st == "#") system("start https://paste.ubuntu.com/p/DswXYhVGFn/");
else if (st <= "9" && st >= "1") system("start https://paste.ubuntu.com/p/4vZDjY7fX4/");
else if (st == "S" || st == "s") system("start https://paste.ubuntu.com/p/SvSTDGrcD3/");
else if (st == "B" || st == "b") system("start https://paste.ubuntu.com/p/MMqwYn63N9/");
else if (st == "T" || st == "t") system("start https://paste.ubuntu.com/p/mXgfbyhGGJ/");
else if (st == "X" || st == "x") system("start https://paste.ubuntu.com/p/M6svDYryGt/");
else if (st == "0");
else cout << "请勿乱输" << endl;
Sleep(1000);
}
break;
case 18:
isbreak = true;
}
levelup();
}
}
}
}
2.欢乐斗地主
#include<bits/stdc++.h>
#define PLAYERCOUNT 3
#define CARDSCOUNT 54
#define CURRENTPLAYER 0
#define VALUECOUNT 17
#define ERROR -1
using namespace std;
const char toFigure[]="34567890JQKA 2YZ";
enum COLOR{ //花色显示ASCII: 3~6
eHEART=3,//红桃
eDIAMOND,//方片
eCLUB, //草花
eSPADE //黑桃
};
class Card;
class CardsType;
class CardGroup;
class Player;
class Landlords;
class LastCards;
bool makeChoice(string tip);
bool cmp(Card* a,Card* b);
class Card{
public:
char figure;
COLOR color;
int value;
Card(char _figure,COLOR _color){
figure=_figure;
color=_color;
value=calValue();
}
int calValue(){
for(int i=0;toFigure[i];i++){
if(toFigure[i]==figure){
return i;
}
}
return ERROR;
}
void print(){
assert(value!=ERROR);
if(figure=='Z'){
cout<<"ZZ";
}else if(figure=='Y'){
cout<<"YY";
}else{
cout<<figure<<(char)color;
}
cout<<' ';
}
};
class CardsType{
public:
//为了规范查找对应牌的方法
//统一为3个参数cnt1、isContinuous、cnt2
int typeId;
string typeStr;
int cnt1,cnt2;
bool isContinuous;
CardsType(){
typeId=ERROR;
}
bool operator ==(const CardsType& other)const{
return this->typeId==other.typeId;
}
void init(char* _typeStr,int _typeId,int _cnt1,bool _isContinuous,int _cnt2){
cnt1=_cnt1;
isContinuous=_isContinuous;
cnt2=_cnt2;
typeStr=_typeStr;
typeId=_typeId;
}
};
class CardGroup{
public:
vector<Card*> cards;
CardsType type;
void calType(){
int i,n=cards.size();
//init(typeStr,typeId,cnt1,isContinuous,cnt2)
if(n==0){
type.init("不出",14,0,0,0);
return;
}
if(n==2&&cards[0]->value==15&&cards[1]->value==14){
type.init("王炸",0,0,0,0);
return;
}
//统计同点数牌有多少张
int cntFlag[VALUECOUNT]={0};
for(i=0;i<n;i++){
cntFlag[cards[i]->value]++;
}
//统计点数最多和最少的牌
int maxCnt=0,minCnt=4;
for(i=0;i<VALUECOUNT;i++){
if(maxCnt<cntFlag[i]){
maxCnt=cntFlag[i];
}
if(cntFlag[i]&&minCnt>cntFlag[i]){
minCnt=cntFlag[i];
}
}
if(n==4&&maxCnt==4){
type.init("炸弹",1,4,0,0);
return;
}
if(n==1){
type.init("单牌",2,1,0,0);
return;
}
if(n==2&&maxCnt==2){
type.init("对子",3,2,0,0);
return;
}
if(n==3&&maxCnt==3){
type.init("三张 ",4,3,0,0);
return;
}
if(n==4&&maxCnt==3){
type.init("三带一",5,3,0,1);
return;
}
if(n==5&&maxCnt==3&&minCnt==2){
type.init("三带一对",6,3,0,2);
return;
}
if(n==6&&maxCnt==4){
type.init("四带二",7,4,0,1);
return;
}
if(n==8&&maxCnt==4&&minCnt==2){
type.init("四带二",8,4,0,2);
return;
}
if(n>=5&&maxCnt==1&&cards[0]->value==cards[n-1]->value+n-1){
type.init("顺子",9,1,1,0);
return;
}
if(n>=6&&maxCnt==2&&minCnt==2&&cards[0]->value==cards[n-1]->value+n/2-1){
type.init("连对",10,2,1,0);
return;
}
int fjCnt;//统计连续且大于3三张的牌
for(i=0;i<VALUECOUNT &&cntFlag[i]<3;i++);
for(fjCnt=0;i<VALUECOUNT &&cntFlag[i]>=3;i++,fjCnt++);
if(fjCnt>1){
if(n==fjCnt*3)
type.init("飞机",11,3,1,0);
else if(n==fjCnt*4)
type.init("飞机",12,3,1,1);
else if(n==fjCnt*5&&minCnt==2)
type.init("飞机",13,3,1,2);
}
}
void init(string inputStr, vector<Card*> &cardsHolded){
this->cards.clear();
//不出
if(inputStr=="N"){
this->calType();
return;
}
int i,j;
//输入合法性判断
for(i=0;i<inputStr.size();i++){
bool find=false;
for(j=0;toFigure[j];j++){
if(inputStr[i]==toFigure[j]){
find=true;
break;
}
}
if(find==false){
//输入字符不在toFigure中
return;
}
}
//查找手中有没有这些牌
int visitFlag[20]={0};
for(i=0;i<inputStr.size();i++){
Card *find=NULL;
for(j=0;j<cardsHolded.size();j++){
if(!visitFlag[j]&&cardsHolded[j]->figure==inputStr[i]){
visitFlag[j]=1;
find=cardsHolded[j];
break;
}
}
if(find){
this->cards.push_back(find);
}else{
cout<<inputStr[i];
cout<<"没有找到\t";
this->cards.clear();
return;
}
}//end for(i=0;i<inputStr.size();i++)
this->arrange();
}
void init(vector<Card*> newCards){
this->cards=newCards;
this->arrange();
}
bool isCanBeat(CardGroup &cardGroup){
if(cardGroup.type.typeStr=="王炸"){
return false;
}else if(this->type.typeStr=="王炸"){
return true;
}else if(cardGroup.type==this->type &&this->type.typeStr=="炸dan"){
return value()>cardGroup.value();
}else if(cardGroup.type.typeStr=="炸dan"){
return false;
}else if(this->type.typeStr=="炸dan"){
return true;
}else if(cardGroup.type==this->type &&this->cards.size()==cardGroup.cards.size()){
return this->value()>cardGroup.value();
}else{
return false;
}
}
int value(){
//计算牌组权值
int i;
if(type.typeStr=="三带一"||type.typeStr=="三带一对"||type.typeStr=="飞机"){
for(i=2;i<cards.size();i++){
if(cards[i]->value==cards[i-2]->value){
return cards[i]->value;
}
}
}
if(type.typeStr=="四带二"){
for(i=3;i<cards.size();i++){
if(cards[i]->value==cards[i-3]->value){
return cards[i]->value;
}
}
}
return cards[0]->value;
}
void arrange(){
//整理:排序、计算类型
sort(this->cards.begin(),this->cards.end(),cmp);
this->calType();
}
};
class LastCards{
static LastCards *lastCards;
public:
Player *player;
CardGroup cardGroup;
static LastCards* inst(){//单例模式
if(lastCards==NULL){
lastCards=new LastCards();
}
return lastCards;
}
vector<Card*> findCanBeatFrom(vector<Card*> &cardsHolded){
//查找能打得过的牌
int i,j,k,n=cardsHolded.size(),m=cardGroup.cards.size();
string typeStr=cardGroup.type.typeStr;
vector<Card*> ret;
if(typeStr=="王炸"||n<m){
//打不过,返回空数组
return ret;
}
int value=cardGroup.value();
//统计各点牌出现的次数
int cntFlag[VALUECOUNT]={0};
for(i=0;i<n;i++){
cntFlag[cardsHolded[i]->value]++;
}
int continuousCount=1;
if(cardGroup.type.isContinuous){
continuousCount=m/(cardGroup.type.cnt1+cardGroup.type.cnt2);
}
bool findFirstFigure;
//cout<<"continuousCount="<<continuousCount<<endl;
for(i=value+1;i<VALUECOUNT;i++){
findFirstFigure=true;
for(j=0;j<continuousCount;j++){
if(cntFlag[i-j]<cardGroup.type.cnt1){
findFirstFigure=false;
break;
}
}
if(findFirstFigure){
ret.clear();
int firstFigure=i;
//cout<<"查找"<<cardGroup.type.cnt1<<"个"<<firstFigure+3<<endl;
for(k=0,j=0;k<cardsHolded.size() &&j<continuousCount;k++){
if(cardsHolded[k]->value==firstFigure-j){
for(int kk=0;j>=0&&kk<cardGroup.type.cnt1;kk++){
ret.push_back(cardsHolded[k+kk]);
}
j++;
}
}
if(cardGroup.type.cnt2>0){
int SecondFigures[5];
int SecondCount=continuousCount;
if(cardGroup.type.typeStr=="四带二")
SecondCount=2;
bool findSecondFigure=true;
for(j=0,k=-1;j<SecondCount &&findSecondFigure;j++){
findSecondFigure=false;
for(k++;k<VALUECOUNT;k++){
SecondFigures[j]=k;
if(cntFlag[k]>=cardGroup.type.cnt2 &&cntFlag[k]<cardGroup.type.cnt1){
findSecondFigure=true;
break;
}
}
}
if(findSecondFigure){
//cout<<"查找SecondFigure "<<cardGroup.type.cnt2<<"个"<<SecondFigures[0]+3<<endl;
//cout<<"SecondCount= "<<SecondCount<<endl;
//for(i=0;i<SecondCount;i++)cout<<"SecondFigures["<<i<<"]="<<SecondFigures[i]<<endl;
for(i=0;i<SecondCount;i++){
for(j=0;j<cardsHolded.size();){
if(cardsHolded[j]->value==SecondFigures[i]){
for(k=0;k<cardGroup.type.cnt2;k++){
//cout<<"添加"<<cardsHolded[j]->value+3<<endl;
ret.push_back(cardsHolded[j+k]);
}
do{
j++;
}while(j<cardsHolded.size()&&cardsHolded[j]->value==SecondFigures[i]);
}else{
j++;
}
}
}
return ret;
}//if(findSecondFigure)
}//end if(cardGroup.type.cnt2>0)
else{
return ret;
}
}//end if(findFirstFigure)
}//end for(i=value+1;i<VALUECOUNT;i++)
ret.clear();
//没牌打得过时查找有没有炸dan
if(typeStr!="炸dan"){
for(i=cardsHolded.size()-1;i>=3;i--){
if(cardsHolded[i]->value==cardsHolded[i-3]->value){
for(j=0;j<4;j++){
ret.push_back(cardsHolded[i-j]);
}
break;
}
}
}
return ret;
}//end vector<Card*> findCanBeatFrom()
};
LastCards* LastCards::lastCards = NULL;
class Player{
public:
string name;
vector<Card*> cards;
void arrange(){
sort(cards.begin(),cards.end(),cmp);
}
void print(){
cout<<this->name<<":\t";
for(int i=0;i<cards.size();i++){
cards[i]->print();
}
cout<<"["<<cards.size()<<"]\n";
}
vector<Card*> tip(){
//提示功能,使自己最小一张连最长
CardGroup ret;
string temp;
int j,k,m=cards.size();
for(j=0;j<m;j++){
temp="";
for(k=j;k<m;k++){
temp+=cards[k]->figure;
}
ret.init(temp,cards);
if(ret.type.typeId!=ERROR){
return ret.cards;
}
}
ret.cards.clear();
return ret.cards;
}
void chupai(CardGroup &cardGroup){
//出牌
cout<<this->name<<":\t";
cout<<cardGroup.type.typeStr<<' ';
for(int i=0;i<cardGroup.cards.size();i++){
cardGroup.cards[i]->print();
this->cards.erase(find(this->cards.begin(),this->cards.end(),cardGroup.cards[i]));
}
cout<<"\t["<<this->cards.size()<<"]\n";
if(cardGroup.type.typeStr!="不出"){
//记录到 LastCards 中
LastCards::inst()->player=this;
LastCards::inst()->cardGroup.init(cardGroup.cards);
}
}
};
class Landlords{
Player *player[PLAYERCOUNT];
bool finished,youWin,landlordWin;
int landlordIndex;
Card *cards[CARDSCOUNT];
public:
Landlords(){
int i,j,k;
for(i=0;i<PLAYERCOUNT;i++){
this->player[i]=new Player();
}
//54张牌初始化
for(k=i=0;i<14;i++){
if(toFigure[i]==' '){
continue;
}
for(COLOR color=eHEART;color<=eSPADE;color=(COLOR)(color+1)){
this->cards[k++]=new Card(toFigure[i],color);
}
}
this->cards[k++]=new Card('Y',eSPADE);
this->cards[k]=new Card('Z',eHEART);
}
~Landlords(){
for(int i=0;i<PLAYERCOUNT;i++){
delete this->player[i];
}
for(int i=0;i<CARDSCOUNT;i++){
delete this->cards[i];
}
}
void init(){
player[CURRENTPLAYER]->name="Bice";
player[1]->name="玩家2";
player[2]->name="玩家3";
finished=false;
youWin=false;
landlordWin=false;
//抢地主
landlordIndex=ERROR;
while(landlordIndex==ERROR){
srand((int)time(0));
shuffle();
landlordIndex=chooseLandlord();
}
cout<<player[landlordIndex]->name<<"\t成为地主\n\n";
this->add3Cards();
LastCards::inst()->player=player[landlordIndex];
}
void startGame(){
string inputSrt;
CardGroup inputCards;
for(int iTurns=landlordIndex;!finished;iTurns++){
if(iTurns>=PLAYERCOUNT){
iTurns=0;
}
if(iTurns==CURRENTPLAYER){
cout<<endl;
player[iTurns]->print();
cout<<"输入提示:Z=大王 Y=小王 0=10 输入可无序 N=不出 例如:JKQ0A9\n请出牌:\t";
do{
cin>>inputSrt;
inputCards.init(inputSrt,player[iTurns]->cards);
}while(check(&inputCards)==false);
}else{
if(player[iTurns]==LastCards::inst()->player){
//若是上次出牌的是自己,启用提示功能
inputCards.init(player[iTurns]->tip());
}else{
//查找能打得过上家的牌
inputCards.init(LastCards::inst()->findCanBeatFrom(player[iTurns]->cards));
}
}
player[iTurns]->chupai(inputCards);//出牌
if(player[iTurns]->cards.size()==0){
//玩家手中没牌了,游戏结束
finished=true;
landlordWin=iTurns==landlordIndex;
if(landlordWin){
youWin=landlordIndex==CURRENTPLAYER;
}else{
youWin=landlordIndex!=CURRENTPLAYER;
}
}
}
cout<<"\n_________________________ "<<(youWin?"You Win!":"You Lose!")<<" _________________________\n\n";
}
void add3Cards(){
cout<<"地主3张牌:\t";
for(int i=PLAYERCOUNT*17;i<CARDSCOUNT;i++){
this->cards[i]->print();
player[landlordIndex]->cards.push_back(cards[i]);
}
cout<<endl;
player[landlordIndex]->arrange();
}
int chooseLandlord(){
cout<<"\n_________________________ 抢地主 _________________________\n\n";
int first=-1,last,cnt=0,i,j=rand()%PLAYERCOUNT;
bool decision;
for(i=0;i<PLAYERCOUNT;i++,j==2?j=0:j++){
if(j==CURRENTPLAYER){
decision=makeChoice("是否抢地主?(Y=抢/N=不抢):");
}else{
decision=rand()%2;
}
if(decision){
cnt++;
last=j;
if(first==-1){
first=j;
}
cout<<this->player[j]->name<<"\t抢地主\n";
}else{
cout<<this->player[j]->name<<"\t没有抢\n";
}
}
if(cnt==0){
cout<<"没人抢,重新发牌\n";
return ERROR;
}
if(cnt==1){
//第一轮只有一人抢地主
return first;
}
else{
//最后一次争抢
if(first==CURRENTPLAYER){
decision=makeChoice("是否抢地主?(Y=抢/N=不抢):");
}else{
decision=rand()%2;
}
if(decision){
cout<<this->player[first]->name<<"\t抢地主\n";
return first;
}else{
cout<<this->player[first]->name<<"\t没有抢\n";
return last;
}
}
}
void shuffle(){
int i,j,k;
//洗牌
for(i=0;i<CARDSCOUNT;i++){
swap(this->cards[i],this->cards[rand()%CARDSCOUNT]);
}
//分牌
for(k=i=0;i<PLAYERCOUNT;i++){
this->player[i]->cards.clear();
for(j=0;j<17;j++){
this->player[i]->cards.push_back(this->cards[k++]);
}
this->player[i]->arrange();//整理
this->player[i]->print();
}
}
bool check(CardGroup *cardGroup){
if(cardGroup->type.typeId==ERROR){
cout<<"出牌错误,重新输入\n";
return false;
}else if(cardGroup->type.typeStr=="不出"){
return true;
}else if(LastCards::inst()->player!=player[CURRENTPLAYER]&&!cardGroup->isCanBeat(LastCards::inst()->cardGroup)){
cout<<"打不过,重新输入\n";
return false;
}else{
return true;
}
}
};
int main(){
Landlords *landlords=new Landlords();
do{
landlords->init();//发牌、抢地主
landlords->startGame();//游戏开始
}while(makeChoice("\n是否继续游戏?(Y=继续/N=结束): "));
delete landlords;
return 0;
}
bool makeChoice(string tip){
cout<<tip;
string input;
cin>>input;
return input=="Y"||input=="y";
}
bool cmp(Card* a,Card* b){
//比较两张牌大小
if(a->value==b->value){
return a->color>b->color;
}else{
return a->value>b->value;
}
}
3.荒岛求生
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <iostream>
#define MAX_NAME_LEN 20 // 最大名字长度
#define INITIAL_HEALTH 100 // 初始健康值
#define INITIAL_HUNGER 50 // 初始饥饿度
#define INITIAL_THIRST 50 // 初始口渴度
// 荒岛地图结构体
typedef struct {
int hasShelter; // 是否有避难所
int hasFood; // 是否有食物
int hasWater; // 是否有水源
int hasDanger; // 是否存在危险
} Map;
// 幸存者状态结构体
typedef struct {
char name[MAX_NAME_LEN]; // 名字
int health; // 健康值
int hunger; // 饥饿度
int thirst; // 口渴度
} Survivor;
// 显示帮助信息
void displayHelp() {
printf("你被困在了荒岛上,请尽力寻找资源保持生机并最终生还。\n");
printf("以下是每个命令的含义:\n");
printf("h - 帮助\n");
printf("s - 显示幸存者当前状态\n");
printf("m - 搜索周围的地图资源\n");
printf("r - 休息\n");
printf("f - 查找食物\n");
printf("w - 查找水源\n");
printf("e - 进入避难所\n");
printf("c - 与其他幸存者合作\n");
printf("a - 与其他幸存者对抗\n");
printf("q - 退出游戏\n");
}
// 显示幸存者状态
void printSurvivorStatus(Survivor* survivor) {
printf("名字:%s\n", survivor->name);
printf("健康值:%d\n", survivor->health);
printf("饥饿度:%d\n", survivor->hunger);
printf("口渴度:%d\n", survivor->thirst);
}
// 搜索资源
void searchResources(Map* map, Survivor* survivor) {
int randFind = rand() % 2; // 模拟搜索结果
if (randFind == 0) {
printf("很遗憾,你没有发现任何资源。\n");
} else {
printf("恭喜你,你发现了一些资源!\n");
int randResource = rand() % 3; // 模拟资源类型
switch (randResource) {
case 0:
printf("你发现了一些果子,你的饥饿度下降了10!\n");
survivor->hunger -= 10;
map->hasFood = 1;
break;
case 1:
printf("你找到了一处小溪流,你的口渴度下降了10!\n");
survivor->thirst -= 10;
map->hasWater = 1;
break;
case 2:
printf("你发现了一个避难所,可能是躲避危险的好地方!\n");
map->hasShelter = 1;
break;
}
}
int randDanger = rand() % 2; // 模拟危险出现概率
if (randDanger == 0) {
printf("很不幸,你碰到了危险!\n");
map->hasDanger = 1;
}
}
// 查找食物
void findFood(Map* map, Survivor* survivor) {
if (!map->hasFood) {
printf("很遗憾,你没有找到任何食物。\n");
return;
}
printf("你找到了一些水果,你的饥饿度下降了20。\n");
survivor->hunger -= 20;
map->hasFood = 0;
}
// 查找水源
void findWater(Map* map, Survivor* survivor) {
if (!map->hasWater) {
printf("很遗憾,你没有找到任何水源。\n");
return;
}
printf("你找到了一些清水,你的口渴度下降了20。\n");
survivor->thirst -= 20;
map->hasWater = 0;
}
// 进入避难所
void enterShelter(Map* map, Survivor* survivor) {
if (!map->hasShelter) {
printf("很遗憾,你还没有找到避难所。\n");
return;
}
printf("你找到了避难所,可以好好休息一下!\n");
survivor->health = 100;
}
// 回避危险
void avoidDanger(Map* map, Survivor* survivor) {
if (!map->hasDanger) {
printf("现在岛上很平静,没有什么可担心的。\n");
return;
}
int randEscape = rand() % 2; // 模拟逃脱概率
if (randEscape == 0) {
printf("很遗憾,你被困住了,受到了伤害!\n");
survivor->health -= 20;
} else {
printf("你成功逃脱了危险!\n");
}
}
// 显示遇到的其他幸存者
void showSurvivorsEncountered(Survivor* player, Survivor* stranger) {
printf("你遇到了一个幸存者:%s\n", stranger->name);
printf("他的状态是:\n");
printSurvivorStatus(stranger);
printf("是否与他合作?(y/n)");
char choice;
getchar();
scanf("%c", &choice);
if (choice == 'y') {
// 计算合作效果
int randCoop = rand() % 2;
if (randCoop == 0) {
printf("很遗憾,你们一起搜索时没有找到任何资源。\n");
} else {
printf("你们成功找到了一些资源!\n");
int randResource = rand() % 3;
switch (randResource) {
case 0:
printf("你们找到了一些香蕉,你的饥饿度下降了10!\n");
player->hunger -= 10;
stranger->hunger -= 10;
break;
case 1:
printf("你们找到了一口井,你的口渴度下降了10!\n");
player->thirst -= 10;
stranger->thirst -= 10;
break;
case 2:
printf("你们发现了一处废弃宿舍,可以休息片刻!\n");
player->health += 20;
stranger->health += 20;
break;
}
}
} else {
// 计算对抗结果
int randVs = rand() % 2;
if (randVs == 0) {
printf("很遗憾,你被幸存者%s打败了!\n", stranger->name);
player->health -= 30;
} else {
printf("你成功击败了幸存者%s,但也受到了一些伤害。\n", stranger->name);
player->health -= 20;
}
}
}
int main() {
srand(time(NULL)); // 用当前时间初始化随机数种子
Survivor player = {"玩家", INITIAL_HEALTH, INITIAL_HUNGER, INITIAL_THIRST};
Map map = {0, 0, 0, 0}; // 初始化荒岛地图
printf("欢迎来到荒岛求生游戏!输入'h'查看帮助信息。\n");
while (1) {
char choice;
std::cin>>choice;
switch (choice) {
case 'h':
displayHelp();
break;
case 's':
printSurvivorStatus(&player);
break;
case 'm':
searchResources(&map, &player);
break;
case 'r':
printf("你摆开行囊好好休息了一下,健康值回复了20点。\n");
player.health += 20;
break;
case 'f':
findFood(&map, &player);
break;
case 'w':
findWater(&map, &player);
break;
case 'e':
enterShelter(&map, &player);
break;
case 'c': {
Survivor stranger = {"陌生人", INITIAL_HEALTH, INITIAL_HUNGER, INITIAL_THIRST};
showSurvivorsEncountered(&player, &stranger);
break;
}
case 'a': {
Survivor enemy = {"敌人", INITIAL_HEALTH, INITIAL_HUNGER, INITIAL_THIRST};
showSurvivorsEncountered(&player, &enemy);
break;
}
case 'q':
printf("游戏结束,再见!\n");
return 0;
default:
printf("无效的命令,请查看帮助信息。\n");
break;
}
// 幸存者状态检查
if (player.hunger <= 0 || player.thirst <= 0 || player.health <= 0) {
printf("很遗憾,你已经死亡了。\n");
return 0;
}
}
return 0;
}
4.火柴人跑酷
#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
#define Nor if(B[b].x<5) B[b].x=5;
#define Out1 Bx1-Bvx1<=6||Bx1-Bvx1>=28||By1-Bvy1<=7||By1-Bvy1>=27
#define Out2 Bx2-Bvx2<=6||Bx2-Bvx2>=28||By2-Bvy2<=7||By2-Bvy2>=27
#define Chang1 {Bwhat1=0;Bvx1=Bvy1=0;memset(Bgo1,0,sizeof(Bgo1));}
#define Chang2 {Bwhat2=0;Bvx2=Bvy2=0;memset(Bgo2,0,sizeof(Bgo2));}
#define Chang3 {Bwhat3=0;Bvx3=Bvy3=0;memset(Bgo3,0,sizeof(Bgo3));}
using namespace std;
int ti(float a) {return ((int)(a*10+5))/10;}
void Setpos(float x,float y){COORD pos;pos.X=ti(y*4)/2;pos.Y=ti(x);SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);}
void Color(int a){if(a==0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);if(a==1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);if(a==5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);if(a==6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);if(a==7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);if(a==8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);if(a==9) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_GREEN|BACKGROUND_BLUE);if(a==10) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_RED|BACKGROUND_BLUE);if(a==11) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);if(a==12) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN);if(a==13) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);if(a==14) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_BLUE);}
int Blomax,Ren,Exp,Expmax,Lv,Lvl,Ice,Drug,ar1,ar2,Tar1,Tar2,bl,br,Win,T,Tb,Sy,Up,Upt,Down,u1,u2,Kill,Killb,L,Ll[4],Li,D,Gd[10],Biao,Fire,Fir,Water,Thun,Wind,Magne,I[20][2],ib,Dis,Disb,Dis1,Disb1,Boss,Bblo,Bblomax,Bwhat1,Bwhat2,Bwhat3,Bgo1[10],Bgo2[10],Bgo3[10],Bbr,Bbl,Bl[4];
float X,Y,Vx,Vy,Ding,Blo,Hui,Bx1,By1,Bx2,By2,Bx3,By3,Bvx1,Bvy1,Bvx2,Bvy2,Bvx3,Bvy3,Bway[1001][2];
struct bullet{float x,y,vx,vy;int what;int a,t,How;int life;bool kill;}B[100001];
void Map(int a,int b);
void Pan(int a,float x,float y,int b){
float Nox[4],Noy[4];Nox[0]=X,Noy[0]=Y;
if(Down==1&&X==22) Nox[1]=X+1,Noy[1]=Y-0.5,Nox[2]=X-1,Noy[2]=Y-0.5;else if(Down==2) Nox[1]=X+1,Noy[1]=Y-0.5,Nox[2]=-10,Noy[2]=-10;else if(Down==1||X<18) Nox[1]=X-1,Noy[1]=Y-0.5,Nox[2]=-10,Noy[2]=-10;else Nox[1]=X+1,Noy[1]=Y-0.5,Nox[2]=X-1,Noy[2]=Y-0.5;
for(int i=0;i<3;i++){
if(a==-1){if(abs(x-Nox[i])+abs(y-Noy[i])<1.5) {if(B[b].what==-10)Exp+=2;if(B[b].what==-11)Exp+=1;B[b].life=0;if(B[b].life==0&&b==bl) bl++;Map(3,b);break;}}
if(a==-2){if(abs(x-Nox[i])+abs(y-Noy[i])<2.5) {if(B[b].what==-2)Exp+=5,Biao+=5;if(B[b].what==-3)Fire=300,Ice=0,Fir=3;if(B[b].what==-4)Water=200;if(B[b].what==-5){Wind=70;Ding=28.25;Ice=0;if(Y<Ding-1)Vy=5;else Vy=0;if(Up>=1) Vx=-5;if(Down==2) Vx=5;}if(B[b].what==-6){Thun=200;system("color 1F");Sleep(20);system("color 6F");Sleep(10);system("color 0F");}if(B[b].what==-7)Magne=300;if(B[b].what==-8)Ice=0,Drug=0,Blo=fmin((float)Blomax,Blo+20);if(B[b].what==-9)Exp=fmin((float)Expmax,Exp+20);B[b].life=0;if(B[b].life==0&&b==bl) bl++;Map(3,b);break;}}
}if(Wind==0&&Thun==0&&(B[b].kill!=0||Killb>=15||Ren==1&&Killb>0)) return;
for(int i=0;i<3;i++){
if((Wind>=1||Thun>=1)&&abs(x-Nox[i])+abs(y-Noy[i])<2.5) {if(B[b].what<98)Exp+=2;B[b].life=0;Map(3,b);break;}
if(a==1) {if(abs(x-Nox[i])<0.5&&abs(y-Noy[i])<1) {if(B[b].what>=99)Blo-=10;if(B[b].what==14)Blo-=15,Ice=100,B[b].life=0;else if(B[b].what==15)Blo-=20,Ice=0,B[b].life=0;else if(B[b].what==17)Blo-=5,Drug=100,B[b].life=0;else if(B[b].what>=13&&B[b].what<=17)Blo-=10,B[b].life=0;else Blo-=15;B[b].kill=1,Killb=20;Kill=1;Map(3,b);break;}}
if (a==2||a==6||a==8||a==9||a==10||a==11||a==12) {
if(abs(x-Nox[i])+abs(y-Noy[i])<1.5) {
if(a==2)Blo-=20;
else if(a==8)Blo-=10;
else Blo-=15;B[b].kill=1,Killb=20;Kill=1;if(a!=2){B[b].life=0;if(B[b].life==0&&b==bl) bl++;Map(3,b);break;}}}
if(a==4) {if((Wind>=1||Thun>=1)&&abs(x-Nox[i])<1.5&&Noy[i]-y<=0&&Noy[i]-y>=-10) {if(B[b].what<98)Exp+=2;B[b].life=0;Map(3,b);break;}if(abs(x-Nox[i])<1&&Noy[i]-y<=0&&Noy[i]-y>=-8) {Blo-=25,B[b].kill=1,Killb=20;Kill=1;Vy=-1;Y-=0.5;break;}}
}
}
void Map(int a,int b){
Color(0);
if(a==-1){
if(Boss==1||Boss==6){if(Bwhat1==5){if(ti(Bx1)==20)Setpos(Bx1,By1),cout<<"==";else Setpos(Bx1,By1),cout<<" ";}else{Setpos(Bx1-1,By1-0.5),cout<<" ";Setpos(Bx1,By1-1),cout<<" ";Setpos(Bx1+1,By1-0.5),cout<<" ";if(abs(ti(Bx1)-20)<=1)Setpos(20,By1-1),cout<<"======";}}
if(Boss==2||Boss==6){Setpos(Bx2-1,By2-1);cout<<" ";Setpos(Bx2,By2-1);cout<<" ";Setpos(Bx2+1,By2-1),cout<<" ";Color(0);if(abs(ti(Bx2)-20)<=1)Setpos(20,By2-1),cout<<"======";}
if(Boss==3||Boss==6){Setpos(Bx3-1,By3-0.5);cout<<" ";Setpos(Bx3,By3);cout<<" ";Setpos(Bx3+1,By3-1),cout<<" ";Color(0);if(abs(ti(Bx3)-20)<=1)Setpos(20,By3-1),cout<<"=======";}
if(X<0)return;if(X>=17&&X<=19){Setpos(X-1,Y);cout<<" ";Setpos(X,Y-1);cout<<" ";Setpos(X+1,Y-1),cout<<" ";}else if(X<=23&&X>=21){Setpos(X+1,Y);cout<<" ";Setpos(X,Y-1);cout<<" ";Setpos(X-1,Y-1),cout<<" ";}else if(X>23){Setpos(X,Y-1);cout<<" ";Setpos(X-1,Y-0.5),cout<<" ";}else if(X<17&&Upt!=0){Setpos(X,Y-1);cout<<" ";Setpos(X+1,Y-1.5),cout<<" ";}else if(X<17){Setpos(X,Y-1);cout<<" ";Setpos(X+1,Y-0.5),cout<<" ";}if(Thun>0){Setpos(X-2,Y-1),cout<<" ";Setpos(X+2,Y-1),cout<<" ";Setpos(X,Y+2),cout<<" ";Setpos(X,Y-2.5),cout<<" ";Setpos(X-1,Y+1),cout<<" ";Setpos(X+1,Y+1),cout<<" ";Setpos(X-1,Y-2),cout<<" ";Setpos(X+1,Y-2),cout<<" ";Setpos(20,Y-2.5),cout<<"============";}if(Wind!=0){Setpos(X+1,Y-5);cout<<" ";Setpos(X,Y-5);cout<<" ";Setpos(X-1,Y-5);cout<<" ";Setpos(20,Y-5),cout<<"========";}if(Water!=0){Setpos(X,Y-4);cout<<" ";Setpos(X+2,Y-3.5);cout<<" ";Setpos(X-2,Y-3.5);cout<<" ";Setpos(X+1,Y-3.5);cout<<" ";Setpos(X-1,Y-3.5);cout<<" ";Setpos(20,Y-5),cout<<"========";}if(Fire!=0){Setpos(X,Y+1),cout<<" ";Setpos(X+1,Y),cout<<" ";Setpos(X-1,Y-1),cout<<" ";Setpos(20,Y-1);cout<<"======";}
}
if(a==0){
if(Boss==1||Boss==6){if(Bwhat1==5)Color(5),Setpos(Bx1,By1),cout<<"█",Color(0);else if(Bwhat1==4&&Bgo1[1]>6&&Bgo1[1]<11)Color(4),Setpos(Bgo1[5]-1,Bgo1[6]),cout<<"︻",Setpos(Bgo1[5],Bgo1[6]-1),cout<<"【",Setpos(Bgo1[5],Bgo1[6]+1),cout<<"】",Setpos(Bgo1[5]+1,Bgo1[6]),cout<<"︼",Color(0);else{Setpos(Bx1-1,By1-0.5),Color(0),cout<<"●●";Setpos(Bx1,By1-1);if(Bwhat1==2&&Bgo1[1]<=5)Color(1);else if(Bwhat1==3&&Bgo1[1]<=5)Color(5);else if(Bwhat1==6&&Bgo1[1]<=5)Color(8); else Color(4);if(Bwhat1==4) Setpos(Bx1,By1-0.5),cout<<"██(";else cout<<")██(";Setpos(Bx1+1,By1-0.5),cout<<"……";Color(0);}}
if(Boss==2||Boss==6){Setpos(Bx2-1,By2-1);Color(0),cout<<"\\ ";Color(0);cout<<"●";Setpos(Bx2,By2-1);Color(3);cout<<"◥";Color(5),cout<<"JJJ";Color(0),cout<<">";Color(3);Setpos(Bx2+1,By2-1),cout<<"◢█◣";Color(0);}
if(Boss==3||Boss==6){Setpos(Bx3-1,By3-0.5);if(Bwhat3==3||Bwhat3==9) Color(1);else if(Bwhat3==4||Bwhat3==10) Color(4);else if(Bwhat3==5||Bwhat3==11) Color(5);if(Bwhat3==11)cout<<' ';else if(Bwhat3==6) Color(3);else Color(2);cout<<"●-";Setpos(Bx3,By3);if(Bwhat3==11)cout<<"/";else cout<<"┃";Color(0);Setpos(Bx3+1,By3-1),cout<<"●●●";}
if(X<0)return;if(Ren==2) Color(12);if(Ren==3) Color(1);if(Ren==4) Color(3);if(Ren==5) Color(4);if(Ren==6) Color(2);if(Drug!=0&&T%5!=0) Color(11);if(Drug!=0&&T%5==0) Color(11);if(Ice!=0) Color(6);if(b==1) Color(8);if(Li!=0) Color(5);if(Ren==1&&Killb>0&&T%4<2) Color(13);if(Wind>0&&T%4<=1) Color(1);if(Wind>0&&T%4>=2) Color(0);if(Thun>0&&T%4<=1) Color(1);if(Thun>0&&T%4>=2) Color(6);
if(X>=17&&X<=19){Setpos(X-1,Y);cout<<"●";Setpos(X,Y-1);cout<<"━/";if(T%10<3) Setpos(X+1,Y-1),cout<<"┛╲";else if(T%10<6) Setpos(X+1,Y-1),cout<<"┦ ";else Setpos(X+1,Y-1),cout<<"╯>";if(Wind>0&&T%3==0) Setpos(X+1,Y-1),cout<<"┛╲";else if(Wind>0&&T%3==1) Setpos(X+1,Y-1),cout<<"┦ ";else if(Wind>0&&T%3==2)Setpos(X+1,Y-1),cout<<"╯>";}else if(X<=23&&X>=21){Setpos(X+1,Y);cout<<"●";Setpos(X,Y-1);cout<<"━\\";if(T%10<3) Setpos(X-1,Y-1),cout<<"┓╱";else if(T%10<6) Setpos(X-1,Y-1),cout<<"┪ ";else Setpos(X-1,Y-1),cout<<"╮>";if(Wind>0&&T%3==0) Setpos(X-1,Y-1),cout<<"┓╱";else if(Wind>0&&T%3==1) Setpos(X-1,Y-1),cout<<"┪ ";else if(Wind>0&&T%3==2)Setpos(X-1,Y-1),cout<<"╮>";}else if(X>23){Setpos(X,Y-1);cout<<"━ ●";Setpos(X-1,Y-0.5),cout<<"│>";}else if(X<17&&Upt!=0){Setpos(X,Y-1);cout<<"━ ●";Setpos(X+1,Y-1.5),cout<<"╱ >";}else if(X<17){Setpos(X,Y-1);cout<<"━ ●";Setpos(X+1,Y-0.5),cout<<"│>";}if(Thun>0){Setpos(X-2,Y-1),cout<<"▄▄";Setpos(X+2,Y-1),cout<<"▄▄";Setpos(X,Y+2),cout<<"▌";Setpos(X,Y-2.5),cout<<"▌";Setpos(X-1,Y+1),cout<<"█";Setpos(X+1,Y+1),cout<<"█";Setpos(X-1,Y-2),cout<<"█";Setpos(X+1,Y-2),cout<<"█";}if(Magne>0&&T%7<2)Setpos(X,Y),Color(5),cout<<"★";if(Wind>1){if(T%6<2)Color(1);else Color(0);if(T%8<=1){Setpos(X+1,Y-5);cout<<"---- --";Setpos(X,Y-5);cout<<"- --- -";Setpos(X-1,Y-5);cout<<"--- - --";}else if(T%8<=3){Setpos(X+1,Y-5);cout<<"------ ";Setpos(X,Y-5);cout<<" -- ---";Setpos(X-1,Y-5);cout<<"----- - ";}else if(T%8<=5){Setpos(X+1,Y-5);cout<<" ------";Setpos(X,Y-5);cout<<"-- -- -";Setpos(X-1,Y-5);cout<<"- ----- ";}else if(T%8<=7){Setpos(X+1,Y-5);cout<<"-- ----";Setpos(X,Y-5);cout<<" --- -- ";Setpos(X-1,Y-5);cout<<"- - ----";}}if(Water!=0){Color(1);if(T%20<5){Setpos(X+2,Y-3);cout<<"■";Setpos(X+1,Y-3.5);cout<<"■";Setpos(X-1,Y-2.5);cout<<"■";Setpos(X-2,Y-3);cout<<"■";}else if(T%20<10||T%20>=15){Setpos(X+2,Y-3);cout<<"■";Setpos(X,Y-4);cout<<"■■";Setpos(X-2,Y-3); cout<<"■";}else if(T%20<15){Setpos(X+2,Y-3.5);cout<<"■";Setpos(X+1,Y-3);cout<<"■";Setpos(X-1,Y-3.5);cout<<"■";Setpos(X-2,Y-3);cout<<"■";}}if(Fire!=0){if(T%6<3)Color(4);else Color(5);if(Fir>=1)Setpos(X,Y+1),cout<<"●";if(Fir>=2)Setpos(X+1,Y),cout<<"●";if(Fir>=3)Setpos(X-1,Y-1),cout<<"●";}
}
if(a==1||a==3){
if(B[b].what==1){Nor;Setpos(B[b].x,B[b].y-1);if(ti(B[b].x)==20)cout<<"======";else cout<<" ";if(B[b].life!=0){B[b].y-=B[b].vy;Setpos(B[b].x,B[b].y);if(B[b].How<=1) Color(13);else Color(4);cout<<"●";if(a==1) Pan(1,B[b].x,B[b].y,b);}}
if(B[b].what==2){Nor;Setpos(B[b].x-1,B[b].y-1);if(ti(B[b].x-1)==20)cout<<"======";else cout<<" ";Setpos(B[b].x,B[b].y-1);if(ti(B[b].x)==20)cout<<"======";else cout<<" ";Setpos(B[b].x+1,B[b].y-1);if(ti(B[b].x+1)==20)cout<<"======";else cout<<" ";if(B[b].life!=0){B[b].y-=B[b].vy;Setpos(B[b].x,B[b].y);Color(5);if(B[b].How==0){Setpos(B[b].x-1,B[b].y),cout<<"↑";Setpos(B[b].x,B[b].y-1),cout<<"←┼ →";Setpos(B[b].x+1,B[b].y),cout<<"↓";}else if(B[b].How==1){Setpos(B[b].x-1,B[b].y-1),cout<<"↖ ↗";Setpos(B[b].x,B[b].y),cout<<"╳";Setpos(B[b].x+1,B[b].y-1),cout<<"↙ ↘";} if(a==1) Pan(2,B[b].x,B[b].y,b);}}
if(B[b].what==3||B[b].what==5){Nor;Setpos(B[b].x,B[b].y);if(ti(B[b].x)==20)cout<<"==";else cout<<" ";if(B[b].life!=0){B[b].y-=B[b].vy;B[b].x-=B[b].vx;Setpos(B[b].x,B[b].y);if(B[b].How==1) Color(5);else Color(4);cout<<"◎";}}
if(B[b].what==4){Nor;Setpos(B[b].x,fmax((float)0,B[b].y-8));if(ti(B[b].x)==20){for(int i=max(0,(int)B[b].y-8);i<=B[b].y;i++)cout<<"==";}else {for(int i=max(0,(int)B[b].y-8);i<=B[b].y;i++)cout<<" ";}if(B[b].life!=0){B[b].y-=B[b].vy;Setpos(B[b].x,fmax((float)0,B[b].y-8));Color(6); for(int i=max(0,(int)B[b].y-8);i<=B[b].y;i++)cout<<"═"; if(a==1) Pan(4,B[b].x,B[b].y,b);}}
if(B[b].what==6||B[b].what==8||B[b].what==9){Nor;Setpos(B[b].x-1,B[b].y);if(ti(B[b].x)-1==20)cout<<"==";else cout<<" ";Setpos(B[b].x+1,B[b].y);if(ti(B[b].x)+1==20)cout<<"==";else cout<<" ";Setpos(B[b].x,B[b].y-1);if(ti(B[b].x)==20)cout<<"======";else cout<<" ";if(B[b].life!=0){B[b].y-=B[b].vy;B[b].x-=B[b].vx;Setpos(B[b].x,B[b].y-1);if(B[b].what==6){if(B[b].How<=1) Color(1); else Color(6);}if(B[b].what==9){if(B[b].How<=1) Color(4); else Color(8);}if(B[b].what==8)Color(5);Setpos(B[b].x-1,B[b].y);cout<<"︹";Setpos(B[b].x+1,B[b].y);cout<<"︺";Setpos(B[b].x,B[b].y-1);if(B[b].How%2==1) cout<<"〔●〕"; else cout<<"﹝○﹞"; if(a==1) Pan(6,B[b].x,B[b].y,b);}}
if(B[b].what==7){Nor;Setpos(B[b].x,B[b].y);if(B[b].How<0) for(int i=19;i>=20+B[b].How;i--) {Setpos(i,B[b].y);cout<<" ";}if(B[b].How>0) for(int i=21;i<=20+B[b].How;i++) {Setpos(i,B[b].y);cout<<" ";}if(B[b].life!=0){B[b].y-=B[b].vy;if(B[b].How<0) for(int i=19;i>=20+B[b].How;i--) {Setpos(i,B[b].y);cout<<"║"; if(a==1) Pan(7,i,B[b].y,b);}if(B[b].How>0) for(int i=21;i<=20+B[b].How;i++) {Setpos(i,B[b].y);cout<<"║"; if(a==1) Pan(7,i,B[b].y,b);}}}
if(B[b].what==10||B[b].what==11||B[b].what==12){Nor;Setpos(B[b].x,B[b].y);if(ti(B[b].x)==20)cout<<"==";else cout<<" ";if(B[b].life!=0){B[b].x-=B[b].vx;B[b].y-=B[b].vy;if(B[b].How==1){B[b].vy-=0.2;}else B[b].vx-=0.35;if(B[b].x>=25) B[b].x=25,B[b].vx*=-0.8;if(B[b].what==11&&B[b].y<=1) B[b].y=1,B[b].vy*=-1;if(B[b].what==12&&B[b].y<=1) B[b].y=1,B[b].vx=0,B[b].vy=-0.5,B[b].How=1;Setpos(B[b].x,B[b].y);if(B[b].what==11)Color(1);else if(B[b].what==12)Color(5);else Color(0);if(B[b].t%4<2)cout<<"▃";else cout<<"▍";if(a==1) Pan(B[b].what,B[b].x,B[b].y,b);}}
if(B[b].what>=13&&B[b].what<=17){Nor;Setpos(B[b].x,B[b].y);if(ti(B[b].x)==20)cout<<"====";else cout<<" ";if(B[b].life!=0){B[b].x-=B[b].vx;B[b].y-=B[b].vy;Setpos(B[b].x,B[b].y);if(B[b].what==14) Color(1);else if(B[b].what==15) Color(4);else if(B[b].what==16) Color(5);else if(B[b].what==17) Color(3);else Color(2);cout<<"●";if(B[b].what==14)cout<<"*";if(B[b].what==15)cout<<"";if(B[b].what==16)cout<<"<";if(B[b].what==17)cout<<"X";} if(a==1) Pan(1,B[b].x,B[b].y,b);}
if(B[b].what==98&&B[b].life!=0){B[b].y-=B[b].vy;Setpos(B[b].x,B[b].y);if(ti(B[b].x==20))cout<<"==";else cout<<" ";if(B[b].y<=3)B[b].life=0;}
if(B[b].what>=99){if(B[b].y<=3)B[b].life=0;if(B[b].life!=0){B[b].y-=B[b].vy;Setpos(B[b].x,B[b].y);Color(5);if(B[b].what==99)cout<<"█";if(B[b].what>=100&&B[b].what<200){if(B[b].what%5==0)cout<<"我";if(B[b].what%5==1)cout<<"是";if(B[b].what%5==2)cout<<"最";if(B[b].what%5==3)cout<<"强";if(B[b].what%5==4)cout<<"的";}if(B[b].what>=200&&B[b].what<300){if(B[b].what%6==0)cout<<"神";if(B[b].what%6==1)cout<<"级";if(B[b].what%6==2)cout<<"怪";if(B[b].what%6==3)cout<<"物";if(B[b].what%6==4)cout<<"之";if(B[b].what%6==5)cout<<"光";}if(B[b].what>=300&&B[b].what<400){if(B[b].what%8==0)cout<<"颤";if(B[b].what%8==1)cout<<"抖";if(B[b].what%8==2)cout<<"吧";if(B[b].what%8==3)cout<<"无";if(B[b].what%8==4)cout<<"能";if(B[b].what%8==5)cout<<"的";if(B[b].what%8==6)cout<<"人";if(B[b].what%8==7)cout<<"类";}if(B[b].what>=400&&B[b].what<500){if(B[b].what%8==0)cout<<"还";if(B[b].what%8==1)cout<<"不";if(B[b].what%8==2)cout<<"快";if(B[b].what%8==3)cout<<"跪";if(B[b].what%8==4)cout<<"倒";if(B[b].what%8==5)cout<<"在";if(B[b].what%8==6)cout<<"朕";if(B[b].what%8==7)cout<<"前";}if(B[b].what>=500&&B[b].what<600){if(B[b].what%8==0)cout<<"看";if(B[b].what%8==1)cout<<"懂";if(B[b].what%8==2)cout<<"这";if(B[b].what%8==3)cout<<"句";if(B[b].what%8==4)cout<<"话";if(B[b].what%8==5)cout<<"的";if(B[b].what%8==6)cout<<"是";if(B[b].what%8==7)cout<<"猪";} if(a==1) Pan(1,B[b].x,B[b].y,b);}}
if(B[b].what==-1){Nor;Setpos(B[b].x,B[b].y);if(ti(B[b].x)==20)cout<<"==";else cout<<" ";if(Boss==0) B[b].life=0;else if(((Boss==1&&abs(B[b].x-Bx1)+abs(B[b].y-By1)<1.5)||(Boss==2&&abs(B[b].x-Bx2)+abs(B[b].y-By2)<1.5)||(Boss==3&&abs(B[b].x-Bx3)+abs(B[b].y-By3)<1.5)||(B[b].t==10))&&B[b].life==1) Bblo-=8+Lv*2,B[b].life=0;if(B[b].life!=0){if(Boss==1)B[b].x=B[b].x+(Bx1-B[b].x)/(10-B[b].t)*1.0,B[b].y=B[b].y+(By1-B[b].y)/(10-B[b].t)*1.0;if(Boss==2)B[b].x=B[b].x+(Bx2-B[b].x)/(10-B[b].t)*1.0,B[b].y=B[b].y+(By2-B[b].y)/(10-B[b].t)*1.0;if(Boss==3)B[b].x=B[b].x+(Bx3-B[b].x)/(10-B[b].t)*1.0,B[b].y=B[b].y+(By3-B[b].y)/(10-B[b].t)*1.0;Setpos(B[b].x,B[b].y);Color(7);if(B[b].t%2==0) cout<<"+";else cout<<"×";}}
if(B[b].what<=-2&&B[b].what>=-9){Nor;Setpos(B[b].x-1,B[b].y);if(ti(B[b].x)-1==20)cout<<"==";else cout<<" ";Setpos(B[b].x+1,B[b].y);if(ti(B[b].x)+1==20)cout<<"==";else cout<<" ";Setpos(B[b].x,B[b].y-1);if(ti(B[b].x)==20)cout<<"======";else cout<<" ";if(B[b].life!=0){B[b].y-=B[b].vy;B[b].x-=B[b].vx;if(B[b].what<=-3&&B[b].what>=-7){if(B[b].x<=7)B[b].x=7;if(B[b].x>=28)B[b].x=28;else if(B[b].x>=B[b].a+1&&B[b].How==1)B[b].How=0;else if(B[b].x<=B[b].a-1&&B[b].How==0)B[b].How=1;if(B[b].How==1&&B[b].vx>=-1)B[b].vx-=0.2;if(B[b].How==0&&B[b].vx<=1)B[b].vx+=0.2;}if(B[b].what==-2) Color(3);if(B[b].what==-3) Color(4);if(B[b].what==-4) Color(1);if(B[b].what==-5) Color(0);if(B[b].what==-6) Color(6);if(B[b].what==-7) Color(5);if(B[b].what==-8) Color(2);if(B[b].what==-9) Color(14);if(T%7<=1&&B[b].what==-5)Color(1);else if(T%7<=1)Color(0);Setpos(B[b].x-1,B[b].y);cout<<"︹";Setpos(B[b].x+1,B[b].y);cout<<"︺";Setpos(B[b].x,B[b].y-1);if(B[b].what==-2) cout<<"﹝镖﹞";if(B[b].what==-3) cout<<"﹝火﹞";if(B[b].what==-4) cout<<"﹝水﹞";if(B[b].what==-5) cout<<"﹝风﹞";if(B[b].what==-6) cout<<"﹝雷﹞";if(B[b].what==-7) cout<<"﹝磁﹞";if(B[b].what==-8) cout<<"﹝血﹞";if(B[b].what==-9) cout<<"﹝忍﹞"; if(a==1) Pan(-2,B[b].x,B[b].y,b);}}
if(B[b].what==-11||B[b].what==-12){Nor;Setpos(B[b].x,B[b].y);if(ti(B[b].x)==20)cout<<"==";else cout<<" ";if(B[b].life!=0){if(Magne>0)B[b].How++,B[b].x=B[b].x+(X-B[b].x)/(10-B[b].How)*1.0,B[b].y=B[b].y+(Y-B[b].y)/(10-B[b].How)*1.0;B[b].y-=B[b].vy;Setpos(B[b].x,B[b].y);if(B[b].what==-10) Color(5);if(B[b].what==-11) Color(7);if(T%7<=1)Color(0);cout<<"◆"; if(a==1) Pan(-1,B[b].x,B[b].y,b);}}
if(B[b].what==-13){Nor;Setpos(B[b].x,B[b].y-0.5);if(ti(B[b].x)==20)cout<<"==";else cout<<" ";if(B[b].life!=0){if(B[b].a==13880086){if(Boss==0) B[b].life=0;else if(((Boss==1&&abs(B[b].x-Bx1)+abs(B[b].y-By1)<1.5)||(Boss==2&&abs(B[b].x-Bx2)+abs(B[b].y-By2)<1.5)||(Boss==3&&abs(B[b].x-Bx3)+abs(B[b].y-By3)<1.5)||(B[b].t==5))&&B[b].life==1) Bblo-=8+Lv*2,B[b].life=0;if(B[b].life!=0){if(Boss==1)B[b].x=B[b].x+(Bx1-B[b].x)/(5-B[b].t)*1.0,B[b].y=B[b].y+(By1-B[b].y)/(5-B[b].t)*1.0;if(Boss==2)B[b].x=B[b].x+(Bx2-B[b].x)/(5-B[b].t)*1.0,B[b].y=B[b].y+(By2-B[b].y)/(5-B[b].t)*1.0;if(Boss==3)B[b].x=B[b].x+(Bx3-B[b].x)/(5-B[b].t)*1.0,B[b].y=B[b].y+(By3-B[b].y)/(5-B[b].t)*1.0;}}else{if(B[B[b].a].life==0) B[b].life=0;else if((abs(B[b].x-B[B[b].a].x)+abs(B[b].y-B[B[b].a].y)<1.5||(B[b].t==5))&&B[b].life==1) Exp+=2,B[B[b].a].life=B[b].life=0;if(B[b].life!=0){B[b].x=B[b].x+(B[B[b].a].x-B[b].x)/(5-B[b].t)*1.0,B[b].y=B[b].y+(B[B[b].a].y-B[b].y)/(5-B[b].t)*1.0;}}Setpos(B[b].x,B[b].y-0.5);if(T%6<3)Color(5);else Color(4);cout<<"●";}}
}if(br<bl) {br=-1,bl=0;memset(B,0,sizeof(B));}Color(0);
}
void Move(){
if(X<3) X=3;if(Y<1) Y=1,Vy=0;if(Y>29) Y=29,Vy=0;
if(Ice!=0){X-=Vx/2.0;Y+=Vy/2.0;Vy=fmax(Vy-0.025,(float)0);if(T%6==0&&Up==0&&Y<Ding) Y+=0.25;if(T%6==3&&Up==0&&Y>=Ding) Y-=0.25;if(Up==0&&Y<=Ding-1.25) Vy=0.25;if(Up==0&&Y>=Ding+1.25&&Wind==0) Vy=-0.25;if(Up==0&&Down==0&&Vx>0&&X<=18) Up=0,Down=0,Vx=0,Vy=0,X=18,Setpos(20,Y-2.5),cout<<"==========";else if(Down==2&&X<=22) Up=0,Down=1,Vx=0,Vy=0,X=22,Setpos(20,Y-2.5),cout<<"==========";else if(Up==0&&Down==1&&Vx<0&&X>=22) Up=0,Down=1,Vx=0,Vy=0,X=22,Setpos(20,Y-2.5),cout<<"==========";else if(Up>0&&Down==0&&X>18) Up=0,Vx=0,Vy=0,X=18,Setpos(20,Y-2.5),cout<<"==========";else if(Down==2) Vx+=0.175;else if(Up>0&&Upt==0) Vx-=0.175;else if(Up>0&&Upt>0) {Vx=fmax(Vx-0.125,(float)0);if(Upt==1&&T%2==0)Map(-1,0);if(T%2==0)Upt--;}}
else{X-=Vx;Y+=Vy;Vy=fmax(Vy-0.05,(float)0);if(Wind==0){if(T%6==0&&Up==0&&Y<Ding) Y+=0.5;if(T%6==3&&Up==0&&Y>=Ding) Y-=0.5;}else{if(T%2==0&&Up==0&&Y<Ding) Y+=0.5;if(T%2==1&&Up==0&&Y>=Ding) Y-=0.5;}if(Up==0&&Y<=Ding-1.25) Vy=0.5;if(Up==0&&Y>=Ding+1.25&&Wind==0) Vy=-0.5;if(Up==0&&Down==0&&Vx>0&&X<=18) Up=0,Down=0,Vx=0,Vy=0,X=18,Setpos(20,Y-2.5),cout<<"==========";else if(Down==2&&X<=22) Up=0,Down=1,Vx=0,Vy=0,X=22,Setpos(20,Y-2.5),cout<<"==========";else if(Up==0&&Down==1&&Vx<0&&X>=22) Up=0,Down=1,Vx=0,Vy=0,X=22,Setpos(20,Y-2.5),cout<<"==========";else if(Up>0&&Down==0&&X>18) Up=0,Vx=0,Vy=0,X=18,Setpos(20,Y-2.5),cout<<"==========";else if(Down==2) Vx+=0.35;else if(Up>0&&Upt==0) Vx-=0.35;else if(Up>0&&Upt>0) {Vx=fmax(Vx-0.25,(float)0);if(Upt==1)Map(-1,0); Upt--;}}
for(int i=bl;i<=br;i++){
if(B[i].what<98)if(B[i].x-B[i].vx<=5||B[i].x-B[i].vx>=30||B[i].y-B[i].vy<=0||B[i].y-B[i].vy>=30){B[i].life=0;Map(1,i);}
for(int j=0;j<20;j++)if(B[i].what>0&&B[i].life!=0&&abs(B[i].x-I[j][0])<2&&B[i].y-I[j][1]<=2){Setpos(I[j][0],I[j][1]);if(I[j][0]==20) cout<<"===";else cout<<" ";I[j][0]=I[j][1]=-1;B[i].life=0;Exp+=2;}
if(B[i].t>=100)B[i].life=0;if(B[i].life==0&&i==bl) bl++;
Map(1,i);if(B[i].life==0) continue;
else{B[i].t++;
if(B[i].what==1){if(B[i].y<=25&&B[i].How==0) B[i].vy=0,B[i].How=1;if(B[i].t==30) B[i].y+=1.5,B[i].How=2;if(B[i].t==35) B[i].vy=1.5,B[i].How=3;}
if(B[i].what==2){if(B[i].t%3==0) B[i].How=!B[i].How;}
if(B[i].what==3||B[i].what==5){if(B[i].what==3&&B[i].y<=20) B[i].vy=0;if(B[i].what==5&&B[i].y<=21) B[i].vy=0;if(B[i].t>30&&B[i].t%2==0) B[i].How=!B[i].How;if(B[i].what==5&&B[i].t<=30&&B[i].x<X) B[i].vx=-0.2;else if(B[i].what==5&&B[i].t<=70&&B[i].x>X) B[i].vx=0.2;else B[i].vx=0;if(B[i].t==45){B[i].life=0;br++;B[br].what=4;B[br].x=B[i].x;B[br].y=32;B[br].vy=3;B[br].life=1;}}
if(B[i].what==6||B[i].what==8||B[i].what==9){if(B[i].vx<0.25&&B[i].vy<0.25&&B[i].t>=50){B[i].life=0;if(B[i].life==0&&i==bl) bl++;Map(1,i);break;}if(B[i].t%5==0) B[i].How=rand()%4;if(B[i].what==9){if(B[i].t==7){X9:float xx=(rand()%41)/40.0,yy=(rand()%41)/40.0;if(xx<=0.5&&yy<=0.5) goto X9;for(int j=1;j<=4;j++){br++,B[br].what=9;B[br].t=11;B[br].x=B[i].x,B[br].y=B[i].y,B[br].vx=xx,B[br].vy=yy;if(j%2==0)swap(B[br].vx,B[br].vy),B[br].vy*=-1;if(j<=2)B[br].vx*=-1,B[br].vy*=-1;B[br].life=1;}B[i].life=0;}}if(B[i].what==8){if(B[i].x>X&&B[i].vx<1.2) B[i].vx+=fmax((float)0,0.2-B[i].t/25);if(B[i].x<X&&B[i].vx>-1.2) B[i].vx-=fmax((float)0,0.2-B[i].t/25);if(B[i].y>Y&&B[i].vy<1.2) B[i].vy+=fmax((float)0,0.2-B[i].t/25);if(B[i].y<Y&&B[i].vy>-1.2) B[i].vy-=fmax((float)0,0.2-B[i].t/25);}}
if(B[i].what>=13&&B[i].what<=15&&B[i].How!=0){if(B[i].x==B[i].How)B[i].vx=0,B[i].How=0;}
if(B[i].what==16){if(B[i].x<X&&B[i].vx>=-1) B[i].vx-=0.2;else if(B[i].x>X&&B[i].vx<=1) B[i].vx+=0.2;}
}
if(B[i].life==1&&B[i].a==0&&B[i].what>0){if(B[i].y>Y&&abs(B[i].x-X)<=3&&((B[i].x-X)*(B[i].x-X)+(B[i].y-Y)*(B[i].y-Y))<Dis) Dis=(B[i].x-X)*(B[i].x-X)+(B[i].y-Y)*(B[i].y-Y),Disb=i;else if(((B[i].x-X)*(B[i].x-X)+(B[i].y-Y)*(B[i].y-Y))<Dis1) Dis1=(B[i].x-X)*(B[i].x-X)+(B[i].y-Y)*(B[i].y-Y),Disb1=i;}
}
}
void Guai(int R,int r){
if(R==-1){br++;B[br].what=-1;B[br].x=X+rand()%3-1;B[br].y=Y+rand()%3-1;B[br].life=1;}
if(R<=-2&&R>=-11){br++;B[br].what=R;B[br].x=B[br].a=r;B[br].y=29;if(R<=-3&&R>=-7)B[br].vx=-1;B[br].vy=1;B[br].life=1;}
if(R==0){br++;B[br].what=1;B[br].x=r;B[br].y=29;B[br].vy=1;B[br].life=1;}
if(R==1){br++;B[br].what=2;B[br].x=r;B[br].y=29;B[br].vy=1;B[br].life=1;}
if(R==2||R==3){br++;B[br].what=2*R-1;B[br].x=r;B[br].y=29;B[br].vy=1;B[br].life=1;}
if(R==4){br++;B[br].what=6;if(r<5)r=5;if(r>30)r=30;B[br].x=r;if(r==11||r==25) B[br].y=29-(rand()%20);else B[br].y=29;X4:B[br].vx=(rand()%21-10)/30.0;B[br].vy=(rand()%25)/30.0;if(B[br].vx<=0.8&&B[br].vy<=0.8)goto X4;int rx=rand()%50;if(rx==0) B[br].vx=0;B[br].life=1;}
if(R==5){br++;B[br].How=r;B[br].what=7;if(B[br].How<0) B[br].x=19;if(B[br].How>0) B[br].x=21;B[br].y=29;B[br].vy=1;B[br].life=1;}
}
void CpGuai(int R,float x,float y,float xx,float yy){
if(R==4){br++;B[br].what=6;B[br].x=x;B[br].y=y;B[br].vx=xx;B[br].vy=yy;B[br].life=1;}
if(R==6||R==7||R==8){br++;B[br].what=4+R;B[br].x=x;B[br].y=y;B[br].vx=xx;B[br].vy=yy;B[br].life=1;}
}
void MesGuai(int a,int rr){
int R=rand()%rr,r=-10086;
if(R==0){if(a==1) r=(5+rand()%8)*2;if(a<=3&&a!=1) r=10+rand()%16;if(a==4) r=rand()%75-20;if(a==5) r=2+rand()%4;if(r!=-10086) Guai(a,r);}
}
void NorGuai(int a,int b){
if(a==1) {if(b==1||b==41) Guai(0,15),Guai(0,17),Guai(0,19);if(b==21||b==61) Guai(0,21),Guai(0,23),Guai(0,25);if(b==81) Guai(0,11),Guai(0,13),Guai(0,15),Guai(0,17),Guai(0,19);if(b==101||b==141) Guai(0,17),Guai(0,19),Guai(0,21),Guai(0,23),Guai(0,25);if(b==121) Guai(0,15),Guai(0,17),Guai(0,19),Guai(0,21),Guai(0,23);if(b>=160&&b<=260&&b%10==0) Guai(0,b/10-1);if(b>=270&&b<=370&&b%10==0) Guai(0,52-b/10);if(b>=460&&b<=560&&b%10==0) Guai(0,b/10-37),Guai(0,b/10-36),Guai(0,b/10-35);if(b>=570&&b<=670&&b%10==0) Guai(0,78-b/10),Guai(0,77-b/10),Guai(0,76-b/10);if(b>=760&&b<=960&&b%10==0) Guai(0,b/10-66),Guai(0,b/10-65),Guai(0,103-b/10),Guai(0,104-b/10);if(b>=1000&&b<=1300) MesGuai(0,30-b/50);}
if(a==2) {if(b<=200&&b%30==1) {int r=rand()%4;if(r==1) r=0;for(int i=0;i<4;i++) if(i!=r) Guai(1,i*4+9);}if(b>200&&b<=220&&b%5==1) Guai(1,18);if(b>220&&b<=300&&b%7==1) Guai(1,b/5-26);if(b>350&&b<=370&&b%5==1) Guai(1,22);if(b>370&&b<=450&&b%7==1) Guai(1,96-b/5);if(b==461||b==501||b==541) Guai(1,13),Guai(1,17),Guai(1,21);if(b==481||b==521||b==561) Guai(1,17),Guai(1,21),Guai(1,25);if(b>=561&&b<=861&&b%20==1) Guai(1,b/40+5);if(b>=561&&b<=861&&b%20==11) Guai(1,35-b/40);if(b>=801&&b<=961&&b%15==1) Guai(1,20);if(b>=1000&&b<=1300) MesGuai(1,30-b/50);}
if(a==3) {if(b==1||b==61) Guai(3,15),Guai(2,17),Guai(2,19);if(b==31||b==91) Guai(2,21),Guai(2,23),Guai(3,25);if(b>=120&&b<=220&&b%10==0) Guai(2,b/10+3);if(b>=240&&b<=340&&b%10==0) Guai(2,49-b/10);if(b>=360&&b<=460&&b%20==0) Guai(2,b/10-21),Guai(2,61-b/10);if(b>=480&&b<=580&&b%20==0) Guai(3,b/10-33),Guai(3,73-b/10);if(b>=600&&b<750&&b%30==0) {for(int i=0;i<5;i++) Guai(3,i*3+10);}if(b>=750&&b<830&&b%10==0) if(b<=200&&b%40==1) Guai(2,X);if(b>=830&&b<910&&b%20==0) Guai(2,X);if(b>=910&&b<980&&b%10==0) Guai(2,X);if(b>=1000&&b<=1300) MesGuai(rand()%2+2,40-b/50);}
if(a==4) {if(b==1) CpGuai(4,10,29,-0.4,0.7),CpGuai(4,14,29,-0.2,0.7),CpGuai(4,21,29,0,0.65);if(b==41) CpGuai(4,10,29,-0.2,0.7),CpGuai(4,14,29,-0.1,0.7),CpGuai(4,18,29,0,0.65);if(b==81) CpGuai(4,5,20,-0.4,0.35),CpGuai(4,10,29,-0.4,0.7),CpGuai(4,14,29,-0.2,0.7),CpGuai(4,30,20,0.25,0.4),CpGuai(4,21,29,0,0.65);if(b==121) CpGuai(4,5,20,-0.2,0.35),CpGuai(4,10,29,-0.2,0.7),CpGuai(4,14,29,-0.1,0.7),CpGuai(4,30,20,0.4,0.4),CpGuai(4,18,29,0,0.65);if(b==161) CpGuai(4,10,29,-0.4,0.7),CpGuai(4,14,29,-0.2,0.7),CpGuai(4,21,29,0,0.6),CpGuai(4,10,29,-0.2,0.7),CpGuai(4,14,29,-0.1,0.7),CpGuai(4,18,29,0,0.65);if(b>=200&&b<=500&&b%40==1) {float r=0,rr;for(int i=1;i<=5;i++){X5:rr=0.7+(rand()%5)/10.0;if(rr==r)goto X5;r=rr;CpGuai(4,i*3+7,29,0,0.5+(rand()%50)/80.0);}}if(b>540&&b<=565&&b%5==1) CpGuai(4,5,8,-2,0.2);if(b>590&&b<=615&&b%5==1) CpGuai(4,30,8,1.5,0.2);if(b>640&&b<=665&&b%5==1) CpGuai(4,5,8,-1.5,0.3);if(b>690&&b<=715&&b%5==1) CpGuai(4,30,8,2,0.3);if(b>=750&&b<=950&&b%20==1) {float r=0,rr;for(int i=1;i<=3;i++){X6:rr=0.7+(rand()%5)/10.0;if(rr==r)goto X6;r=rr;CpGuai(4,i*5+7+(rand()%3),29,0,0.5+(rand()%50)/200.0);}}if(b>=1000&&b<=1300) MesGuai(4,5);}
}
void RandGood(){
if(Biao>0){Biao--;Guai(-1,0);}
if(Gd[1]==0){Gd[1]=rand()%1000+1;if(Win==7)Gd[1]=10086;Gd[3]=rand()%16+8;}
else if(Gd[1]<=5){Guai(-2-Gd[1],Gd[3]);memset(Gd,0,sizeof(Gd));}
else if(Gd[1]>=20&&Gd[1]<27){Guai(-8,Gd[3]);memset(Gd,0,sizeof(Gd));}
else if(Gd[1]>=30&&Gd[1]<37){Guai(-9,Gd[3]);memset(Gd,0,sizeof(Gd));}
else if(Gd[1]>=40&&Gd[1]<70){Gd[2]++;if(Gd[2]%2==1)Guai(-10,Gd[3]);if(Gd[2]>=9)memset(Gd,0,sizeof(Gd));}
else if(Gd[1]>=70&&Gd[1]<100){Gd[2]++;if(Gd[2]%2==1)Guai(-11,Gd[3]);if(Gd[2]>=9)memset(Gd,0,sizeof(Gd));}
else if(Boss!=0&&Gd[1]>=450&&Gd[1]<=500){Guai(-2,Gd[3]);memset(Gd,0,sizeof(Gd));}
else Gd[1]=0;
for(int i=0;i<20;i++){if(I[i][0]==-1) continue;Setpos(I[i][0],I[i][1]);Color(0);if(I[i][0]==20) cout<<"===";else cout<<" ";I[i][1]++;if(I[i][0]>=28||I[i][0]<=0||I[i][1]>=29) I[i][0]=I[i][1]=-1;else Color(1),Setpos(I[i][0],I[i][1]),cout<<"■";Color(0);}
}
void Panboss(int bx,int by){
float Nox[4],Noy[4];Nox[0]=X,Noy[0]=Y;
if(Down==1&&X==22) Nox[1]=X+1,Noy[1]=Y-0.5,Nox[2]=X-1,Noy[2]=Y-0.5;
else if(Down==2) Nox[1]=X+1,Noy[1]=Y-0.5,Nox[2]=-10,Noy[2]=-10;
else if(Down==1||X<18) Nox[1]=X-1,Noy[1]=Y-0.5,Nox[2]=-10,Noy[2]=-10;
else Nox[1]=X+1,Noy[1]=Y-0.5,Nox[2]=X-1,Noy[2]=Y-0.5;
for(int i=0;i<3;i++){if((Boss==1||Boss==6)&&Wind==0&&Thun==0&&abs(Nox[i]-bx)<1&&abs(Noy[i]-by)<1&&Bgo1[4]==0) Blo-=20,Bgo1[4]=1,Killb=20,Kill=1;if((Boss==2||Boss==6)&&Wind==0&&Thun==0&&abs(Nox[i]-bx)<1&&abs(Noy[i]-by)<1&&Bgo2[8]==0) Blo-=20,Bgo2[8]=1,Killb=20,Kill=1;}
}
void Boss1(){
for(int j=0;j<20;j++)if(abs(Bx1-I[j][0])<2&&By1-I[j][1]<=2){Setpos(I[j][0],I[j][1]);if(I[j][0]==20) cout<<"===";else cout<<" ";I[j][0]=I[j][1]=-1;Bblo-=8+Lv*2;Exp+=2;}
if(Bbr==Bbl&&Bbr!=0) Bbr=Bbl=0;
for(int i=1;i<=3+(Bbl-Bbr)/5;i++)if(Bbr<Bbl){Setpos(Bway[Bbr][0],Bway[Bbr][1]);if(Bway[Bbr][0]==20) cout<<"==";else cout<<" ";Bbr++;}
if(Bwhat1==5){int bx,by;Color(5);for(int i=0;i<10;i++){bx=Bx1-i*Bvx1/10.0;by=By1-i*Bvy1/10.0;Setpos(bx,by),cout<<"█";Bbl++;Bway[Bbl][0]=bx;Bway[Bbl][1]=by;}Color(0);}
Bx1-=Bvx1;By1-=Bvy1;
if(Bwhat1==0){X2:Bwhat1=rand()%7;if(Bwhat1==2||Bwhat1==3){if(By1<=10||By1>25) goto X2;}if(Bwhat1==4){if(By1<=15||Bx1<20) goto X2;Bgo1[2]=Bx1;Bgo1[3]=By1-1;}if(Bwhat1==5) {X0:Bgo1[3]=rand()%4+1;Bvx1=(rand()%101)/20.0;Bvy1=(rand()%101)/20.0;if(Bgo1[3]<=2) Bvx1*=-1;if(Bgo1[3]%2==1) Bvy1*=-1;if(abs(Bvx1)+abs(Bvy1)<=3||Out1)goto X0;}if(Bwhat1==6){if(By1<=17||By1>25) goto X2;}}
if(Bwhat1==1){Bgo1[1]++,Bgo1[2]++;int R=rand()%(5-Bgo1[1]),r=rand()%(10-Bgo1[2]);if(Out1) R=0;if(R==0) {int vx=Bvx1,vy=Bvy1;Bgo1[1]=0;Bvx1=(rand()%101-20)/50.0;Bvy1=(rand()%101-20)/50.0;if(Bgo1[3]<=2) Bvx1*=-1;if(Bgo1[3]%2==1) Bvy1*=-1;if(Out1) r=0;} if(r==0) Chang1 }
if(Bwhat1==2){Bgo1[1]++;if(Bgo1[1]>6){Bvy1=-0.3;br++;B[br].x=Bx1,B[br].y=By1-1;B[br].what=6;X3:B[br].vx=(rand()%21-10)/40.0;B[br].vy=(rand()%25)/30.0;if(B[br].vx<=0.8&&B[br].vy<=0.8)goto X3;int rx=rand()%50;if(rx==0) B[br].vx=0;B[br].life=1;}if(Bgo1[1]>8) Chang1}
if(Bwhat1==3){Bgo1[1]++;if(Bgo1[1]>6&&Bgo1[1]%3==0){Bvy1=-0.3;br++;B[br].x=Bx1,B[br].y=By1-1;B[br].what=8;B[br].life=1;}if(Bgo1[1]>15) Chang1}
if(Bwhat1==4){Bgo1[1]++;if(Bgo1[1]<=8){Setpos(Bgo1[2],Bgo1[3]);if(Bgo1[1]==1)cout<<" ";else if(Bgo1[1]>1&&Bgo1[2]==20) cout<<"==";else cout<<" ";Bgo1[2]--;Setpos(Bgo1[2],Bgo1[3]);int r=rand()%4;if(r%2==0) Color(6);else Color(9);if(r<2) cout<<") ";else cout<<"】";Color(0);}if(Bgo1[1]==6) Bgo1[5]=X,Bgo1[6]=Y;if(Bgo1[1]==11){Map(0,(bool)Kill);Setpos(Bgo1[5],Bgo1[6]+1),cout<<" ";Setpos(Bgo1[5],Bgo1[6]-1),cout<<" ";Setpos(Bgo1[5]+1,Bgo1[6]),cout<<" ";Setpos(Bgo1[5]-1,Bgo1[6]),cout<<" ";int bx,by,bvx=Bgo1[2]-Bgo1[5],bvy=Bgo1[3]-Bgo1[6];Color(6);int i=0;while(1){bx=Bgo1[2]-i*bvx/30.0;by=Bgo1[3]-i*bvy/30.0;if(bx<=5||bx>=30||by<0||by>=29) break;Panboss(bx,by);Setpos(bx,by),cout<<"█";Bbl++;Bway[Bbl][0]=bx;Bway[Bbl][1]=by;i++;}Color(0);Map(-1,0);Chang1}}
if(Bwhat1==5){Bgo1[1]++,Bgo1[2]++;int R=rand()%(5-Bgo1[1]),r=rand()%(10-Bgo1[2]);if(Out1) R=0;if(R==0) {int vx=Bvx1,vy=Bvy1;Bgo1[1]=0;X1:Bvx1=(rand()%101-20)/20.0;Bvy1=(rand()%101-20)/20.0;if(Bgo1[3]<=2) Bvx1*=-1;if(Bgo1[3]%2==1) Bvy1*=-1;if(abs(Bvx1)+abs(Bvy1)<=3||abs(Bvx1-vx)<=1||abs(Bvy1-vy)<=1)goto X1;if(Out1) r=0;} if(r==0) Chang1 }
if(Bwhat1==6){Bgo1[1]++;if(Bgo1[1]>6&&Bgo1[1]%10==0){By1-=1;br++;B[br].x=Bx1,B[br].y=By1-1;B[br].what=9;X30:B[br].vy=1;B[br].life=1;}if(Bgo1[1]>31) Chang1}
}
void Boss2(){
for(int j=0;j<20;j++)if(abs(Bx2-I[j][0])<2&&By2-I[j][1]<=2){Setpos(I[j][0],I[j][1]);if(I[j][0]==20) cout<<"===";else cout<<" ";I[j][0]=I[j][1]=-1;Bblo-=8+Lv*2;Exp+=2;}
if(Bbr==Bbl&&Bbr!=0) Bbr=Bbl=0;
for(int i=1;i<=3+(Bbl-Bbr)/5;i++)if(Bbr<Bbl){Setpos(Bway[Bbr][0],Bway[Bbr][1]);if(Bway[Bbr][0]==20) cout<<"==";else cout<<" ";Bbr++;}
Bx2-=Bvx2;By2-=Bvy2;
if(Bwhat2==0){X21:Bwhat2=rand()%7;if(Bwhat2==2){X31:for(int i=1;i<=3;i++){Bgo2[i*2+1]=rand()%28+1,Bgo2[i*2]=rand()%25+5;if((abs(Bgo2[i*2]-Bx2)<=2&&abs(Bgo2[i*2+1]-By2)<=2)||(abs(Bgo2[i*2]-X)<=2&&abs(Bgo2[i*2+1]-Y)<=2))goto X31;}if(Bgo2[2]==Bgo2[4]||Bgo2[2]==Bgo2[6]||Bgo2[6]==Bgo2[4]||Bgo2[5]==Bgo2[3]||Bgo2[3]==Bgo2[7]||Bgo2[5]==Bgo2[7]) goto X31;}if(Bwhat2==3){Bgo2[2]=rand()%2;}if(Bwhat2==4||Bwhat2==5||Bwhat2==6){Bvy2=-1.5;Bvx2=-0.5;}}
if(Bwhat2==1){Bgo2[1]++,Bgo2[2]++;int R=rand()%(5-Bgo2[1]),r=rand()%(30-Bgo2[2]);if(Out2) R=0;if(R==0) {int vx=Bvx2,vy=Bvy2;Bgo2[1]=0;Bvx2=(rand()%101-20)/50.0;Bvy2=(rand()%101-20)/50.0;if(Bgo2[3]<=2) Bvx2*=-1;if(Bgo2[3]%2==1) Bvy2*=-1;if(Out2) r=0;} if(r==0) Chang2 }
if(Bwhat2==2){Bgo2[1]++;float bx,by,bvx,bvy;if(Bgo2[1]<21){for(int i=1;i<=3;i++){bvx=Bgo2[i*2]-Bx2,bvy=Bgo2[i*2+1]-By2;if(Bgo2[1]<=10){Setpos(Bx2+(Bgo2[1]-1)*bvx/10.0,By2+(Bgo2[1]-1)*bvy/10.0);if(abs(Bx2+(Bgo2[1]-1)*bvx/10.0-20)<0.5)cout<<"==";else cout<<" ";bx=Bx2+Bgo2[1]*bvx/10.0;by=By2+Bgo2[1]*bvy/10.0;Setpos(bx,by);}else Setpos(Bgo2[i*2],Bgo2[i*2+1]);int r=rand()%4;if(r%2==0) Color(3);else Color(10);if(r<=1) cout<<"×";else cout<<"+";Color(0);}}if(Bgo2[1]==21){Map(0,(bool)Kill);Color(3);int j=0;for(int j=0;j<=30;j++)for(int i=1;i<=3;i++)for(int k=1;k<=4;k++){if(k==1) bvx=j,bvy=0;if(k==2) bvx=-j,bvy=0;if(k==3) bvx=0,bvy=j;if(k==4) bvx=0,bvy=-j;bx=Bgo2[i*2]+bvx,by=Bgo2[i*2+1]+bvy;if(bx<=5||bx>=30||by<0||by>=30) {continue;}Panboss(bx,by);Setpos(bx,by),cout<<"█";Bbl++;Bway[Bbl][0]=bx;Bway[Bbl][1]=by;}Color(0);Map(-1,0);Chang2}}
if(Bwhat2==3){Bgo2[1]++;if(Bgo2[1]<=18){if(Bgo2[3]==0) Setpos(Bgo2[4]-3,Bgo2[5]),cout<<" ",Setpos(Bgo2[4]+3,Bgo2[5]),cout<<" ",Color(0),Setpos(20,Bgo2[5]),cout<<"==";if(Bgo2[3]==1) Setpos(Bgo2[4],Bgo2[5]-3.5),cout<<" ",Setpos(Bgo2[4],Bgo2[5]+2.5),cout<<" ",Color(0),Setpos(20,Bgo2[5]+2.5),cout<<"====",Setpos(20,Bgo2[5]-3.5),cout<<"====";if(Bgo2[1]%4==0)Bgo2[3]=!Bgo2[3];if(Bgo2[1]%6<3)Color(3);else Color(5);if(Bgo2[3]==0) Setpos(X-3,Y),cout<<"▼",Setpos(X+3,Y),cout<<"▲",Bgo2[4]=(int)(X+0.5),Bgo2[5]=(int)(Y+0.5);if(Bgo2[3]==1) Setpos(X,Y-3),cout<<" ",Setpos(X,Y+3),cout<<" ",Bgo2[4]=(int)(X+0.5),Bgo2[5]=(int)(Y+0.5);Color(0);}if(Bgo2[1]==18){if(Bgo2[3]==0) Setpos(Bgo2[4]-3,Bgo2[5]),cout<<" ",Setpos(Bgo2[4]+3,Bgo2[5]),cout<<" ",Color(0),Setpos(20,Bgo2[5]),cout<<"==";if(Bgo2[3]==1) Setpos(Bgo2[4],Bgo2[5]-3.5),cout<<" ",Setpos(Bgo2[4],Bgo2[5]+2.5),cout<<" ",Color(0),Setpos(20,Bgo2[5]+2.5),cout<<"====",Setpos(20,Bgo2[5]-3.5),cout<<"====";}if(Bgo2[1]>18&&Bgo2[1]<=25){Bgo2[3]=Bgo2[2];if(Bgo2[3]==0) Setpos(Bgo2[4]-3,Bgo2[5]),cout<<" ",Setpos(Bgo2[4]+3,Bgo2[5]),cout<<" ",Color(0),Setpos(20,Bgo2[5]),cout<<"==";if(Bgo2[3]==1) Setpos(Bgo2[4],Bgo2[5]-3.5),cout<<" ",Setpos(Bgo2[4],Bgo2[5]+2.5),cout<<" ",Color(0),Setpos(20,Bgo2[5]+2.5),cout<<"====",Setpos(20,Bgo2[5]-3.5),cout<<"====";if(Bgo2[1]%4<2)Color(3);else Color(5);if(Bgo2[3]==0) Setpos(Bgo2[4]-3,Bgo2[5]),cout<<"▼",Setpos(Bgo2[4]+3,Bgo2[5]),cout<<"▲";if(Bgo2[3]==1) Setpos(Bgo2[4],Bgo2[5]-3),cout<<" ",Setpos(Bgo2[4],Bgo2[5]+3),cout<<" ";Color(0);}if(Bgo2[1]==25){if(Bgo2[2]==0){Color(3);for(int i=4;i<=29;i++){Setpos(i,Bgo2[5]),cout<<"█";Bbl++;Panboss(i,Bgo2[5]);Bway[Bbl][0]=i;Bway[Bbl][1]=Bgo2[5];}}if(Bgo2[2]==1){Color(3);for(int i=0;i<=28;i++){Setpos(Bgo2[4],i),cout<<"█";Bbl++;Panboss(Bgo2[4],i);Bway[Bbl][0]=Bgo2[4];Bway[Bbl][1]=i;}}Chang2}}
if(Bwhat2==4||Bwhat2==5||Bwhat2==6){Bgo2[1]++;if(By2>27)Bvy2=0;if(Bx2>23)Bvx2=0;if(Bgo2[1]>13&&Bgo2[1]%3==0){float t=By2-Y,g=0.35;if(Boss==6) t/=2.0;CpGuai(Bwhat2+2,Bx2,By2,(Bx2-X)/t*1.0+(t-1)*g/2.0,1);}if(Bgo2[1]>20) Chang2}
}
void Boss3(){
#define Bean br++;B[br].what=13;B[br].x=Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].life=1;
for(int j=0;j<20;j++)if(abs(Bx3-I[j][0])<2&&By3-I[j][1]<=2){Setpos(I[j][0],I[j][1]);if(I[j][0]==20) cout<<"===";else cout<<" ";I[j][0]=I[j][1]=-1;Bblo-=8+Lv*2;Exp+=2;}
Bx3-=Bvx3;By3-=Bvy3;
if(Bwhat3<=8){if(Bx3>X&&Bvx3<1.5) Bvx3+=0.3;if(Bx3<X&&Bvx3>-1.5) Bvx3-=0.3;}
if(Bwhat3==0){X22:Bwhat3=rand()%12;if(Bwhat3==11&&abs(Bx3-20)<=1)goto X22;if(Bwhat3==11)Bgo3[2]=rand()%5;}
if(Bwhat3==1){Bgo3[1]++;if(Bgo3[1]==6){br++;B[br].what=13;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].vx=1;B[br].How=(int)Bx3-4;B[br].life=1;br++;B[br].what=13;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].vx=-1;B[br].How=(int)Bx3+2;B[br].life=1;br++;B[br].what=13;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].life=1;Chang3}}
if(Bwhat3>=2&&Bwhat3<=6){Bgo3[1]++;if(Bgo3[1]==6){br++;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].what=11+Bwhat3;B[br].vy=0.5+(rand()%100)/80.0;if(Bwhat3==5)B[br].vy=B[br].vy*3/4.0;B[br].life=1;Chang3}}
if(Bwhat3==7){Bgo3[1]++;if(Bgo3[1]==6){br++;B[br].what=14;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].vx=1;B[br].How=(int)Bx3-4;B[br].life=1;br++;B[br].what=14;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].vx=-1;B[br].How=(int)Bx3+2;B[br].life=1;br++;B[br].what=14;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].life=1;Chang3}}
if(Bwhat3==8){Bgo3[1]++;if(Bgo3[1]==6){br++;B[br].what=15;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].vx=1;B[br].How=(int)Bx3-4;B[br].life=1;br++;B[br].what=15;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].vx=-1;B[br].How=(int)Bx3+2;B[br].life=1;br++;B[br].what=15;B[br].x=(int)Bx3-1,B[br].y=By3-1;B[br].vy=1;B[br].life=1;Chang3}}
if(Bwhat3==9){Bvx3=0;Bgo3[1]++;if(Bgo3[1]==6||Bgo3[1]==8){Bean}if(Bgo3[1]>=8)Chang3}
if(Bwhat3==10){Bvx3=0;Bgo3[1]++;if(Bgo3[1]==6||Bgo3[1]==8||Bgo3[1]==10||Bgo3[1]==12){Bean}if(Bgo3[1]>=12)Chang3}
if(Bwhat3==11){Bvx3=0;Bgo3[1]++;if(Bgo3[1]>=8)for(int i=1;i<=4;i++){br++;B[br].what=80+100*Bgo3[2]+Bgo3[1]*4+i;B[br].x=Bx3-1,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;br++;B[br].what=99;B[br].x=Bx3,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;br++;B[br].what=99;B[br].x=Bx3-2,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;}if(Bgo3[1]>=20){for(int i=1;i<=4;i++){br++;B[br].what=98;B[br].x=Bx3-1,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;br++;B[br].what=98;B[br].x=Bx3,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;br++;B[br].what=98;B[br].x=Bx3-2,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;}Chang3}}
}
void Ball(int ball){
if(ball==1){if(Fir<3&&T%8==0) Fir++;if(Fir>0){br++;B[br].what=-13;B[br].x=X;B[br].y=Y+rand()%3-1;B[br].life=1;if(Dis<=30) B[br].a=Disb,B[Disb].a=1,Fir--;else if(Boss!=0) B[br].a=13880086,Fir--;else if(Dis!=13880087) B[br].a=Disb,B[Disb].a=1,Fir--;else if(Dis1!=13880087) B[br].a=Disb1,B[Disb1].a=1,Fir--;else B[br].life=0;Dis=Dis1=13880087;}}
if(ball==2){if(T%4==0)ib=(ib+1)%20,I[ib][1]=Y-2;if(T%16==0)I[ib][0]=X;if(T%16==4)I[ib][0]=X-1;if(T%16==8)I[ib][0]=X+1;if(T%16==12)I[ib][0]=X-2;if(T%12==9)I[ib][0]=X+2;if(Water==1){for(int i=X-6;i<=X+6;i++)ib=(ib+1)%20,I[ib][0]=i,I[ib][1]=Y-2-0.5*abs(i-X);}}
if(ball==3){if(Wind>5){if(Y<Ding-1)Vy=5;else Vy=0;if(Up>=1) Vx=-5;if(Down==2) Vx=5;}if(Wind<5){if(Y>Ding-1)Vy=-5;else Vy=0;if(Up>=1) Vx=-5;if(Down==2) Vx=5;}if(Wind==5){if(Boss==2) Ding=12.25;else Ding=6.25;if(Boss!=0) Bblo-=16+Lv*4;if(Boss==1) Chang1 if(Boss==2) Chang2 if(Boss==3) Chang3 system("color 3F");Sleep(20);system("color 6F");Sleep(10);system("color 0F");system("cls");for(int i=bl;i<=br;i++)if(B[i].what>0)B[i].life=0;Setpos(20,0);for(int i=1;i<=60;i++) printf("=");}}
if(ball==4){if(Thun==1){if(Boss!=0) Bblo-=16+Lv*4;if(Boss==1) Chang1 if(Boss==2) Chang2 if(Boss==3) Chang3 system("color 9F");Sleep(20);system("color 6F");Sleep(10);system("color 0F");system("cls");for(int i=bl;i<=br;i++)if(B[i].what>0)B[i].life=0;Setpos(20,0);for(int i=1;i<=60;i++) printf("=");}}
if(ball==5){system("cls"); Color(5);Setpos(10,10);cout<<"新天赋!";Y:int rr=rand()%4+2;Setpos(12,10);if(rr==Ren) goto Y;if(rr==2)cout<<"瞬跳";if(rr==3)cout<<"空之舞";if(rr==4)cout<<"三段跳";if(rr==5)cout<<"反重力跳跃";Setpos(14,10);cout<<"当前天赋:";if(Ren==1)cout<<"小无敌";if(Ren==2)cout<<"瞬跳";if(Ren==3)cout<<"空之舞";if(Ren==4)cout<<"三段跳";if(Ren==5)cout<<"反重力跳跃";Setpos(16,10);cout<<"换否?(y/n)";G:char g=_getch();if(g=='y')Ren=rr;else if(g!='n')goto G;system("cls");Setpos(20,0);Color(0);for(int i=1;i<=60;i++) printf("=");}
if(ball==6){Color(4);for(float i=1;i<=Bblo;i+=Bblomax/20.0)cout<<"▄";Color(0);cout<<' '<<Bblo<<" ";Color(0);}
if(ball==7){Color(1);if(Win==7&&T%6<3)Color(3);for(float i=1;i<=Blo;i+=Blomax/20.0)cout<<"▄";Color(0);if(Win==7&&T%6<3)Color(3);printf(" %0.1f ",Blo);}
}
int main(){
system("mode con cols=60 lines=37");CONSOLE_CURSOR_INFO cursor_info={1,0};SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);srand((unsigned)time(NULL));
Win=0;Ren=1;Lv=1;Blo=Blomax=100;Expmax=300;Hui=15;X=18,Y=6;
ReStart:system("cls");memset(B,0,sizeof(B));memset(I,-1,sizeof(I));T=0;bl=0;br=-1;Upt=0;
Start:Blo=Blomax * 100;Ding=6.25;
memset(Bgo1,0,sizeof(Bgo1));memset(Bgo2,0,sizeof(Bgo2));memset(Bgo3,0,sizeof(Bgo3));
if(Win%2==0) T=0;if(Win%2==0&&D==0){if(Win>0)Ball(5);Boss=0;lL:L=rand()%4+1;for(int i=0;i<=Win/2-1;i++)if(L==Ll[i]) goto lL;Ll[Win/2]=L;}if(Win%2==1&&D==0){if(Win==7)Boss=6,T=0,Blomax+=100;else{bl:Boss=rand()%3+1;for(int i=0;i<=3;i++)if(Boss==Bl[i]) goto bl;}Bl[Win/2]=Boss;Bwhat1=Bwhat2=Bwhat3=0,Bx1=10,By1=20,Bx2=15,By2=20,Bx3=21,By3=20;system("color 4C");Sleep(20);system("color 0F");Map(0,1);Sleep(1000);}if(Win%2==1){Bblomax=500+(Win/2)*500;Bblo=Bblomax;if(Boss==2) Ding=12.25;}
while(1){
T++;
if(Wind==0){if(GetAsyncKeyState(VK_LEFT)&0x8000) Vy=-(10-abs(Ding-Y)*1.5)/20.0;if(GetAsyncKeyState(VK_RIGHT)&0x8000) Vy=(10-abs(Ding-Y)*1.5)/20.0;}if(GetAsyncKeyState(VK_UP)&0x8000&&u1==0) {u1++;if(Down==1){Down=0;Up=0;if(Ren==2)Map(-1,0),Vx=0,X=18,Li=5;else Vx=7,Vy=0.3;}else if(Up==0&&Wind==0) {Down=0;Up=1;if(Ren==2)Map(-1,0),Vx=1,X=10,Map(0,3),Li=5;else Vx=2,Vy=0.1;}else if(Up==1&&Wind==0) {Down=0;Up=2;if(Ren==2)Map(-1,0),Vx=1,X-=6,Map(0,3),Li=5;else Vx=1.5,Vy=0.1;}else if(Ren==3&&Up==2&&Wind==0) {Down=0;Up=3;Vx=1;Vy=0.5;Upt=30;}else if(Ren==4&&Up==2&&Wind==0) {Down=0;Up=3;Vx=1.8;Vy=0.1;}}if(GetAsyncKeyState(VK_DOWN)&0x8000&&u2==0) {u2++;if(Down==1&&Ren==5){Down=2;Up=0;Vx=-1.7;}else {Down=1;Up=0;if(Ren==2)Map(-1,0),Vx=0,X=22,Map(0,3),Li=5;else {if(Upt!=0) Map(-1,0),Upt=0;Vx=-7;}}}if((GetAsyncKeyState(VK_UP)&0x8000) ?0:1) u1=0;if((GetAsyncKeyState(VK_DOWN)&0x8000) ?0:1) u2=0;if(kbhit()){char g=_getch();if(g==' ') Sleep(100),Setpos(4,1),Sy++,system("pause");}if(Sy==1) Setpos(4,1),printf(" "),Sy--;
if(Drug==0) Blo=fmin((float)Blomax,Blo+Hui/100.0);else if(T%10==0)Blo--;if(T%20==0) {if(Kill!=0) Kill=0;if(Lvl!=0) Lvl=0;}if(Killb>0) Killb--;if(Li>0) Li--;if(Ice>0) Ice--;if(Drug>0) Drug--;if(Magne>0) Magne--;
if(Fire>0) Ball(1),Fire--;if(Water>0) Ball(2),Water--;if(Wind>0) Ball(3),Wind--;if(Thun>0) Ball(4),Thun--;
if(Boss==0) NorGuai(L,T%1500);RandGood();if(T%20==1)Exp++;
if(T%50==1){Exp++;system("cls");Setpos(20,0);Color(0);for(int i=1;i<=60;i++) printf("=");if(Win==0&&T<300){Setpos(4,6);cout<<"↑/↓ 跳跃/下翻,←→ 些微移动(松手即返回)"; Setpos(8,6);cout<<"球可以开启特殊效果,经验积满(300)可提升级别。";Setpos(8,6);cout<<"打败 7 波即胜利,打败 BOSS 有新天赋。";Setpos(10,15);cout<<"空格可以暂停。";}}
Map(-1,0);
if(Boss==1) Boss1();if(Boss==2) Boss2();if(Boss==3) Boss3();if(Boss==6) Boss1(),Boss2(),Boss3();
Move();Map(0,(bool)Kill);Color(0);
Setpos(1,1);Blo=fmin(Blo,(float)Blomax);if(Boss==0)cout<<"血量: "<<(int)Blo<<" ";Color(0);Setpos(1,9),cout<<"死亡次数: "<<D<<" ";Setpos(2,1);Exp=min(Exp,Expmax);if(Exp>=Expmax)Exp=0,Lv++,Lvl++,Hui++,Blomax+=5;if(Lvl>0)Color(5);cout<<"级别: "<<Lv;Color(0);Setpos(2,9);cout<<"经验: "<<Exp<<" ";if(Boss>0) Setpos(3,1),cout<<"血量 : ",Ball(7);if(Boss>0&&Boss!=6) Setpos(4,1),cout<<"怪物血量: ",Ball(6);if(Boss==6) Setpos(1,9),printf("时间: %0.1f s ",T/15.0);
if(Win==0) Sleep(55);if(Win==1) Sleep(50);if(Win==2) Sleep(35);if(Win==3) Sleep(40);if(Win==4) Sleep(25);if(Win==5) Sleep(30);if(Win==6) Sleep(20);if(Win>=7) Sleep(17);
if(Boss==3&&Bblo<=0){for(int i=1;i<=4;i++){br++;B[br].what=98;B[br].x=Bx3-1,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;br++;B[br].what=98;B[br].x=Bx3,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;br++;B[br].what=98;B[br].x=Bx3-2,B[br].y=By3-1+i;B[br].vy=4;B[br].life=1;}}
if((Win%2==0&&T>=1400)||(Win%2==1&&Bblo<=0)||(Win==7&&T>=450)||Blo<=0) {Map(-1,0);break;}
}
if(Blo<=0){
Sleep(1000);
D++;
system("color 7F");
Setpos(15,11);
Color(4);
cout<<"youxijieshu";
Sleep(2000);
goto ReStart;
}
else if(Win==6){
system("color 7F");
Setpos(15,11);
Color(4);
cout<<"坚持30秒 !";
Sleep(2000);
Setpos(3,0);
Win++;
D=0;
}
else if(Win==7){
Sleep(1000);
system("color 6E");
Setpos(15,11);
Color(5);
cout<<"YOU WIN !";
Sleep(2000);
Setpos(3,0);
return 0;
}else Sleep(1000),Win++,D=0;
goto Start;
}
5.开局一个卒
//开局一个卒//
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
void ccc(); // 匀速输出
void c_slow(); // 缓慢输出
void cls(); // 清屏
void Error(); // 输出"Input Error"
void zhuye(); // 主界面
void inti(); // 初始化
long long money;
long long bing_1,bing_2 = 1,bing_3;
long long my_shili;
void ccc(string s) { // 匀速输出
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(25);
}
printf("\n");
}
void c_slow(string s) { // 缓慢输出
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(444);
}
printf("\n");
}
void cls() { // 清屏
system("cls");
}
void Error() { // 输出"Input Error"
cls();
c_slow("Input Error!");
zhuye();
}
void zhuye() { // 主界面
cls();
ccc("1.说明 2.商店 3.征战 4.我的资料 5.礼包码");
char s = getch();
if(s == '1') {
cls();
ccc("版本号: v.1.06 ");
ccc("征战获得钱");
ccc("钱买士兵");
ccc("按任意键继续");
char a = getch();
zhuye();
} else if(s == '2') {
cls();
ccc("1.普通士兵 10 元 一个 2. 中级士兵 66 元一个 3.高级士兵 111元一个 4.返回");
char a = getch();
if(a == '4') zhuye();
if(a == '1') {
ccc("输入个数");
printf("你有%lld元",money);
int num;
cin >> num;
if(money >= num * 10) {
money -= num * 10;
bing_1 += num;
ccc("购买成功!");
zhuye();
} else Error();
}
if(a == '3') {
ccc("输入个数");
printf("你有%lld元",money);
int num;
cin >> num;
if(money >= num * 111) {
money -= num * 111;
bing_3 += num;
ccc("购买成功!");
zhuye();
} else Error();
}
if(a == '2') {
ccc("输入个数");
printf("你有%lld元",money);
int num;
cin >> num;
if(money >= num * 66) {
money -= num * 66;
bing_2 += num;
ccc("购买成功!");
zhuye();
} else Error();
}
} else if(s == '3') {
cls();
my_shili = bing_1 * 3 + bing_2 * 10 + bing_3 * 30;
printf("我方战力:%lld\n",my_shili);
ccc("输入敌人等级(1 ~ 50)");
int num; cin >> num;
if(num < 1 || num > 50) Error();
long long di_shili = pow(2,num);
while(1){
if(di_shili <= 0) {
cls();
ccc("You Win!");
money += pow(3,num);
printf("你获得了");
cout << pow(3,num);
printf("元!\n");
Sleep(1000);
zhuye();
} if(my_shili <= 0) {
cls();
ccc("你全军覆没了!");
Sleep(1000);
ccc("你在混乱中被杀");
cls();
c_slow("You Are Die!");
Sleep(500);
inti();
}
printf("敌方战力:%lld\n",di_shili);
printf("我方战力:%lld\n",my_shili);
ccc("1.攻击 2.逃跑");
char a = getch();
if(a == '2') zhuye();
if(a == '1') {
if(my_shili >= di_shili) {
bing_1 = ceil(bing_1 * 1.0 / 1.5);
bing_2 = ceil(bing_2 * 1.0 / 1.25);
bing_3 = ceil(bing_3 * 1.0 / 1.125);
my_shili = bing_1 * 3 + bing_2 * 10 + bing_3 * 30;
di_shili /= 3;
} else {
bing_1 /= 2.5;
bing_2 /= 2;
bing_3 /= 1.5;
my_shili = bing_1 * 3 + bing_2 * 10 + bing_3 *30;
di_shili /= 1.5;
}
}
}
} else if(s == '4') {
cls();
printf("金币:%lld\n", money);
printf("普通士兵:%lld\n", bing_1);
printf("中级士兵:%lld\n", bing_2);
printf("高级士兵:%lld\n", bing_3);
printf("战力值:%lld\n", bing_1 * 3 + bing_2 * 10 + bing_3 * 30);
ccc("按任意键继续");
char a = getch(); zhuye();
} else if(s == '5') {
cls();
ccc("输入兑换码");
string a; getline(cin,a);
if(a == "HAPPY666") {
cls();
ccc("恭喜获得:2000000000000000000000元");
money += 2000000000000000000000;
Sleep(500);
zhuye();
} if(a == "School666") {
cls();
ccc("恭喜获得:999999名中级士兵");
bing_2 += 999999;
Sleep(500);
zhuye();
} if(a == "C++666") {
cls();
ccc("恭喜获得:666666666666名高级士兵");
bing_3 += 6666666666666;
Sleep(500);
zhuye();
} if(a == "DevC++666") {
cls();
ccc("恭喜获得:100000000000000名低级士兵");
bing_1 += 100000000000000;
Sleep(500);
zhuye();
} else Error();
} else Error();
}
void inti() { // 初始化
cls();
system("color 09");
c_slow("By School");
Sleep(500);
cls();
c_slow("Loading……");
Sleep(500);
zhuye();
}
int main() { inti(); } // main()函数好像没用……
6.狼人杀
#include <iostream>//C++输入输出流库
#include <cstdlib>//使用srand函数要用到这个库
#include <ctime>//使用time函数要用到这个库
#include <Windows.h>
#include <conio.h>
long long sr=0;
using namespace std;
void brc()
{
system("cls");
long long jy=1,wd=3;
long long sy=3,wj=3;
srand((int)time(0));
long long n=rand()%15+1;
cout<<" 你是"<<n<<"号"<<endl;
cout<<" 正在分配身份"<<endl;
Sleep(1500);
long long m[20];
for(long long i=1;i<=15;i++)
m[i]=1;
long long s[20]={0};
long long yy[20]={0};
long long l=0,w=0,j=0,p=0;
for(long long i=1;i<=15;i++)
{
do
{
long long a=rand()%4+1;
if(a==1&&l<1)
{
l++;
s[i]=1;
sr=i;
}
else if(a==2&&w<2)
{
w++;
s[i]=2;
}
else if(a==4&&p<3)
{
p++;
s[i]=4;
}
else if(a==3&&j<9
)
{
j++;
s[i]=3;
}
}
while(s[i]==0);
}
if(s[n]==1)
cout<<" 你是>>杀手<<"<<endl;
else if(s[n]==2)
cout<<" 你是>>预言家<<"<<endl;
else if(s[n]==3)
cout<<" 你是>>平民<<"<<endl;
else
cout<<" 你是>>法师<<"<<endl;
cout<<" 游戏将在5秒后开始"<<endl;
Sleep(5000);
long long c=15;
long long f=0,flag=0;
long long day=1;
long long lr;
long long tp[20]={0};
do
{
lr=0;
system("cls");
cout<<" 第"<<day<<"晚开始"<<endl;
cout<<"你是"<<n<<"号"<<endl;
long long x;
for(long long i=1;i<=15;i++)
{
if(i==n&&m[n]==1)
{
if(s[n]==1)
{
cout<<" 你是杀手"<<endl;
for(long long j=1;j<=15;j++)
if(m[j]==1&&s[j]!=1)
cout<<j<<" ";
cout<<endl;
cout<<" 你选择杀掉"<<endl;
long long a;
cin>>a;
m[a]=0;
cout<<endl;
cout<<" 杀手杀了"<<a<<"号";
if(s[a]==1)
cout<<"(杀手)"<<endl;
else if(s[a]==2)
cout<<"(预言家)"<<endl;
else if(s[a]==3)
cout<<"(平民)"<<endl;
else
cout<<"(法师)"<<endl;
c--;
}
else
if(s[n]==2)
{
cout<<" 你是预言家"<<endl;
cout<<" ";
for(long long j=1;j<=15;j++)
if(m[j]==1)
cout<<j<<" ";
cout<<endl<<" 你选择预言谁的身份"<<endl;
long long a;
cin>>a;
if(s[a]==1)
{
cout<<" "<<a<<"号是杀手,请注意"<<endl;
Sleep(1000);
}
else
cout<<" "<<a<<"号是好人"<<endl;
}
}
else if(s[i]==1&&m[i]==1)
{
long long a;
do
{
a=rand()%15+1;
}
while(a==i||m[a]==0||s[a]==1);
cout<<" 杀手杀掉了"<<a<<"号";
if(s[a]==1)
cout<<"(杀手)"<<endl;
else if(s[a]==2)
cout<<"(预言家)"<<endl;
else if(s[a]==3)
cout<<"(平民)"<<endl;
else
cout<<"(法师)"<<endl;
m[a]=0;
c--;
break;//
}
else if(s[i]==2)
{
if(flag==0||m[flag]==0)
{
long long a;
do
{
a=rand()%15+1;
}
while(a==i||m[a]==0);
if(s[a]==1)
yy[a]=1;
else if(s[a]==3)
yy[a]=3;
}
}
else if(s[i]==4)
{
f=0;
while(f==0)
{
long long a;
a=rand()%3+1;
if(a==3)break;
if(a==1)
{
if(sy>0)
{
sy--;
f=1;
long long b;
do
{
b=rand()%15+1;
b=rand()%15+1;
}
while(b==i||m[b]==0);
m[b]=0;
cout<<" 法师毒死了"<<b<<"号";
if(s[b]==1)
cout<<"(杀手)"<<endl;
else if(s[b]==2)
cout<<"(预言家)"<<endl;
else if(s[b]==3)
cout<<"(平民)"<<endl;
c--;
if(s[b]==1&&n!=sr)
{
cout<<endl<<" "<<sr<<"号是杀手!";
cout<<endl<<" 杀手已死亡!"<<endl;
cout<<" 游戏结束"<<endl;
return ;
}
break;//
}
}
else if(a==2&&day>1)
{
if(jy>0)
{
jy--;
f=1;
long long b;
do
{
b=rand()%15+1;
}
while(b==i||m[b]==1);
c++;
cout<<" 法师复活了"<<b<<"号"<<endl;
m[b]=1;
if(m[sr]==0&&n!=sr)
{
cout<<endl<<" "<<sr<<"号是杀手!";
cout<<endl<<" 杀手已死亡!"<<endl;
cout<<" 游戏结束"<<endl;
return ;
}
break;//
}
}
}
}
}
if(s[n]==4)
{
cout<<" 你是法师"<<endl;
cout<<"存活状况:"<<endl;
for(long long j=1;j<=15;j++)
if(m[j]==1)
cout<<j<<" ";
cout<<endl;
cout<<" 你选择 1.* 杀 *还是 2.* 救 * 3.* 啥都不做 *"<<endl;
long long a,f=0;
while(f==0)
{
cin>>a;
if(a==3) break;
if(a==1)
{
if(wd>0)
{
wd--;
f=1;
cout<<" 你选择了杀人"<<endl;
for(long long i=1;i<=15;i++)
if(m[i]==1)
cout<<i<<" ";
cout<<endl;
long long b;
cin>>b;
if(s[b]==1)
cout<<"(杀手)"<<endl;
else if(s[b]==2)
cout<<"(预言家)"<<endl;
else if(s[b]==3)
cout<<"(平民)"<<endl;
else
cout<<"(法师)"<<endl;
m[b]=0;
c--;
if(m[sr]==0&&n!=sr)
{
cout<<endl<<" "<<sr<<"号是杀手!";
cout<<endl<<" 杀手已死亡!"<<endl;
cout<<" 游戏结束"<<endl;
return ;
}
}
else
{
cout<<">>毒药<<不足"<<endl;
}
}
else if(a==2)
{
if(wj>0)
{
wj--;
f=1;
cout<<"你选择了复活"<<endl;
cout<<"阵亡名单:"<<endl;
for(long long i=1;i<=15;i++)
if(m[i]==0)
cout<<i<<"号,身份:"<<s[i]<<" "<<endl;;
long long b;
cin>>b;
m[b]=1;
c++;
}
else
{
cout<<">>复活药水<<不足"<<endl;
}
}
}
}
Sleep(1000);
long double p[20]={0};
cout<<" 第"<<day<<"晚结束"<<endl;
cout<<endl;
if(m[n]==0)
{
cout<<" 你已经>>死<<了";
break;
}
cout<<" 存活:"<<endl;
cout<<" ";
for(long long i=1;i<=15;i++)
if(m[i]==1)
cout<<i<<" ";
cout<<endl;
cout<<" 请投票...."<<endl;
for(long long i=1;i<=15;i++)
{
if(i==n&&m[n]==1)
{
cout<<endl;
cout<<" 你选择投几号"<<endl;
long long a=99;
while(a==99)
{
cin>>a;
if(a==99)
for(long long i=1;i<=15;i++)
if(m[i]==1)
cout<<" "<<i<<"."<<s[i]<<endl;
}
if(s[i]==3&&day>4)
p[a]+=1.5;
else
p[a]++;
cout<<endl;
cout<<" "<<i<<"->"<<a<<endl;
if(s[a]==3)
{
tp[a]=i;
}
}
else if(s[i]==1&&m[i]==1)
{
long long a;
do
{
a=rand()%15+1;
}
while(m[a]==0||a==i||s[a]==1);
p[a]++;
cout<<" "<<i<<"->"<<a<<endl;
if(s[a]==3)
{
tp[a]=i;
}
}
else if(s[i]==2&&m[i]==1)
{
if(flag!=0)
{
p[f]++;
cout<<" "<<i<<"->"<<flag<<endl;
}
else
{
long long a;
do
{
a=rand()%15+1;
}
while(m[a]==0||a==i||yy[a]==3);
p[a]++;
if(s[a]==3)
{
tp[a]=i;
}
cout<<" "<<i<<"->"<<a<<endl;
}
}
else if(s[i]==3&&m[i]==1)
{
if(tp[i]==0)
{
long long a;
do
{
a=rand()%15+1;
}
while(m[a]==0||a==i);
p[a]++;
cout<<" "<<i<<"->"<<a<<endl;
}
else
{
if(m[tp[i]]==1)
{
p[tp[i]]++;
cout<<" "<<i<<"->"<<tp[i]<<endl;
}
else
{
long long a;
do
{
a=rand()%15+1;
}
while(m[a]==0||a==i);
p[a]++;
cout<<" "<<i<<"->"<<a<<endl;
}
}
}
else if(s[i]==4&&m[i]==1)
{
long long a;
do
{
a=rand()%15+1;
}
while(m[a]==0||a==i);
p[a]++;
cout<<" "<<i<<"->"<<a<<endl;
}
}
system("cls");
cout<<" 投票情况:"<<endl;
for(long long i=1;i<=15;i++)
if(m[i]==1)
cout<<" "<<i<<"号"<<" 票数:"<<p[i]<<endl;
long long sw,max=-100;
for(long long i=1;i<=15;i++)
{
if(p[i]>max)
{
sw=i;
max=p[i];
}
}
m[sw]=0;
cout<<" "<<sw<<"死了"<<endl;
c--;
cout<<" "<<sw<<"号的身份是";
if(s[sw]==1)
cout<<"杀手"<<endl;
else if(s[sw]==2)
cout<<"预言家"<<endl;
else if(s[sw]==3)
cout<<"平民"<<endl;
else
cout<<"法师"<<endl;
if(s[sw]==1&&n!=sr)
{
cout<<endl<<" "<<sr<<"号是杀手!";
cout<<endl<<" 杀手已死亡!"<<endl;
cout<<" 游戏结束"<<endl;
return ;
}
day++;
if(s[n]!=1)
{
for(long long i=1;i<=15;i++)
if(s[i]==1&&m[i]==1)
lr=1;
}
else
{
if(s[n]==1&&c==2)
lr=0;
}
system("pause");
cout<<endl;
if(m[sr]==0&&n!=sr)
{
cout<<endl<<" "<<sr<<"号是杀手!"<<endl;
cout<<endl<<" 杀手已死亡!"<<endl;
cout<<" 游戏结束"<<endl;
return ;
}
}
while(m[n]==1&&c>1);
if(sr==n&&m[n]==1)
{
cout<<" 你杀掉了所有人!!!"<<endl;
}
cout<<" 游戏结束"<<endl;
return ;
}
int main()
{
srand((int)time(0));
char a='1';
while(1)
{
system("cls");
cout<<" 杀手游戏"<<endl;
cout<<"------------------------------------------------------------------------------------------------------------------------";
cout<<" 1.开始游戏"<<endl;
cout<<" 2.查看游戏规则"<<endl;
a=getch();
if(a=='1')
{
cout<<" 1. 15人场"<<endl;
cout<<" 2. 30人娱乐战(10猎人)<敬请期待>"<<endl;
a='2';
while(a=='2')
{
a=getch();
switch(a)
{
case '1':
brc();
break;
}
if(a=='1')
break;
}
if(a=='1')
break;
}
else if(a=='2')
{
cout<<"杀手:每当晚上的时候可使用杀人权杀掉一人"<<endl;//1
cout<<"预言家:每天晚上可以知道一个人的身份"<<endl;//2
cout<<"平民:无技能,当玩家是平民时,在第5天拥有1.5票的投票权"<<endl;//3
cout<<"猎人:此身份仅限于30人娱乐局中,死亡后可带走一人"<<endl;
cout<<"投票细则:\n(游戏中除了你以外全是由超级AI人工代替)"<<endl;
cout<<"预言家如果预言到杀手将一直对他投票,如果预言到好人将永远不会对他投票"<<endl;
cout<<"平民将投上一个晚上对他投票他的人"<<endl;
cout<<"********利用好超级AI游戏规则找出杀手**********"<<endl;
system("pause");
}
}
return 0;
}
7.迷宫
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
const long long n=29,jg=25;
string p=" *!|-=.<^>1234567890@$%?&_~";
long long r=1;
char f='y';
void print(string a[n])
{
system("cls");
for(long long i=0;i<n;i++)
cout<<a[i]<<endl;
}
void tc()
{
system("cls");
cout<<"\n\n\n\n\n 欢迎下次再玩,拜拜!!!\n";
cout<<" 制作:谢铭轩\n";
cout<<" (按空格结束)";
long long ok='\0';
while(ok=getch(),ok!=' ');
system("cls");
return ;
}
void hf()
{
char t='\0';
while(t!=' ')
{
system("cls");
cout<<"\n\n\n\n A D键换皮肤 空格确定\n\n";
cout<<"\n\n\n\n "<<p[r]<<"\n";
t=getch();
if(t=='a')r--;
else
if(t=='d')r++;
if(r<1)r=jg;
if(r>jg)r=1;
}
system("cls");
return ;
}
void sm()
{
system("cls");
cout<<"\n\n 说明:\n\n\n";
cout<<" 按空格开始游戏后\n";
cout<<" W\n";
cout<<" A S D\n";
cout<<" 移动\n";
cout<<" 按R键返回起点\n";
cout<<" 按P键返回主界面\n";
cout<<" 按Q键设立传送点\n";
cout<<" 按E键返回传送点\n";
cout<<" +号处为终点\n\n\n";
cout<<" 按空格继续···";
long long ok='\0';
while(ok=getch(),ok!=' ');
system("cls");
return ;
}
int main()
{
while(1)
{
long long xx=1,yy=1;
system("cls");
f='y';
cout<<"\n\n\n\n\n\n\n\n\n\n\n";
cout<<" 迷宫游戏\n";
cout<<" 按空格开始游戏\n";
cout<<" 按0退出游戏\n";
cout<<" 按1换皮肤\n";
cout<<" 按2游戏说明\n";
cout<<"\n\n\n\n\n\n\n";
cout<<" 制作:谢铭轩";
long long ok=getch();
while(ok!='0'&&ok!='1'&&ok!='2'&&ok!=' ')ok=getch();
switch(ok)
{
case ' ':
break;
case '0':
tc();
return 0;
break;
case '1':
hf();
f='n';
break;
case '2':
sm();
f='n';
break;
}
while(f=='y')
{
system("cls");
string a[n];
long long x,y,qx,qy;
long long ch;
srand(time(0));
long long s=rand()%6+1;
switch(s)
{
case 1:
qx=1;
qy=1;
a[0]="###########";
a[1]="# # # #";
a[2]="# # # #";
a[3]="# ##### ###";
a[4]="# # ###+#";
a[5]="# # #";
a[6]="###########";
break;
case 2:
qx=8;
qy=12;
a[0]="####################";
a[1]="#+ # # #";
a[2]="# ## #### ### # #";
a[3]="# #### ##### #";
a[4]="### # # ## #";
a[5]="##### ########## # #";
a[6]="# ## ### ## #";
a[7]="## ### ### # ## ##";
a[8]="# # # #";
a[9]="####################";
break;
case 3:
qx=1;
qy=1;
a[0]="###################";
a[1]="# # # # # #";
a[2]="# # # # # # # # # #";
a[3]="# # # # # # # # # #";
a[4]="# # # # # # # # # #";
a[5]="# # # # # # # # # #";
a[6]="# # # # # # # # # #";
a[7]="# # # # # # # # # #";
a[8]="# # # # # # # # # #";
a[9]="# # # # # # # # # #";
a[10]="# # # # #+#";
a[11]="####################";
break;
case 4:
qx=1;
qy=1;
a[0]="########################################";
a[1]="# #";
a[2]="# #################################### #";
a[3]="# # # #";
a[4]="# # ###################### ##### #######";
a[5]="# # #+ # # # ### #";
a[6]="# # # # # ######### # #### ## #### ## #";
a[7]="# # # # # ## # ## ## # # #";
a[8]="# # # ### ## # # ########### ## ## # #";
a[9]="# # # # # # # # # # # # #";
a[10]="# # ### ###### ### # ######## ##### ## #";
a[11]="# # # # # # # #";
a[12]="# # # ######## ############## ##### # #";
a[13]="# # # # #";
a[14]="# # ################################## #";
a[15]="# # # #";
a[16]="# #################################### #";
a[17]="# #";
a[18]="########################################";
break;
case 5:
qx=1;
qy=1;
a[0]="########################################";
a[1]="# # #";
a[2]="# ########### ################# ###### #";
a[3]="# # # # # ## # #";
a[4]="# # # #### ## # ## # #### ##### ## # # #";
a[5]="# # # # # # # # # # # #";
a[6]="# # # #### ###### ############### # #";
a[7]="# # ## # # # # # #";
a[8]="# # #### ######## ################# # #";
a[9]="# ## # # # # ##### # # #";
a[10]="# ########## # # # ### # #";
a[11]="### # # # # ##### # # #";
a[12]="# ######################## # # # #";
a[13]="# # # # ## # ###";
a[14]="# ### #### ####### ########### #### ## #";
a[15]="# # # # +#";
a[16]="########################################";
break;
case 6:
qx=1;
qy=1;
a[0]="##################################################################################################################";
a[1]="# #";
a[2]="# # ############################################################################################################ #";
a[3]="# # ### ############# ### #";
a[4]="# ## ## ###### +# ######################################################################### # # ### # #";
a[5]="# ### # ################### # # # # # # # # # # #";
a[6]="# #### # ############################################################# # # # # # #";
a[7]="# ##################################### ################## ## # ##### # # #";
a[8]="# ###### # ##### ########## + ########################### ## ## # # #";
a[9]="# # ######### ############## ###### # ## # ##################### ############ ######### # #";
a[10]="# # ##### # ###### # # ####### ######## # ### # # #";
a[11]="# # # ###### # #### ##### ########## # # # ##### ############## ###################### # ###";
a[12]="# ##### # # ## # #### ## # ##### ############# ####### # # # # #";
a[13]="# # # # # ## # ## # ############ ## # # # # ############# ###### ################ # # #";
a[14]="# # # # ##### ## # ## ## # # # # ## # # # ###### # ######### # ############# ######## ### #";
a[15]="# # # # ## # # # # # # ##### # # # # ############### # # #";
a[16]="# ### ########## # # #################################### # ##################################### ############# #";
a[17]="# # # ## # #### #";
a[18]="# # ####################### ################################################################# ################## #";
a[19]="# # # +#";
a[20]="##################################################################################################################";
break;
}
xx=x=qx,yy=y=qy;
a[x][y]=p[r];
print(a);
while(a[x][y]!='+')
{
ch=getch();
if(ch=='q')
{
xx=x;
yy=y;
}
if(ch=='e')
{
a[x][y]=' ';
a[xx][yy]=p[r];
x=xx;
y=yy;
}
if(ch=='r')
{
a[x][y]=' ';
a[qx][qy]=p[r];
x=qx;
y=qy;
}
if(ch=='p')
{
f='n';
break;
}
if((ch=='a'&&a[x][y-1]=='+')||(ch=='d'&&a[x][y+1]=='+')||(ch=='s'&&a[x+1][y]=='+')||(ch=='w'&&a[x-1][y]=='+'))
{
break;
}
if(ch==27)break;
if(ch==97&&a[x][y-1]==' '||a[x][y-1]=='|')
{
a[x][y]=' ';
y--;
a[x][y]=p[r];
}
if(ch==100&&a[x][y+1]==' '||a[x][y+1]=='|')
{
a[x][y]=' ';
y++;
a[x][y]=p[r];
}
if(ch==115&&a[x+1][y]==' '||a[x+1][y]=='|')
{
a[x][y]=' ';
x++;
a[x][y]=p[r];
}
if(ch==119&&a[x-1][y]==' '||a[x-1][y]=='|')
{
a[x][y]=' ';
x--;
a[x][y]=p[r];
}
print(a);
}
system("cls");
if(f=='n')break;
cout<<"you win!!!"<<endl;
cout<<"按空格继续···";
ok='\0';
while(ok=getch(),ok!=' ');
system("cls");
cout<<"是否继续(y/n)";
while(f=getch(),f!='y'&&f!='n');
}
}
return 0;
}
8.迷你世界
#include <bits/stdc++.h>
#include <windows.h>
#include <unistd.h>
#include <conio.h>
#define LIFE 15
#define HUNGRY 100
#define SPEED 1000
using namespace std;
//hamburger是汉堡,为迷你世界里的麦包什么的 , hungryl剩余饥饿 , speed玩家移动速度,暂时不使用
//wood木头物资 , stone石头物资 , metal金属物资 , diamond钻石物资
//und是当前玩家所在高度,便于判断一些稀有矿石出现点
//stoneAX、metalAX、diamondAX和goldAX各类斧头和镐子,需要合成
//undergroundMAP是当前底下矿洞可视区域,一旦移动,如不在map内,则重新随机
unsigned long long hamburger=10000, hungryl=100, speed=100;
long long life=9999;
unsigned long long wood=10, stone=10, metal=10, diamond=10, misterystone=100, jstone=100;
long long und=-2;
bool stoneAX=true, metalAX=true, diamondAX=true, goldAX=true, jstoneAX=true;
bool tl=true;
int undergroundMAP[10][10]= {0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0
};
int nowp;//判断当前位置,更利于底下矿洞探索
unsigned long long x, y;//位置判断,便于输出
void HIDE() {
CONSOLE_CURSOR_INFO cursor_info= {1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
}
void SetPos(int x,int y) {
COORD pos;
pos.X=y*2-1,pos.Y=x+1;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
void stoDIG() {
if(stoneAX==true&&metalAX==false) Sleep(50);
else;
SetPos(35,1);
cout<<"你拾取了1个石头";
}
void metDIG() {
if(stoneAX==true&&metalAX==false) Sleep(111);
else if(metalAX=true&&diamondAX==false) Sleep(65);
else;
SetPos(35,1);
cout<<"你拾取了1块铁块";
}
void diaDIG() {
if(metalAX==true&&diamondAX==false) Sleep(210);
else if(diamondAX==true&&goldAX==false) Sleep(80);
else if(jstoneAX==true);
else;
SetPos(35,1);
cout<<"你拾取了1个钻石";
}
void misDIG() {
Sleep(10);
}
void jstAX() {
for(int i=0; i<8; i++) {
for(int j=0; j<8; j++) {
switch(undergroundMAP[i][j]) {
case 1:
wood++;
SetPos(35,1);
cout<<"你拾取了1块木头";
break;
case 2:
stone++;
SetPos(35,1);
cout<<"你拾取了1个石头";
break;
case 3:
metal++;
SetPos(35,1);
cout<<"你拾取了1块铁块";
break;
case 4:
diamond++;
SetPos(35,1);
cout<<"你拾取了1个钻石";
break;
case 5:
diamond*=100;
SetPos(35,1);
cout<<"你拾取了n个钻石";
break;
case 6:
metal*=1000;
SetPos(35,1);
cout<<"你拾取了n块铁块";
break;
case 7:
if( !tl ) life--;
break;
}
undergroundMAP[i][j]=0;
}
}
}
void golAX() {
for(int i=0; i<10; i++) {
for(int j=0; j<10; j++) {
switch(undergroundMAP[i][j]) {
case 1:
wood++;
SetPos(35,1);
cout<<"你拾取了1块木头";
break;
case 2:
stone++;
SetPos(35,1);
cout<<"你拾取了1个石头";
break;
case 3:
metal++;
SetPos(35,1);
cout<<"你拾取了1块铁块";
break;
case 4:
diamond++;
SetPos(35,1);
cout<<"你拾取了1个钻石";
break;
case 7:
if( !tl ) life--;
break;
}
undergroundMAP[i][j]=0;
}
}
}
void diaAX() {
for(int i=x-2; i<=x+2; i++) {
for(int j=y-2; j<=y+2; j++) {
switch(undergroundMAP[i][j]) {
case 1:
wood++;
break;
case 2:
stone++;
stoDIG();
break;
case 3:
metal++;
metDIG();
break;
case 4:
diamond++;
diaDIG();
break;
case 7:
if( !tl ) life--;
break;
}
undergroundMAP[i][j]=0;
}
}
}
void metAX() {
for(int i=x-1; i<=x+1; i++) {
for(int j=y; j<=y+1; j++) {
switch(undergroundMAP[i][j]) {
case 1:
wood++;
break;
case 2:
stone++;
stoDIG();
break;
case 3:
metal++;
metDIG();
break;
case 4:
diamond++;
diaDIG();
break;
case 7:
if( !tl ) life--;
break;
}
undergroundMAP[i][j]=0;
}
}
}
bool canGO(bool a1,bool a2,bool a3,bool a4,int pla) {
if(pla<=3) {
return 1;
} else if(pla==4&&a2==true) {
return 1;
} else {
return 0;
}
}
void make() {
system("cls");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE);
cout<<" ____________________________________________________________________ "<<endl;
cout<<"| 合 成 |"<<endl;
cout<<"| |"<<endl;
cout<<"| 1. 铁斧 |"<<endl;
cout<<"| 2. 钻石斧 |"<<endl;
cout<<"| 3. 荒芜神斧 |"<<endl;
cout<<"| 4. 神秘基岩斧 |"<<endl;
cout<<"| 5. 不死药 |"<<endl;
cout<<"| 铁斧:有99.8%的概率挖掘3 ×3方格 |"<<endl;
cout<<"| 钻石斧:有99.9%的概率挖掘5 ×5方格 |"<<endl;
cout<<"| 荒芜神斧:有100%的概率挖掘全屏方格 |"<<endl;
cout<<"| 神秘基岩斧:无可奉告 |"<<endl;
cout<<"| ________________________________________________________________ |"<<endl;
cout<<"| |备注:请确认背包已有所有所需物品且斧子合成不需要使用已合成的斧子| |"<<endl;
cout<<"|_|________________________________________________________________|_|"<<endl;
cout<<"请输入:";
char input=getch();
switch(input) {
case '1':
if(metal>=4&&stoneAX!=false&&metalAX==false) {
cout<<endl<<"已合成"<<endl;
metalAX=true;
} else if(metalAX==true) {
cout<<endl<<"对不起!您的铁斧已经合成了,不能继续合成了呦!"<<endl;
}
break;
case '2':
if(diamond>=2&&metalAX!=false&&diamondAX==false) {
cout<<endl<<"已合成"<<endl;
diamondAX=true;
} else if(diamondAX==true) {
cout<<endl<<"对不起!您的钻石斧已经合成了,不能继续合成了呦!"<<endl;
}
break;
case '3':
if(wood>=30&&metal>=20&&diamond>=12&&diamondAX!=false&&goldAX==false) {
cout<<endl<<"已合成"<<endl;
goldAX=true;
} else if(goldAX==true) {
cout<<endl<<"对不起!您的荒芜神斧已经合成了,不能继续合成了呦!"<<endl;
}
break;
case '4':
if(wood>=100&&metal>=150&&diamond>=175&&goldAX==true&&jstoneAX==false) {
cout<<endl<<"已合成"<<endl;
jstoneAX=true;
} else if(jstoneAX==true) {
cout<<endl<<"对不起!您的神秘基岩斧已经合成了,不能继续合成了呦!"<<endl;
}
break;
case '5':
if(wood>=101&&metal>=151&&diamond>=176&&jstone>=1) {
cout<<endl<<"您已不怕岩浆"<<endl;
tl=true;
}
break;
}
}
void getk() {
switch(getch()) {
case 'w':
if(x!=0&&jstoneAX==true) {
jstAX();
} else if(x!=0&&goldAX==true) {
golAX();
} else if(x!=0&&diamondAX==true) {
diaAX();
} else if(x!=0&&metalAX==true) {
metAX();
}
if( x!=0 && canGO( stoneAX, metalAX, diamondAX, goldAX, undergroundMAP[x-1][y] ) ) {
x-=1;
switch(undergroundMAP[x][y]) {
case 1:
wood++;
break;
case 2:
stone++;
stoDIG();
break;
case 3:
metal++;
metDIG();
break;
case 4:
diamond++;
diaDIG();
break;
case 5:
jstone++;
misDIG();
break;
case 7:
if( !tl ) life--;
break;
}
undergroundMAP[x][y]=0;
}
break;
case 's':
if(x!=9&&jstoneAX==true) {
jstAX();
} else if(x!=9&&goldAX==true) {
golAX();
} else if(x!=9&&diamondAX==true) {
diaAX();
} else if(x!=9&&metalAX==true) {
metAX();
}
if( x!=9 && canGO( stoneAX, metalAX, diamondAX, goldAX, undergroundMAP[x+1][y] ) ) {
x+=1;
switch(undergroundMAP[x][y]) {
case 1:
wood++;
break;
case 2:
stone++;
stoDIG();
break;
case 3:
metal++;
metDIG();
break;
case 4:
diamond++;
diaDIG();
break;
case 5:
jstone++;
misDIG();
break;
case 7:
if( !tl ) life--;
break;
}
undergroundMAP[x][y]=0;
}
break;
case 'a':
if(y!=0&&jstoneAX==true) {
jstAX();
} else if(y!=0&&goldAX==true) {
golAX();
} else if(y!=0&&diamondAX==true) {
diaAX();
} else if(y!=0&&metalAX==true) {
metAX();
}
if( y!=0 && canGO( stoneAX, metalAX, diamondAX, goldAX, undergroundMAP[x][y-1] ) ) {
y-=1;
switch(undergroundMAP[x][y]) {
case 1:
wood++;
break;
case 2:
stone++;
stoDIG();
break;
case 3:
metal++;
metDIG();
break;
case 4:
diamond++;
diaDIG();
break;
case 5:
jstone++;
misDIG();
break;
case 7:
if( !tl ) life--;
break;
}
undergroundMAP[x][y]=0;
}
break;
case 'd':
if(y!=9&&jstoneAX==true) {
jstAX();
} else if(y!=9&&goldAX==true) {
golAX();
} else if(y!=9&&diamondAX==true) {
diaAX();
} else if(y!=9&&metalAX==true) {
metAX();
}
if( y!=9 && canGO( stoneAX, metalAX, diamondAX, goldAX, undergroundMAP[x][y+1] ) ) {
y+=1;
switch(undergroundMAP[x][y]) {
case 1:
wood++;
break;
case 2:
stone++;
stoDIG();
break;
case 3:
metal++;
metDIG();
break;
case 4:
diamond++;
diaDIG();
break;
case 5:
jstone++;
misDIG();
break;
case 7:
if( !tl ) life--;
break;
}
undergroundMAP[x][y]=0;
}
break;
case 'm':
make();
break;
case 'c':
if(jstoneAX==true) {
for(int i=0; i<10; i++) {
for(int j=0; j<10; j++) {
switch(undergroundMAP[i][j]) {
case 1:
wood++;
SetPos(35,1);
cout<<"你拾取了1块木头";
break;
case 2:
stone++;
SetPos(35,1);
cout<<"你拾取了1个石头";
break;
case 3:
metal++;
SetPos(35,1);
cout<<"你拾取了1块铁块";
break;
case 4:
diamond++;
SetPos(35,1);
cout<<"你拾取了1块钻石";
break;
case 5:
diamond*=100;
SetPos(35,1);
cout<<"你拾取了n块钻石";
break;
case 6:
metal*=1000;
SetPos(35,1);
cout<<"你拾取了n块铁块";
break;
case 7:
if( !tl ) life--;
break;
}
undergroundMAP[i][j]=0;
}
}
}
}
}
bool emp() {
for(int i=1; i<9; i++) {
for(int j=1; j<9; j++) {
if(undergroundMAP[i][j]!=0&&undergroundMAP[i][j]!=4) {
return false;
}
}
}
return true;
}
void pm() {
SetPos(0,0);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
cout<<" _________________________________________________________________________________________ "<<endl;
cout<<"| __________________________________________________ _______________ __________________ |"<<endl;
cout<<"| | 迷 你 世 界 | 背包 | 合成表 | |"<<endl;
cout<<"| |__________________________________________正常模式| 1.木头: | 2.工具合成 | |"<<endl;
cout<<"| |生命: | 饥饿值: 100 | 状态:正常 | 网络延时:0ms| | (1).挖掘工具 | |"<<endl;
cout<<"| |__________________________________________________| 2.石头: | 1.石斧 | |"<<endl;
cout<<"| | | | 直接送 | |"<<endl;
cout<<"| | | 3.铁矿: | | |"<<endl;
cout<<"| | | | 2.铁斧 | |"<<endl;
cout<<"| | | 4.钻石: | 需要一个石斧和 | |"<<endl;
cout<<"| | |_______________|四块铁矿合成 | |"<<endl;
cout<<"| | | 工具 | | |"<<endl;
cout<<"| | |1.石斧: | 3.钻石斧 | |"<<endl;
cout<<"| | | | 需要一个铁斧和 | |"<<endl;
cout<<"| | |2.铁斧: |两块钻石矿合成 | |"<<endl;
cout<<"| |__________________________________________________| | | |"<<endl;
cout<<"| |目标完成情况: |目标:合成基岩斧 |丢包率: %0|3.钻石斧: | 4.荒芜神斧 | |"<<endl;
cout<<"| |____________________|_________________|___________| | 需要三十个木头 | |"<<endl;
cout<<"| | m键打开工具制造区 |4.荒芜神斧: |加二十块铁矿 加十 | |"<<endl;
cout<<"| |提示:挖掘钻石需要铁镐哦!铁镐需要石镐和四块铁合成 |_______________|二个钻石合成 | |"<<endl;
cout<<"| | 钻石需要挖掘到地下-7层左右才有 |当前高度: | | |"<<endl;
cout<<"| |__________________________________________________|_______________|__________________| |"<<endl;
cout<<"| |快捷键: | |"<<endl;
cout<<"| |m:制作斧子 c:基岩斧特有函数,能清空挖掘屏幕 | |"<<endl;
cout<<"| |挖掘特效: | |"<<endl;
cout<<"| | 基岩斧挖掘特效:一层有一次能挖掘8*8矿石,挖掘后需手动挖掘其他矿石或使用快捷键c挖掘| |"<<endl;
cout<<"| | 荒芜神斧挖掘特效:一次可以直接清屏 | |"<<endl;
cout<<"| | 钻石斧挖掘特效:5*5挖掘范围 | |"<<endl;
cout<<"| | 铁斧挖掘特效:3*3挖掘范围 | |"<<endl;
cout<<"| | 石斧挖掘特效:无 | |"<<endl;
cout<<"| |_____________________________________________________________________________________| |"<<endl;
cout<<"| |______注意:由于某种bug,第一行矿石请尽量不要挖掘,谢谢配合,后面我们将尽快修复!______| |"<<endl;
cout<<"| |版本号| |"<<endl;
cout<<"|_____________________________________|V1.7.3|____________________________________________|"<<endl;
if(emp()) {
und--;
srand(time(0));
for(int k=4; k<=13; k++) {
SetPos(k+1,2);
for(int i=0; i<9; i++) {
if(k-4==x&&i==y) {
cout<<" *你*";
undergroundMAP[k-4][i]=0;
continue;
}
int a;
do {
a=rand()%7+1;
} while(a==4&&und>-7);
if(a==1) {
cout<<setw(5)<<"木头";
undergroundMAP[k-4][i]=1;
} else if(a==2) {
cout<<setw(5)<<"石子";
undergroundMAP[k-4][i]=2;
} else if(a==3) {
cout<<setw(5)<<"铁矿";
undergroundMAP[k-4][i]=3;
} else if(a==4&&und<=-7) {
cout<<setw(5)<<"钻石";
undergroundMAP[k-4][i]=4;
} else if(a==5&&und<=-96) {
cout<<setw(5)<<"神石";
undergroundMAP[k-4][i]=5;
} else if(a==6&&und<=-101) {
cout<<setw(5)<<"基岩";
undergroundMAP[k-4][i]=6;
} else if(a==7&&und<=-20) {
cout<<setw(5)<<"岩浆";
undergroundMAP[k-4][i]=7;
}
}
}
} else {
for(int i=0; i<9; i++) {
SetPos(i+5,2);
for(int j=0; j<9; j++) {
if(i==x&&j==y) {
cout<<" *你*";
undergroundMAP[i-4][j]=0;
continue;
}
switch(undergroundMAP[i][j]) {
case 0:
cout<<setw(5)<<" ";
break;
case 1:
cout<<setw(5)<<"木头";
break;
case 2:
cout<<setw(5)<<"石子";
break;
case 3:
cout<<setw(5)<<"铁矿";
break;
case 4:
cout<<setw(5)<<"钻石";
break;
case 5:
cout<<setw(5)<<"神石";
break;
case 6:
cout<<setw(5)<<"基岩";
break;
case 7:
cout<<setw(5)<<"岩浆";
break;
}
}
}
}
SetPos(3.5,5);
cout<<life;
SetPos(2,32);
cout<<wood;
SetPos(4,32);
cout<<stone;
SetPos(6,32);
cout<<metal;
SetPos(8,32);
cout<<diamond;
SetPos(11,31);
cout<<(stoneAX==false?"没有":"有");
SetPos(13,31);
cout<<(metalAX==false?"没有":"有");
SetPos(15,32);
cout<<(diamondAX==false?"没有":"有");
SetPos(17,33);
cout<<(goldAX==false?"没有":"有");
SetPos(19,32);
cout<<und;
SetPos(15,9);
cout<<"未完成"<<endl;
}
void OpenShow() {
cout<<"请务必全屏"<<endl;
HIDE();
cin.get();
cout<<"这里是迷你世界游戏"<<endl;
HIDE();
cin.get();
cout<<"准备进入…"<<endl;
HIDE();
cin.get();
}
int main() {
cout.tie();
HIDE();
OpenShow();
HIDE();
while(jstoneAX!=true) {
system("cls");
if(jstoneAX==true) break;
pm();
getk();
}
getch();
system("cls");
return 0;
}