正文
增加 125 行删除 125 行
10 行未改动11121314151617181920212223242526272829303132333435363738395 行未改动45464748495051525328 行未改动82838485868788899091929394959697989910010110210310410510610726 行未改动13413513613713813914014114214314414514614714814915015115215315445 行未改动20020120220320420520620720820914 行未改动22422522622722822923023123223323423523623723823924024124224324424524624724824925025129 行未改动2812822832842852862872882894 行未改动2942952962972982993003013024 行未改动307308309310311312313314315402 行未改动全部展开7187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617625 行未改动7687697707717727737747757767 行未改动78478578678778878979079179279379479579679779879980080180225 行未改动8288298308318328338348358362 行未改动83984084184284384484584684717 行未改动86586686786886987087187287311 行未改动885886887888889890891892893104 行未改动全部展开998999100010011002100310041005100633 行未改动10401041104210431044104510461047104845 行未改动109410951096109710981099110011011102232 行未改动全部展开1335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136327 行未改动13911392139313941395139613971398139947 行未改动144714481449145014511452145314541455145614576 行未改动1464146514661467146814691470147114725 行未改动1478147914801481148214831484148514864 行未改动149114921493149414951496149714981499150015011502150315041505647 行未改动全部展开215321542155215621572158215921602161306 行未改动全部展开246824692470247124722473247424752476456 行未改动全部展开2933293429352936293729382939294029413 行未改动2945294629472948294929502951295229538 行未改动2962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299954 行未改动30543055305630573058305930603061306228 行未改动30913092309330943095309630973098309950 行未改动3150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319610 行未改动3207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232332 行未改动32363237323832393240324132423243324420 行未改动32653266326732683269327032713272327347 行未改动3321332233233324332533263327332833293330333133323333333482 行未改动34173418341934203421342234233424342587 行未改动35133514351535163517351835193520352187 行未改动36093610361136123613361436153616361743 行未改动366136623663366436653666366736683669269 行未改动全部展开39393940394139423943394439453946394746 行未改动39943995399639973998399940004001400227 行未改动4030403140324033403440354036403740384039404040414042404340444045404640474048404940504051132 行未改动全部展开418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420825 行未改动4234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425622 行未改动42794280428142824283428442854286428726 行未改动43144315431643174318431943204321432216 行未改动433943404341434243434344434510 行未改动}Frame;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);//红if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);//蓝if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);//粉if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);//黄if(a==5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);//灰if(a==6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);//棕if(a==7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN);//随机if(a == -1) Color(rand() % 8);}void SetPos(COORD a)// set cursor{HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorPosition(out, a);}5 行未改动}void HideCursor(){CONSOLE_CURSOR_INFO cursor_info = {1, 0};SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);}char input()28 行未改动int id;string txt;int color;int hard;int level; //挖掘等级(0=徒手 1=木 2=石 3=铁 4=钻石 5=合金)string name;bool fluid; //是否为流体(可以穿越 能够替换成方块)};BLOCK block[] = //方块{{0, "□", 0, 2000000000, 100, "基岩", false},{1, "■", 6, 250, 1, "石头", false},{2, "▓ ", 7, 75, 0, "泥土", false},{3, "▓ ", 6, 75, 0, "砂砾", false},{4, "■", 5, 80, 0, "木头", false},{5, "※", 0, 500, 2, "铁矿石", false},{6, "∷", 0, 500, 2, "铁块", false},{7, "※", 5, 600, 3, "金矿石", false},{8, "∷", 5, 600, 3, "金块", false},{9, "※", 3, 900, 3, "钻石矿石", false},{10, "∷", 3, 900, 3, "钻石块", false},{11, "▓ ", 1, 20, 0, "树叶", false},{12, "■", 3, 2000000000, 100, "水", true},{13, "□", 2, 2000000000, 100, "岩浆", true},{14, "□", 0, 2000, 4, "真正的基岩", false},26 行未改动struct ITEM{int id;int hurt;int speed; //每个短刻的挖掘进度int level;string name;int rare; //稀有度 白0<绿1<蓝2<紫3<幻4};ITEM item[] = //物品{{0, 0, 0, 0, "空气", 0},{1, 2, 20, 1, "木镐", 0},{2, 5, 0, 1, "木剑", 0},{3, 3, 40, 2, "石镐", 0},{4, 6, 0, 2, "石剑", 0},{5, 0, 0, 0, "铁锭", 0},{6, 4, 80, 3, "铁镐", 0},{7, 9, 0, 3, "铁剑", 0},{8, 0, 0, 0, "金锭", 1},45 行未改动struct BUFF{int id;string name;int level; //等级 默认为0 1级以上显示在玩家属性页面中int time; //单位: short_tick 降至0后等级降至0级};BUFF buff[] = //效果{14 行未改动"获得护盾 每级提升1点免伤值","负面效果 每级每个构造刻受到1点伤害"};int gamemode = 0; //0=生存 1=创造 2=极限int short_tick = 0, tick = 0; //短刻(每秒10次)和构造刻(每秒1次)BLOCK world[2400][1200]; //地图 x0~2399 y0~1199BLOCK fkl[5]; //方块栏ITEM wpl[5]; //物品栏ARMOR kjl = armor[0]; //盔甲栏 做出盔甲立即替换const int xgmax = 5; //可获得的效果总数BUFF xgl[xgmax]; //效果栏int xgnum; //已拥有BUFFint fknum[5], wpnum[5]; //数量(max:64)int now = 0; //目前手持方块/物品 0~4方块 5~9物品int playerx = 1200, playery = 700; //冒险者 坐标double health = 20; //生命double max_health = 20; //生命值上限int oxygen = 20; //氧气int energy = 0; //跳跃能量int wjjd = 0; //挖掘进度int zhuiluo = 0; //连续坠落格数int level = 0, xp = 0; //等级、经验bool tick_attack = false; //本tick是否受伤void print_data();void input_data();29 行未改动};//下界城市//核心int nc_core[9][9] ={{0, 0, 0, 1, 2, 1, 0, 0, 0},{0, 0, 1, 1, 2, 1, 1, 0, 0},{0, 1, 1, 2, 2, 2, 1, 1, 0},4 行未改动{0, 0, 1, 1, 2, 1, 1, 0, 0},{0, 0, 0, 1, 2, 1, 0, 0, 0}};//水平廊道int nc_cz_ld[9][9] ={{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},4 行未改动{0, 0, 0, 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0, 0, 0}};//垂直廊道int nc_sp_ld[9][9] ={{0, 0, 0, 1, 2, 1, 0, 0, 0},{0, 0, 0, 1, 2, 1, 0, 0, 0},{0, 0, 0, 1, 2, 1, 0, 0, 0},402 行未改动全部展开}}}void init() //生成世界{cout << "2%" << endl;for(int x = 0;x < 2400;x++) //填充空气{for(int y = 0;y < 1200;y++) block_copy(x, y, 19);}cout << "4%" << endl;for(int y = 1;y < 1200;y++) //边界{for(int x = 0;x <= 198;x++) block_copy(x, y, 18);for(int x = 2301;x <= 2399;x++) block_copy(x, y, 18);block_copy(199, y, 0);block_copy(2300, y, 0);}cout << "6%" << endl;int stgd[2400]; //石头高度(海平面700)//生成主世界构造//确认x坐标下石头高度 (第一次构造)stgd[1200] = 200; //默认值for(int x = 1199;x >= 200;x--){if(random(0, 1000) <= 500){stgd[x] = stgd[x + 1] - random(0, 2) + random(0, 2); //小变动}else if(random(0, 1000) <= 100){int add = random(0, 20);add -= 10;stgd[x] = stgd[x + 1] + add; //断崖式变动}else{stgd[x] = stgd[x + 1]; //无变动}if(stgd[x] > 210) stgd[x] = 210;if(stgd[x] < 160) stgd[x] = 160;}cout << "12%" << endl;for(int x = 1201;x < 2300;x++)5 行未改动else if(random(0, 1000) <= 100){int add = random(0, 20);add -= 10;stgd[x] = stgd[x - 1] + add;}else{stgd[x] = stgd[x - 1];7 行未改动{for(int y = 501;y <= 501 + stgd[x];y++){block_copy(x, y, 1);//生成铁矿和金矿if(random(1, 10000) <= 100){block_copy(x, y, 5);}else if(random(1, 10000) <= 300){block_copy(x, y, 7);}//生成钻石if(y <= 515 && random(1, 10000) <= 50){block_copy(x, y, 9);}25 行未改动{for(int y = 501 + stgd[x] + 1;y <= 700;y++){if(world[x][y].id != 12) continue;//海之环生成bool flag = true;for(int xx = x - 3;xx <= x + 5;xx++){for(int yy = y - 3;yy <= y + 5;yy++)2 行未改动}}if(flag && random(1, 10000) < 6) //符合条件{bool haizhihuan[9][9] ={{0, 0, 1, 1, 1, 1, 1, 0, 0},{0, 1, 1, 0, 0, 0, 1, 1, 0},{1, 1, 0, 0, 1, 0, 0, 1, 1},17 行未改动}}}cout << "27%" << endl;//最上3层为泥土for(int x = 200;x < 2300;x++){int dian = random(1, 10000);int tree = random(1, 10000);11 行未改动block_copy(x, 501 + stgd[x] + 5, 11);block_copy(x - 1, 501 + stgd[x] + 5, 11);block_copy(x + 1, 501 + stgd[x] + 5, 11);block_copy(x, 501 + stgd[x] + 6, 11);}//生成高树else if(tree <= 310){block_copy(x, 501 + stgd[x] + 2, 4);104 行未改动全部展开block_copy(x - 1, y + 10, 24);block_copy(x + 1, y + 10, 24);block_copy(x, y + 10, 24);}//生成地牢else if(tree <= 415 || x == 1200){int t_high = rand() % 20 + 60;for(int i = 0;i < 27;i++)33 行未改动block_copy(x + 2, y + 7, 5);block_copy(x - 1, y + 8, 22);block_copy(x + 1, y + 8, 22);block_copy(x, y + 6, 16);block_copy(x, y + 10, 28);break;}}}45 行未改动if(random(1, 100) == 1 || (x == 1200 && y == 400)){chengshi(x, y);}}}}playery = 501 + stgd[1200] + 3;}232 行未改动全部展开}}}void attack(int hurt_num, string die_str) //造成伤害{if(gamemode == 1) return;double hurt;hurt = hurt_num * (1.0 - (kjl.defease) * 0.04);//对高伤害进行削弱int i = 0;double shjm = 0.0;for(int xxx = 0;xxx <= kjl.defease;xxx++){shjm += 0.012 * (1.0 - (xxx * 0.04));}if(hurt >= 150){hurt = 150 + sqrt(hurt - 150);}hurt -= hurt * 0.1 + shjm;if(get_buff_level(buff[3]) > 0) hurt -= get_buff_level(buff[3]); //生命吸收health -= hurt;tick_attack = true;if(health < 0 && gamemode == 2) //玩家死亡 极限模式=删除存档{system("cls");SetPos(2, 2);cout << "GAME OVER";27 行未改动}void input_data() //输入数据{ifstream fin("data.txt", ios::in);for(int i = 0;i < 2400;i++){for(int j = 0;j < 1200;j++){47 行未改动fin >> gamemode;fin >> level >> xp >> max_health;}void print_data() //输出数据{ofstream fout("data.txt", ios::out);for(int i = 0;i < 2400;i++){for(int j = 0;j < 1200;j++){6 行未改动fout << playerx << endl << playery << endl;for(int i = 0;i < 5;i++) fout << fknum[i] << ' ' << wpnum[i] << endl;for(int i = 0;i < 5;i++){fout << fkl[i].id << ' ' << wpl[i].id << endl;}fout << kjl.id << endl;fout << xgnum << endl;for(int i = 0;i < xgnum;i++)5 行未改动fout << gamemode << endl;fout << level << endl << xp << endl << max_health << endl;}void item_choose() //创造物品选择器{system("cls");SetPos(10, 1);cout << "创造模式物品选择器:";4 行未改动while(1){SetPos(10, 7);cout << "手中物品:";if(now <= 4) //显示方块{Color(fkl[now].color), cout << fkl[now].txt << ' ' << fkl[now].name;cout << " ";Color(0);}else //显示物品{if(wpl[now - 5].rare == 0) Color(0);else if(wpl[now - 5].rare == 1) Color(1);else if(wpl[now - 5].rare == 2) Color(3);647 行未改动全部展开cout << "1 灵魂镐";SetPos(10, 5);cout << "2 灵魂剑";SetPos(10, 7);cout << "3 灵魂之星";SetPos(10, 9);cout << "3 离开";char cft16 = input('1', '4');if(cft16 == '1')306 行未改动全部展开}}else if(cft21 == '5'){return;}}else if(cft2 == '2'){456 行未改动全部展开system("cls");while(1){Sleep(100);//时刻流逝short_tick++;if(short_tick == 10){short_tick = 0;3 行未改动if(zhongdulevel > 0) attack(zhongdulevel, "玩家中毒而死");}if(jianweitishi) jianweitishi--;if(wajuetishi) wajuetishi--;//处理药水效果buff_merge();buff_live();//处理生命溢出8 行未改动{i++;xp -= 100 + (level + 1) * 10;level++;if(level % 2 == 0) max_health++; //每两级加一滴血}SetPos(0, 0);cout << "世界与我 Craft And My";SetPos(0, 1);if(get_buff_level(buff[4])) Color(5);else Color(2);double the_mx = max_health + get_buff_level(buff[1]) * 4; //生命上限int h = health;int heart = h / the_mx * 10;for(int i = 0;i < heart;i++) cout << "◆"; //生命值int y = h / (the_mx / 10);for(int z = heart;z < 10;z++) cout << "◇";cout << ' ' << fixed << setprecision(1) << health << " ";Color(0);SetPos(0, 2);Color(3);for(int i = 2;i <= oxygen;i += 2) cout << "●"; //氧气值int u = oxygen / 2;for(int v = u + 1;v <= 10;v++) cout << "○";cout << ' ' << fixed << setprecision(1) << oxygen << " ";Color(0);SetPos(0, 3);for(int i = 2;i <= kjl.defease;i += 2) cout << "▼"; //盔甲SetPos(69, 2); //输出玩家坐标cout << "X:" << playerx;SetPos(69, 4);cout << "Y:" << playery;for(int i = 0;i < 5;i++) //打印物品栏 方块栏{SetPos(69, 6 + i * 2);if(now == i) Color(5);else if(wajuetishi) Color(2);54 行未改动cout << "S键保存当前存档";if(gamemode == 0 || gamemode == 2){SetPos(0, 28);cout << "Q键摧毁手持物品";}else{SetPos(0, 28);28 行未改动else if(j == playerx - 1 && i == playery){Color(5), cout << "A<";Color(0);continue;}else if(j == playerx + 1 && i == playery){Color(5), cout << "D>";50 行未改动{health++;if(health > the_mx) health = the_mx;}//重力下落if(zhuiluo < 4 && (tick * 10 + short_tick) % 3 == 0){if(world[playerx][playery - 1].fluid){playery--;zhuiluo++;}else //落地{if(zhuiluo > 9) attack((zhuiluo - 9), "玩家摔死了");//摔落伤害zhuiluo = 0;}}//快速下落else if(zhuiluo >= 4 && zhuiluo < 8 && short_tick % 2 == 0){if(world[playerx][playery - 1].fluid){playery--;zhuiluo++;}else //落地{if(zhuiluo > 9) attack((zhuiluo - 9), "玩家摔死了"); //摔落伤害zhuiluo = 0;}}//危险下落else if(zhuiluo >= 8 && short_tick % 3 <= 1){if(world[playerx][playery - 1].fluid){playery--;zhuiluo++;}else //落地{if(zhuiluo > 9) attack(sqrt(zhuiluo - 9), "玩家摔死了"); //摔落伤害zhuiluo = 0;}}//岩浆10 行未改动if(world[playerx][playery].id == 35){attack(5, "玩家在死水中化为飞灰");}//氧气值下降if(short_tick == 0){if(world[playerx][playery].fluid && !(world[playerx][playery].name == "空气")){oxygen--;if(oxygen < 0){//氧气耗尽oxygen = 0;attack(1, "玩家窒息而死");}}else if(oxygen < 20){oxygen++; //若玩家不在流体中则恢复氧气}}if(energy > 0) //跳跃{if(world[playerx][playery + 1].fluid){playery++;2 行未改动else energy = 0;if(energy < 0) energy = 0;}char x;if(_kbhit()) //按键点击{x = _getch();if(x == 'a'){20 行未改动{now = x - '0';wjjd = 0;}else if(x == 'i') //挖掘上方方块/放置方块在上方{//桶的收集判定if(now >= 5 && wpl[now - 5].id == 18){47 行未改动block_copy(playerx, playery + 1, 32);Sleep(1000);bomb(playerx, playery + 1, 4);}//其它判定if(world[playerx][playery + 1].fluid && now <= 4){wajuetishi = 20;if(fknum[now] > 0 && fkl[now].id != 0){block_copy(playerx, playery + 1, fkl[now].id);block_delete(fkl[now]);}}82 行未改动block_copy(playerx, playery - 1, 32);Sleep(1000);bomb(playerx, playery - 1, 4);}//其它判定if(world[playerx][playery - 1].fluid && now <= 4){wajuetishi = 20;if(fknum[now] > 0 && fkl[now].id != 0)87 行未改动block_copy(playerx - 1, playery, 32);Sleep(1000);bomb(playerx - 1, playery, 4);}//其它判定if(world[playerx - 1][playery].fluid && now <= 4){wajuetishi = 20;if(fknum[now] > 0 && fkl[now].id != 0)87 行未改动block_copy(playerx + 1, playery, 32);Sleep(1000);bomb(playerx + 1, playery, 4);}//其它判定if(world[playerx + 1][playery].fluid && now <= 4){wajuetishi = 20;if(fknum[now] > 0 && fkl[now].id != 0)43 行未改动print_data();}else if(x == 'q'){if(gamemode == 1) item_choose(); //创造物品选择器else if(now >= 4) wpnum[now - 5]--;}else if(x == 'z'){269 行未改动全部展开SetPos(2, 8);cout << "现在向左移动";x = input('a', 'a');SetPos(44, 6);Color(5), cout << "d";SetPos(2, 8);cout << "现在向右移动";x = input('d', 'd');SetPos(2, 8);46 行未改动Color(cnt[2]), cout << "l";SetPos(62, 8);Color(cnt[3]), cout << "k";char y = ' ';if(_kbhit()) y = input();if(y == 'i') cnt[0] = max(cnt[0] - 1, 0);if(y == 'j') cnt[1] = max(cnt[1] - 1, 0);if(y == 'l') cnt[2] = max(cnt[2] - 1, 0);if(y == 'k') cnt[3] = max(cnt[3] - 1, 0);27 行未改动}int main(){//世界准备system("mode con cols=130 lines=35");srand(time(0));HideCursor();SetConsoleTitle("世界与我 0.8_v2.3");cundang:cout << "Craft and My: 世界与我" << endl;cout << "1 使用原先存档" << endl;cout << "2 重置新的世界" << endl;cout << "3 查看更新日志" << endl;cout << "4 新手教程(";Color(5), cout << "新人必看";Color(0), cout << ")" << endl;cout << "版本: 测试版0.8_v2.3" << endl;char n = input('1', '4');if(n == '1') input_data();else if(n == '2'){132 行未改动全部展开Color(6), cout << "内部版0.7pre3" << endl, Color(0);cout << "- 修改游戏名称" << endl;system("pause");system("cls");break;case '7':Color(6), cout << "内部版0.7pre4" << endl, Color(0);cout << "- 修复一些漏洞" << endl;system("pause");system("cls");break;case '8':Color(5), cout << "测试版0.7" << endl, Color(0);cout << "- 修改give命令" << endl;cout << "- 新增1个命令" << endl;cout << "- 修改主界面" << endl;cout << "- 重置存档时允许输入种子" << endl;cout << "- 修复一些漏洞" << endl;system("pause");system("cls");break;case '9':Color(5), cout << "测试版0.7a" << endl, Color(0);cout << "- 修改提升了程序的兼容性" << endl;system("pause");25 行未改动cout << "- 全新结构:宝藏岛登场!" << endl;cout << "- 下界地形优化:不再填满方块!" << endl;cout << "- 新增多个物品、方块" << endl;cout << "- 新增等级系统" << endl;cout << "- 其它一些小改动or小优化" << endl;system("pause");system("cls");break;case '4':Color(6), cout << "内部版0.8pre1.1" << endl, Color(0);cout << "- 宝藏探测器的一点小更改" << endl;cout << "- 补上了0.8pre1漏掉的一个小改动" << endl;cout << "- 等级系统BUG修复" << endl;system("pause");system("cls");break;case '5':Color(6), cout << "内部版0.8pre1.2" << endl, Color(0);cout << "- 大整改!!!" << endl;cout << "- 爆炸更新:添加了巨大的爆炸系统!" << endl;cout << "- 指令更新:增加了许多种指令!" << endl;cout << "- 伤害更新:大幅提升了高伤害时的减免!" << endl;cout << "- 经验更新:经验等级现在与生命值和挖掘速度挂钩!" << endl;22 行未改动cout << "- 修复了死亡后重生在地底的BUG" << endl;cout << "- 新增一个修改氧气值的指令" << endl;cout << "- 更改伤害指令的死亡信息" << endl;system("pause");system("cls");break;case '9':Color(5), cout << "测试版0.8_v2" << endl, Color(0);cout << "- 灵魂地牢更新:" << endl;26 行未改动cout << "- 改摔伤 降低了摔落伤害 同时修复了单次坠落格数过高时无法再跳跃的问题" << endl;cout << "- 修改了硬度系统 增高降低了某些方块的硬度 调高了一些镐子的挖掘速度" << endl;cout << "- 增大了海之环" << endl;system("pause");system("cls");case '3':Color(5), cout << "测试版0.8_v2.3" << endl, Color(0);cout << "- 修改宝藏岛 让它的生成变得更难" << endl;cout << "- 增加了未完成的下界要塞:生成机制重做中" << endl;16 行未改动system("cls");jiaocheng();}minecraft();return 0;}```10 行未改动11121314151617181920212223242526272829303132333435363738395 行未改动45464748495051525328 行未改动82838485868788899091929394959697989910010110210310410510610726 行未改动13413513613713813914014114214314414514614714814915015115215315445 行未改动20020120220320420520620720820914 行未改动22422522622722822923023123223323423523623723823924024124224324424524624724824925025129 行未改动2812822832842852862872882894 行未改动2942952962972982993003013024 行未改动307308309310311312313314315402 行未改动全部展开7187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617625 行未改动7687697707717727737747757767 行未改动78478578678778878979079179279379479579679779879980080180225 行未改动8288298308318328338348358362 行未改动83984084184284384484584684717 行未改动86586686786886987087187287311 行未改动885886887888889890891892893104 行未改动全部展开998999100010011002100310041005100633 行未改动10401041104210431044104510461047104845 行未改动109410951096109710981099110011011102232 行未改动全部展开1335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136327 行未改动13911392139313941395139613971398139947 行未改动144714481449145014511452145314541455145614576 行未改动1464146514661467146814691470147114725 行未改动1478147914801481148214831484148514864 行未改动149114921493149414951496149714981499150015011502150315041505647 行未改动全部展开215321542155215621572158215921602161306 行未改动全部展开246824692470247124722473247424752476456 行未改动全部展开2933293429352936293729382939294029413 行未改动2945294629472948294929502951295229538 行未改动2962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299954 行未改动30543055305630573058305930603061306228 行未改动30913092309330943095309630973098309950 行未改动3150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319610 行未改动3207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232332 行未改动32363237323832393240324132423243324420 行未改动32653266326732683269327032713272327347 行未改动3321332233233324332533263327332833293330333133323333333482 行未改动34173418341934203421342234233424342587 行未改动35133514351535163517351835193520352187 行未改动36093610361136123613361436153616361743 行未改动366136623663366436653666366736683669269 行未改动全部展开39393940394139423943394439453946394746 行未改动39943995399639973998399940004001400227 行未改动4030403140324033403440354036403740384039404040414042404340444045404640474048404940504051132 行未改动全部展开418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420825 行未改动4234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425622 行未改动42794280428142824283428442854286428726 行未改动43144315431643174318431943204321432216 行未改动433943404341434243434344434510 行未改动}Frame;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);//红if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);//蓝if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);//粉if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);//黄if(a==5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);//灰if(a==6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);//棕if(a==7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN);//随机if(a == -1) Color(rand() % 8);}void SetPos(COORD a)// set cursor{HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorPosition(out, a);}5 行未改动}void HideCursor(){CONSOLE_CURSOR_INFO cursor_info = {1, 0};SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);}char input()28 行未改动int id;string txt;int color;int hard;int level; //挖掘等级(0=徒手 1=木 2=石 3=铁 4=钻石 5=合金)string name;bool fluid; //是否为流体(可以穿越 能够替换成方块)};BLOCK block[] = //方块{{0, "□", 0, 2000000000, 100, "基岩", false},{1, "■", 6, 250, 1, "石头", false},{2, "▓ ", 7, 75, 0, "泥土", false},{3, "▓ ", 6, 75, 0, "砂砾", false},{4, "■", 5, 80, 0, "木头", false},{5, "※", 0, 500, 2, "铁矿石", false},{6, "∷", 0, 500, 2, "铁块", false},{7, "※", 5, 600, 3, "金矿石", false},{8, "∷", 5, 600, 3, "金块", false},{9, "※", 3, 900, 3, "钻石矿石", false},{10, "∷", 3, 900, 3, "钻石块", false},{11, "▓ ", 1, 20, 0, "树叶", false},{12, "■", 3, 2000000000, 100, "水", true},{13, "□", 2, 2000000000, 100, "岩浆", true},{14, "□", 0, 2000, 4, "真正的基岩", false},26 行未改动struct ITEM{int id;int hurt;int speed; //每个短刻的挖掘进度int level;string name;int rare; //稀有度 白0<绿1<蓝2<紫3<幻4};ITEM item[] = //物品{{0, 0, 0, 0, "空气", 0},{1, 2, 20, 1, "木镐", 0},{2, 5, 0, 1, "木剑", 0},{3, 3, 40, 2, "石镐", 0},{4, 6, 0, 2, "石剑", 0},{5, 0, 0, 0, "铁锭", 0},{6, 4, 80, 3, "铁镐", 0},{7, 9, 0, 3, "铁剑", 0},{8, 0, 0, 0, "金锭", 1},45 行未改动struct BUFF{int id;string name;int level; //等级 默认为0 1级以上显示在玩家属性页面中int time; //单位: short_tick 降至0后等级降至0级};BUFF buff[] = //效果{14 行未改动"获得护盾 每级提升1点免伤值","负面效果 每级每个构造刻受到1点伤害"};int gamemode = 0; //0=生存 1=创造 2=极限int short_tick = 0, tick = 0; //短刻(每秒10次)和构造刻(每秒1次)BLOCK world[2400][1200]; //地图 x0~2399 y0~1199BLOCK fkl[5]; //方块栏ITEM wpl[5]; //物品栏ARMOR kjl = armor[0]; //盔甲栏 做出盔甲立即替换const int xgmax = 5; //可获得的效果总数BUFF xgl[xgmax]; //效果栏int xgnum; //已拥有BUFFint fknum[5], wpnum[5]; //数量(max:64)int now = 0; //目前手持方块/物品 0~4方块 5~9物品int playerx = 1200, playery = 700; //冒险者 坐标double health = 20; //生命double max_health = 20; //生命值上限int oxygen = 20; //氧气int energy = 0; //跳跃能量int wjjd = 0; //挖掘进度int zhuiluo = 0; //连续坠落格数int level = 0, xp = 0; //等级、经验bool tick_attack = false; //本tick是否受伤void print_data();void input_data();29 行未改动};//下界城市//核心int nc_core[9][9] ={{0, 0, 0, 1, 2, 1, 0, 0, 0},{0, 0, 1, 1, 2, 1, 1, 0, 0},{0, 1, 1, 2, 2, 2, 1, 1, 0},4 行未改动{0, 0, 1, 1, 2, 1, 1, 0, 0},{0, 0, 0, 1, 2, 1, 0, 0, 0}};//水平廊道int nc_cz_ld[9][9] ={{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},4 行未改动{0, 0, 0, 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0, 0, 0}};//垂直廊道int nc_sp_ld[9][9] ={{0, 0, 0, 1, 2, 1, 0, 0, 0},{0, 0, 0, 1, 2, 1, 0, 0, 0},{0, 0, 0, 1, 2, 1, 0, 0, 0},402 行未改动全部展开}}}void init() //生成世界{cout << "2%" << endl;for(int x = 0;x < 2400;x++) //填充空气{for(int y = 0;y < 1200;y++) block_copy(x, y, 19);}cout << "4%" << endl;for(int y = 1;y < 1200;y++) //边界{for(int x = 0;x <= 198;x++) block_copy(x, y, 18);for(int x = 2301;x <= 2399;x++) block_copy(x, y, 18);block_copy(199, y, 0);block_copy(2300, y, 0);}cout << "6%" << endl;int stgd[2400]; //石头高度(海平面700)//生成主世界构造//确认x坐标下石头高度 (第一次构造)stgd[1200] = 200; //默认值for(int x = 1199;x >= 200;x--){if(random(0, 1000) <= 500){stgd[x] = stgd[x + 1] - random(0, 2) + random(0, 2); //小变动}else if(random(0, 1000) <= 100){int add = random(0, 20);add -= 10;stgd[x] = stgd[x + 1] + add; //断崖式变动}else{stgd[x] = stgd[x + 1]; //无变动}if(stgd[x] > 210) stgd[x] = 210;if(stgd[x] < 160) stgd[x] = 160;}cout << "12%" << endl;for(int x = 1201;x < 2300;x++)5 行未改动else if(random(0, 1000) <= 100){int add = random(0, 20);add -= 10;stgd[x] = stgd[x - 1] + add;}else{stgd[x] = stgd[x - 1];7 行未改动{for(int y = 501;y <= 501 + stgd[x];y++){block_copy(x, y, 1);//生成铁矿和金矿if(random(1, 10000) <= 100){block_copy(x, y, 5);}else if(random(1, 10000) <= 300){block_copy(x, y, 7);}//生成钻石if(y <= 515 && random(1, 10000) <= 50){block_copy(x, y, 9);}25 行未改动{for(int y = 501 + stgd[x] + 1;y <= 700;y++){if(world[x][y].id != 12) continue;//海之环生成bool flag = true;for(int xx = x - 3;xx <= x + 5;xx++){for(int yy = y - 3;yy <= y + 5;yy++)2 行未改动}}if(flag && random(1, 10000) < 6) //符合条件{bool haizhihuan[9][9] ={{0, 0, 1, 1, 1, 1, 1, 0, 0},{0, 1, 1, 0, 0, 0, 1, 1, 0},{1, 1, 0, 0, 1, 0, 0, 1, 1},17 行未改动}}}cout << "27%" << endl;//最上3层为泥土for(int x = 200;x < 2300;x++){int dian = random(1, 10000);int tree = random(1, 10000);11 行未改动block_copy(x, 501 + stgd[x] + 5, 11);block_copy(x - 1, 501 + stgd[x] + 5, 11);block_copy(x + 1, 501 + stgd[x] + 5, 11);block_copy(x, 501 + stgd[x] + 6, 11);}//生成高树else if(tree <= 310){block_copy(x, 501 + stgd[x] + 2, 4);104 行未改动全部展开block_copy(x - 1, y + 10, 24);block_copy(x + 1, y + 10, 24);block_copy(x, y + 10, 24);}//生成地牢else if(tree <= 415 || x == 1200){int t_high = rand() % 20 + 60;for(int i = 0;i < 27;i++)33 行未改动block_copy(x + 2, y + 7, 5);block_copy(x - 1, y + 8, 22);block_copy(x + 1, y + 8, 22);block_copy(x, y + 6, 16);block_copy(x, y + 10, 28);break;}}}45 行未改动if(random(1, 100) == 1 || (x == 1200 && y == 400)){chengshi(x, y);}}}}playery = 501 + stgd[1200] + 3;}232 行未改动全部展开}}}void attack(int hurt_num, string die_str) //造成伤害{if(gamemode == 1) return;double hurt;hurt = hurt_num * (1.0 - (kjl.defease) * 0.04);//对高伤害进行削弱int i = 0;double shjm = 0.0;for(int xxx = 0;xxx <= kjl.defease;xxx++){shjm += 0.012 * (1.0 - (xxx * 0.04));}if(hurt >= 150){hurt = 150 + sqrt(hurt - 150);}hurt -= hurt * 0.1 + shjm;if(get_buff_level(buff[3]) > 0) hurt -= get_buff_level(buff[3]); //生命吸收health -= hurt;tick_attack = true;if(health < 0 && gamemode == 2) //玩家死亡 极限模式=删除存档{system("cls");SetPos(2, 2);cout << "GAME OVER";27 行未改动}void input_data() //输入数据{ifstream fin("data.txt", ios::in);for(int i = 0;i < 2400;i++){for(int j = 0;j < 1200;j++){47 行未改动fin >> gamemode;fin >> level >> xp >> max_health;}void print_data() //输出数据{ofstream fout("data.txt", ios::out);for(int i = 0;i < 2400;i++){for(int j = 0;j < 1200;j++){6 行未改动fout << playerx << endl << playery << endl;for(int i = 0;i < 5;i++) fout << fknum[i] << ' ' << wpnum[i] << endl;for(int i = 0;i < 5;i++){fout << fkl[i].id << ' ' << wpl[i].id << endl;}fout << kjl.id << endl;fout << xgnum << endl;for(int i = 0;i < xgnum;i++)5 行未改动fout << gamemode << endl;fout << level << endl << xp << endl << max_health << endl;}void item_choose() //创造物品选择器{system("cls");SetPos(10, 1);cout << "创造模式物品选择器:";4 行未改动while(1){SetPos(10, 7);cout << "手中物品:";if(now <= 4) //显示方块{Color(fkl[now].color), cout << fkl[now].txt << ' ' << fkl[now].name;cout << " ";Color(0);}else //显示物品{if(wpl[now - 5].rare == 0) Color(0);else if(wpl[now - 5].rare == 1) Color(1);else if(wpl[now - 5].rare == 2) Color(3);647 行未改动全部展开cout << "1 灵魂镐";SetPos(10, 5);cout << "2 灵魂剑";SetPos(10, 7);cout << "3 灵魂之星";SetPos(10, 9);cout << "3 离开";char cft16 = input('1', '4');if(cft16 == '1')306 行未改动全部展开}}else if(cft21 == '5'){return;}}else if(cft2 == '2'){456 行未改动全部展开system("cls");while(1){Sleep(100);//时刻流逝short_tick++;if(short_tick == 10){short_tick = 0;3 行未改动if(zhongdulevel > 0) attack(zhongdulevel, "玩家中毒而死");}if(jianweitishi) jianweitishi--;if(wajuetishi) wajuetishi--;//处理药水效果buff_merge();buff_live();//处理生命溢出8 行未改动{i++;xp -= 100 + (level + 1) * 10;level++;if(level % 2 == 0) max_health++; //每两级加一滴血}SetPos(0, 0);cout << "世界与我 Craft And My";SetPos(0, 1);if(get_buff_level(buff[4])) Color(5);else Color(2);double the_mx = max_health + get_buff_level(buff[1]) * 4; //生命上限int h = health;int heart = h / the_mx * 10;for(int i = 0;i < heart;i++) cout << "◆"; //生命值int y = h / (the_mx / 10);for(int z = heart;z < 10;z++) cout << "◇";cout << ' ' << fixed << setprecision(1) << health << " ";Color(0);SetPos(0, 2);Color(3);for(int i = 2;i <= oxygen;i += 2) cout << "●"; //氧气值int u = oxygen / 2;for(int v = u + 1;v <= 10;v++) cout << "○";cout << ' ' << fixed << setprecision(1) << oxygen << " ";Color(0);SetPos(0, 3);for(int i = 2;i <= kjl.defease;i += 2) cout << "▼"; //盔甲SetPos(69, 2); //输出玩家坐标cout << "X:" << playerx;SetPos(69, 4);cout << "Y:" << playery;for(int i = 0;i < 5;i++) //打印物品栏 方块栏{SetPos(69, 6 + i * 2);if(now == i) Color(5);else if(wajuetishi) Color(2);54 行未改动cout << "S键保存当前存档";if(gamemode == 0 || gamemode == 2){SetPos(0, 28);cout << "Q键摧毁手持物品";}else{SetPos(0, 28);28 行未改动else if(j == playerx - 1 && i == playery){Color(5), cout << "A<";Color(0);continue;}else if(j == playerx + 1 && i == playery){Color(5), cout << "D>";50 行未改动{health++;if(health > the_mx) health = the_mx;}//重力下落if(zhuiluo < 4 && (tick * 10 + short_tick) % 3 == 0){if(world[playerx][playery - 1].fluid){playery--;zhuiluo++;}else //落地{if(zhuiluo > 9) attack((zhuiluo - 9), "玩家摔死了");//摔落伤害zhuiluo = 0;}}//快速下落else if(zhuiluo >= 4 && zhuiluo < 8 && short_tick % 2 == 0){if(world[playerx][playery - 1].fluid){playery--;zhuiluo++;}else //落地{if(zhuiluo > 9) attack((zhuiluo - 9), "玩家摔死了"); //摔落伤害zhuiluo = 0;}}//危险下落else if(zhuiluo >= 8 && short_tick % 3 <= 1){if(world[playerx][playery - 1].fluid){playery--;zhuiluo++;}else //落地{if(zhuiluo > 9) attack(sqrt(zhuiluo - 9), "玩家摔死了"); //摔落伤害zhuiluo = 0;}}//岩浆10 行未改动if(world[playerx][playery].id == 35){attack(5, "玩家在死水中化为飞灰");}//氧气值下降if(short_tick == 0){if(world[playerx][playery].fluid && !(world[playerx][playery].name == "空气")){oxygen--;if(oxygen < 0){//氧气耗尽oxygen = 0;attack(1, "玩家窒息而死");}}else if(oxygen < 20){oxygen++; //若玩家不在流体中则恢复氧气}}if(energy > 0) //跳跃{if(world[playerx][playery + 1].fluid){playery++;2 行未改动else energy = 0;if(energy < 0) energy = 0;}char x;if(_kbhit()) //按键点击{x = _getch();if(x == 'a'){20 行未改动{now = x - '0';wjjd = 0;}else if(x == 'i') //挖掘上方方块/放置方块在上方{//桶的收集判定if(now >= 5 && wpl[now - 5].id == 18){47 行未改动block_copy(playerx, playery + 1, 32);Sleep(1000);bomb(playerx, playery + 1, 4);}//其它判定if(world[playerx][playery + 1].fluid && now <= 4){wajuetishi = 20;if(fknum[now] > 0 && fkl[now].id != 0){block_copy(playerx, playery + 1, fkl[now].id);block_delete(fkl[now]);}}82 行未改动block_copy(playerx, playery - 1, 32);Sleep(1000);bomb(playerx, playery - 1, 4);}//其它判定if(world[playerx][playery - 1].fluid && now <= 4){wajuetishi = 20;if(fknum[now] > 0 && fkl[now].id != 0)87 行未改动block_copy(playerx - 1, playery, 32);Sleep(1000);bomb(playerx - 1, playery, 4);}//其它判定if(world[playerx - 1][playery].fluid && now <= 4){wajuetishi = 20;if(fknum[now] > 0 && fkl[now].id != 0)87 行未改动block_copy(playerx + 1, playery, 32);Sleep(1000);bomb(playerx + 1, playery, 4);}//其它判定if(world[playerx + 1][playery].fluid && now <= 4){wajuetishi = 20;if(fknum[now] > 0 && fkl[now].id != 0)43 行未改动print_data();}else if(x == 'q'){if(gamemode == 1) item_choose(); //创造物品选择器else if(now >= 4) wpnum[now - 5]--;}else if(x == 'z'){269 行未改动全部展开SetPos(2, 8);cout << "现在向左移动";x = input('a', 'a');SetPos(44, 6);Color(5), cout << "d";SetPos(2, 8);cout << "现在向右移动";x = input('d', 'd');SetPos(2, 8);46 行未改动Color(cnt[2]), cout << "l";SetPos(62, 8);Color(cnt[3]), cout << "k";char y = ' ';if(_kbhit()) y = input();if(y == 'i') cnt[0] = max(cnt[0] - 1, 0);if(y == 'j') cnt[1] = max(cnt[1] - 1, 0);if(y == 'l') cnt[2] = max(cnt[2] - 1, 0);if(y == 'k') cnt[3] = max(cnt[3] - 1, 0);27 行未改动}int main(){//世界准备system("mode con cols=130 lines=35");srand(time(0));HideCursor();SetConsoleTitle("世界与我 0.8_v2.3");cundang:cout << "Craft and My: 世界与我" << endl;cout << "1 使用原先存档" << endl;cout << "2 重置新的世界" << endl;cout << "3 查看更新日志" << endl;cout << "4 新手教程(";Color(5), cout << "新人必看";Color(0), cout << ")" << endl;cout << "版本: 测试版0.8_v2.3" << endl;char n = input('1', '4');if(n == '1') input_data();else if(n == '2'){132 行未改动全部展开Color(6), cout << "内部版0.7pre3" << endl, Color(0);cout << "- 修改游戏名称" << endl;system("pause");system("cls");break;case '7':Color(6), cout << "内部版0.7pre4" << endl, Color(0);cout << "- 修复一些漏洞" << endl;system("pause");system("cls");break;case '8':Color(5), cout << "测试版0.7" << endl, Color(0);cout << "- 修改give命令" << endl;cout << "- 新增1个命令" << endl;cout << "- 修改主界面" << endl;cout << "- 重置存档时允许输入种子" << endl;cout << "- 修复一些漏洞" << endl;system("pause");system("cls");break;case '9':Color(5), cout << "测试版0.7a" << endl, Color(0);cout << "- 修改提升了程序的兼容性" << endl;system("pause");25 行未改动cout << "- 全新结构:宝藏岛登场!" << endl;cout << "- 下界地形优化:不再填满方块!" << endl;cout << "- 新增多个物品、方块" << endl;cout << "- 新增等级系统" << endl;cout << "- 其它一些小改动or小优化" << endl;system("pause");system("cls");break;case '4':Color(6), cout << "内部版0.8pre1.1" << endl, Color(0);cout << "- 宝藏探测器的一点小更改" << endl;cout << "- 补上了0.8pre1漏掉的一个小改动" << endl;cout << "- 等级系统BUG修复" << endl;system("pause");system("cls");break;case '5':Color(6), cout << "内部版0.8pre1.2" << endl, Color(0);cout << "- 大整改!!!" << endl;cout << "- 爆炸更新:添加了巨大的爆炸系统!" << endl;cout << "- 指令更新:增加了许多种指令!" << endl;cout << "- 伤害更新:大幅提升了高伤害时的减免!" << endl;cout << "- 经验更新:经验等级现在与生命值和挖掘速度挂钩!" << endl;22 行未改动cout << "- 修复了死亡后重生在地底的BUG" << endl;cout << "- 新增一个修改氧气值的指令" << endl;cout << "- 更改伤害指令的死亡信息" << endl;system("pause");system("cls");break;case '9':Color(5), cout << "测试版0.8_v2" << endl, Color(0);cout << "- 灵魂地牢更新:" << endl;26 行未改动cout << "- 改摔伤 降低了摔落伤害 同时修复了单次坠落格数过高时无法再跳跃的问题" << endl;cout << "- 修改了硬度系统 增高降低了某些方块的硬度 调高了一些镐子的挖掘速度" << endl;cout << "- 增大了海之环" << endl;system("pause");system("cls");case '3':Color(5), cout << "测试版0.8_v2.3" << endl, Color(0);cout << "- 修改宝藏岛 让它的生成变得更难" << endl;cout << "- 增加了未完成的下界要塞:生成机制重做中" << endl;16 行未改动system("cls");jiaocheng();}minecraft();return 0;}```