C++#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
typedef struct Frame
{
COORD position[2];
}Frame;
int to_int(float a) {if(a>0) return int(a+0.5);else if(a<0) return int(-a-0.5);if(a==0) return 0;}
//绝对值四舍五入
float Sin(int a) {return sin(3.1416*a/180);}
float Cos(int a) {return cos(3.1416*a/180);}
//多少度。例:Sin(30)=0.5
float SinP(int a) {return sin(3.1416*a);}
float CosP(int a) {return cos(3.1416*a);}
//多少pai。例:SinP(1)=0
bool dark = false;
void Color(int a)
{
if(dark) return;
//白
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==8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
//随机
if(a == -1) Color(rand() % 8);
}
void SetPos(COORD a)// set cursor
{
HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(out, a);
}
void SetPos(int i, int j)// set cursor
{
COORD pos={short(i), short(j)};
SetPos(pos);
}
void HideCursor()
{
CONSOLE_CURSOR_INFO cursor_info = {1, 0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
char input()
{
while(1)
{
if(_kbhit())
{
return _getch();
}
}
}
char input(int i, int j)
{
while(1)
{
char x = input();
if(x >= i && x <= j) return x;
}
}
//在[a, b)之间产生一个随机整数
int random(int a, int b)
{
int c=(rand() % (a-b))+ a;
return c;
}
struct BLOCK
{
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, 200, 1, "石头", false},
{2, "▓ ", 7, 45, 0, "泥土", false},
{3, "▓ ", 6, 45, 0, "砂砾", false},
{4, "■", 5, 55, 0, "木头", false},
{5, "※", 0, 300, 2, "铁矿石", false},
{6, "∷", 0, 500, 2, "铁块", false},
{7, "※", 5, 340, 3, "金矿石", false},
{8, "∷", 5, 600, 3, "金块", false},
{9, "※", 3, 480, 3, "钻石矿石", false},
{10, "∷", 3, 900, 3, "钻石块", false},
{11, "▓ ", 1, 10, 0, "树叶", false},
{12, "■", 3, 2000000000, 100, "水", true},
{13, "□", 2, 2000000000, 100, "岩浆", true},
{14, "□", 0, 5000, 4, "真正的基岩", false},
{15, "■", 4, 25, 0, "地狱岩", false},
{16, "□", 4, 2000, 4, "远古残骸", false},
{17, "∷", 4, 3000, 4, "下界合金块", false},
{18, "■", 2, 2000000000, 100, "地幔", true},
{19, " ", 0, 2000000000, 100, "空气", true},
{20, "●", 4, 1500, 3, "海洋之星", false},
{21, "□", 3, 1000, 3, "海能石", false},
{22, "※", 1, 600, 3, "绿宝石矿石", false},
{23, "∷", 1, 800, 3, "绿宝石块", false},
{24, "■", 7, 1200, 1, "神殿方块", false},
{25, "<>", 2, 2000, 2, "神殿核心", false},
{26, "于", 2, 2000, 1, "于苗晶体A", false},
{27, "苗", 2, 2000, 1, "于苗晶体B", false},
{28, "{}", 3, 2750, 1, "宝藏锚点", false},
{29, "■", 1, 1000, 0, "TNT", false},
{30, "■", 4, 1000, 0, "二倍TNT", false},
{31, "■", 2, 1000, 0, "四倍TNT", false},
{32, "■", 5, 1000, 0, "八倍TNT", false},
{33, "■", 3, 80000, 2, "地牢石", false},
{34, "※", 3, 160000, 4, "魂石", false},
{35, "▓ ", 3, 2000000000, 100, "死水", true},
{36, "■", 5, 440, 2, "下界砖", false},
{37, "箱", 5, 200, 0, "箱子", false},
{38, "■", 8, 2000000000, 100, "激光", true},
{39, "▲", -1, 12000, 2, "BOSS祭坛", false},
{40, "Go", -1, 666888999, 0, "新手教程用的标靶", false},
{41, "※", 4, 2000000000, 100, "混沌激流", false},
{42, "※", -1, 2000000000, 100, "混沌之星", false}
};
const int block_max = 42;
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, 25, 1, "木镐", 0},
{2, 5, 0, 1, "木剑", 0},
{3, 3, 50, 2, "石镐", 0},
{4, 6, 0, 2, "石剑", 0},
{5, 0, 0, 0, "铁锭", 0},
{6, 5, 90, 3, "铁镐", 0},
{7, 9, 0, 3, "铁剑", 0},
{8, 0, 0, 0, "金锭", 1},
{9, 3, 40, 3, "金镐", 1},
{10, 6, 0, 3, "金剑", 1},
{11, 0, 0, 0, "钻石", 2},
{12, 6, 240, 4, "钻石镐", 2},
{13, 12, 0, 4, "钻石剑", 2},
{14, 0, 0, 0, "下界合金碎片", 3},
{15, 0, 0, 0, "下界合金锭", 3},
{16, 7, 1000, 5, "下界合金镐", 3},
{17, 15, 0, 5, "下界合金剑", 3},
{18, 0, 0, 0, "桶", 0},
{19, 0, 0, 0, "水桶", 0},
{20, 0, 0, 0, "岩浆桶", 0},
{21, 0, 0, 0, "药水量子", 3},
{22, 0, 0, 0, "强化量子", 3},
{23, 0, 0, 0, "绿宝石", 2},
{24, 5, 200, 4, "绿宝石镐", 2},
{25, 11, 0, 4, "绿宝石剑", 2},
{26, 0, 100, 0, "海洋创造锤", 3},
{27, 0, 0, 0, "无尽核心", 4},
{28, 0, 0, 0, "宝藏探测器", 4},
{29, 0, 0, 0, "死水桶", 0},
{30, 0, 0, 0, "灵魂之星", 3},
{31, 14, 1600, 5, "灵魂镐", 3},
{32, 18, 0, 5, "灵魂剑", 3},
{33, 1000, 0, 5, "调试用", 3}
};
const int item_max = 33;
struct ARMOR
{
int id;
int defease; //最高为20 可抵御(defease*4)%伤害
string name;
};
ARMOR armor[] = //盔甲
{
{0, 0, "空"},
{1, 4, "木盔甲"},
{2, 8, "石盔甲"},
{3, 12, "铁盔甲"},
{4, 16, "钻石盔甲"},
{5, 20, "下界合金盔甲"}
};
struct BUFF
{
int id;
string name;
int level; //等级 默认为0 1级以上显示在玩家属性页面中
int time; //单位: short_tick 降至0后等级降至0级
};
BUFF buff[] = //效果
{
{0, "空", 0, 0},
{1, "生命提升", 0, 0},
{2, "急迫", 0, 0},
{3, "生命吸收", 0, 0},
{4, "中毒", 0, 0}
};
const int buff_max = 4;
string buff_str[] = //效果简介
{
"空效果",
"能够提升生命值 每级提升4点生命值",
"能够加快挖掘速度 每级提升25%挖掘速度",
"获得护盾 每级提升1点免伤值",
"负面效果 每级每个构造刻受到1点伤害"
};
struct ENTITY
{
int type;
string name;
string txt;
int color;
int hp;
int ap;
bool power; //能否摧毁沿路方块
bool boss;
int xp;
int x;
int y;
};
ENTITY entity[] =
{
{0, "普通小怪", "[]", 2, 50, 5, false, false, 3, 0, 0},
{1, "精英小怪", "[]", 5, 100, 10, false, false, 6, 0, 0},
{2, "王者小怪", "<>", 5, 200, 20, true, false, 12, 0, 0},
{3, "守卫", "▼", 7, 600, 60, true, true, 300, 0, 0},
{4, "TNT", "炸", 1, 10, 0, false, false, 0, 0, 0},
{5, "双倍TNT", "炸", 4, 15, 0, false, false, 0, 0, 0},
{6, "四倍TNT", "炸", 2, 20, 0, false, false, 0, 0, 0},
{7, "八倍TNT", "炸", 5, 25, 0, false, false, 0, 0, 0}
};
const int entity_max = 7;
int gamemode = 0; //0=生存 1=创造 2=极限
int short_tick = 0, tick = 0; //短刻(每秒10次)和构造刻(每秒1次)
BLOCK world[2400][1200]; //地图 x0~2399 y0~1199
BLOCK fkl[5]; //方块栏
ITEM wpl[5]; //物品栏
int box_fk_num[block_max]; //箱子方块栏
int box_wp_num[item_max]; //箱子物品栏
ARMOR kjl = armor[0]; //盔甲栏 做出盔甲立即替换
const int xgmax = 5; //可获得的效果总数
BUFF xgl[xgmax]; //效果栏
int xgnum; //已拥有BUFF
int fknum[5], wpnum[5]; //数量(max:64)
int now = 0; //目前手持方块/物品 0~4方块 5~9物品
int playerx = 1200, playery = 700; //冒险者 坐标
ENTITY stl[1000]; //实体栏
int st_num = 0; //实体数量
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是否受伤
int yindao = -1; //是否新手引导
void print_data();
void input_data();
//地牢结构
int dilao_jiegou[27][29] = {
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2},
{2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 2},
{2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 1, 1, 2, 3, 3, 2, 5, 5, 5, 5, 5, 5, 2, 3, 3, 3, 3, 2},
{2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 1, 1, 2, 3, 3, 2, 5, 5, 5, 5, 5, 5, 2, 3, 3, 3, 3, 2},
{2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 1, 1, 2, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 2},
{2, 3, 3, 3, 2, 2, 3, 3, 3, 2, 1, 1, 1, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2},
{2, 3, 3, 2, 3, 3, 2, 3, 3, 2, 1, 1, 1, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2},
{2, 3, 3, 2, 3, 3, 2, 3, 3, 2, 1, 1, 1, 2, 3, 3, 2, 3, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 2},
{2, 3, 3, 3, 2, 2, 3, 3, 3, 2, 1, 1, 1, 2, 2, 2, 2, 3, 2, 2, 3, 3, 3, 2, 2, 2, 2, 2, 2},
{2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 1, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3, 3, 2, 1, 1, 1, 1, 1},
{2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 3, 3, 2, 1, 1, 1, 1, 1},
{2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 3, 2, 2, 2, 2, 2, 2},
{2, 2, 2, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 2},
{1, 1, 2, 3, 3, 2, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 4, 4, 2, 3, 3, 3, 3, 3, 3, 3, 2},
{1, 1, 2, 3, 3, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2},
{1, 1, 2, 3, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 2, 1, 1, 1, 1, 1, 1},
{1, 1, 2, 3, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1},
{1, 1, 2, 3, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 2, 3, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1}
};
//下界城市
//核心
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},
{1, 1, 2, 2, 2, 2, 2, 1, 1},
{2, 2, 2, 2, 2, 2, 2, 2, 2},
{1, 1, 2, 2, 2, 2, 2, 1, 1},
{0, 1, 1, 2, 2, 2, 1, 1, 0},
{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},
{1, 1, 1, 1, 1, 1, 1, 1, 1},
{2, 2, 2, 2, 2, 2, 2, 2, 2},
{1, 1, 1, 1, 1, 1, 1, 1, 1},
{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 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},
{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},
{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}
};
//新手教程地图1:移动教程
int junior_map_1[7][20] =
{
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 0},
{ 0, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 19, 0},
{ 0, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 0},
{ 0, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};
void block_copy(int x, int y, int id) //将一个方块放置到某个坐标
{
world[x][y].id = id;
world[x][y].txt = block[id].txt;
world[x][y].color = block[id].color;
world[x][y].hard = block[id].hard;
world[x][y].name = block[id].name;
world[x][y].level = block[id].level;
world[x][y].fluid = block[id].fluid;
}
void init_junior() //新手教程
{
yindao = 0;
for(int x = 0;x < 2400;x++) //填充空气
{
for(int y = 0;y < 1200;y++) block_copy(x, y, 19);
}
playerx = 405, playery = 401;
for(int i = 0;i < 7;i++)
{
for(int j = 0;j < 20;j++)
{
block_copy(400 + j, 400 + i, junior_map_1[i][j]);
}
}
}
void chengshi(int x, int y) //下界城市的生成
{
queue<pair<pair<int, int>, int> > q;
int size = 5;
x /= 9;
y /= 9;
int nt = 1;
q.push({{x, y}, 1});
for(int i = 0;i < 9;i++)
{
for(int j = 0;j < 9;j++)
{
if(nt == 1)
{
if(nc_core[i][j] == 2)
{
block_copy(x * 9 + i, y * 9 + j, 19);
}
else if(nc_core[i][j] == 0) ;
else block_copy(x * 9 + i, y * 9 + j, 36);
}
else if(nt == 2)
{
if(nc_sp_ld[i][j] == 2)
{
block_copy(x * 9 + i, y * 9 + j, 19);
}
else if(nc_sp_ld[i][j] == 0);
else block_copy(x * 9 + i, y * 9 + j, 36);
}
else if(nt == 3)
{
if(nc_cz_ld[i][j] == 2)
{
block_copy(x * 9 + i, y * 9 + j, 19);
}
else if(nc_cz_ld[i][j] == 0) ;
else block_copy(x * 9 + i, y * 9 + j, 36);
}
}
}
nt = 2;
q.push({{x - 1, y}, 2});
for(int i = 0;i < 9;i++)
{
for(int j = 0;j < 9;j++)
{
if(nt == 1)
{
if(nc_core[i][j] == 2)
{
block_copy(x * 9 - 9 + i, y * 9 + j, 19);
}
else if(nc_core[i][j] == 0);
else block_copy(x * 9 - 9 + i, y * 9 + j, 36);
}
else if(nt == 2)
{
if(nc_sp_ld[i][j] == 2)
{
block_copy(x * 9 - 9 + i, y * 9 + j, 19);
}
else if(nc_sp_ld[i][j] == 0);
else block_copy(x * 9 - 9 + i, y * 9 + j, 36);
}
else if(nt == 3)
{
if(nc_cz_ld[i][j] == 2)
{
block_copy(x * 9 - 9 + i, y * 9 + j, 19);
}
else if(nc_cz_ld[i][j] == 0) ;
else block_copy(x * 9 - 9 + i, y * 9 + j, 36);
}
}
}
q.push({{x + 1, y}, 2});
for(int i = 0;i < 9;i++)
{
for(int j = 0;j < 9;j++)
{
if(nt == 1)
{
if(nc_core[i][j] == 2)
{
block_copy(x * 9 + 9 + i, y * 9 + j, 19);
}
else if(nc_core[i][j] == 0) ;
else block_copy(x * 9 + 9 + i, y * 9 + j, 36);
}
else if(nt == 2)
{
if(nc_sp_ld[i][j] == 2)
{
block_copy(x * 9 + 9 + i, y * 9 + j, 19);
}
else if(nc_sp_ld[i][j] == 0) ;
else block_copy(x * 9 + 9 + i, y * 9 + j, 36);
}
else if(nt == 3)
{
if(nc_cz_ld[i][j] == 2)
{
block_copy(x * 9 + 9 + i, y * 9 + j, 19);
}
else if(nc_cz_ld[i][j] == 0) ;
else block_copy(x * 9 + 9 + i, y * 9 + j, 36);
}
}
}
nt = 3;
q.push({{x, y - 1}, 3});
for(int i = 0;i < 9;i++)
{
for(int j = 0;j < 9;j++)
{
if(nt == 1)
{
if(nc_core[i][j] == 2)
{
block_copy(x * 9 + i, y * 9 - 9 + j, 19);
}
else if(nc_core[i][j] == 0) ;
else block_copy(x * 9 + i, y * 9 - 9 + j, 36);
}
else if(nt == 2)
{
if(nc_sp_ld[i][j] == 2)
{
block_copy(x * 9 + i, y * 9 - 9 + j, 19);
}
else if(nc_sp_ld[i][j] == 0) ;
else block_copy(x * 9 + i, y * 9 - 9 + j, 36);
}
else if(nt == 3)
{
if(nc_cz_ld[i][j] == 2)
{
block_copy(x * 9 + i, y * 9 - 9 + j, 19);
}
else if(nc_cz_ld[i][j] == 0) ;
else block_copy(x * 9 + i, y * 9 - 9 + j, 36);
}
}
}
q.push({{x, y + 1}, 3});
for(int i = 0;i < 9;i++)
{
for(int j = 0;j < 9;j++)
{
if(nt == 1)
{
if(nc_core[i][j] == 2)
{
block_copy(x * 9 + i, y * 9 + 9 + j, 19);
}
else if(nc_core[i][j] == 0);
else block_copy(x * 9 + i, y * 9 + 9 + j, 36);
}
else if(nt == 2)
{
if(nc_sp_ld[i][j] == 2)
{
block_copy(x * 9 + i, y * 9 + 9 + j, 19);
}
else if(nc_sp_ld[i][j] == 0) ;
else block_copy(x * 9 + i, y * 9 + 9 + j, 36);
}
else if(nt == 3)
{
if(nc_cz_ld[i][j] == 2)
{
block_copy(x * 9 + i, y * 9 + 9 + j, 19);
}
else if(nc_cz_ld[i][j] == 0) ;
else block_copy(x * 9 + i, y * 9 + 9 + j, 36);
}
}
}
while(!q.empty() && size < 24)
{
int nx = q.front().first.first;
int ny = q.front().first.second;
int nt = q.front().second;
q.pop();
if(rand() % 3 <= 1 && nt != 3)
{
q.push({{nx - 1, ny}, 2});
size++;
for(int i = 0;i < 9;i++)
{
for(int j = 0;j < 9;j++)
{
if(nt == 1)
{
if(nc_core[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_core[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
else if(nt == 2)
{
if(nc_sp_ld[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_sp_ld[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
else if(nt == 3)
{
if(nc_cz_ld[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_cz_ld[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
}
}
}
if(rand() % 3 <= 1 && nt != 3)
{
q.push({{nx + 1, ny}, 2});
size++;
for(int i = 0;i < 9;i++)
{
for(int j = 0;j < 9;j++)
{
if(nt == 1)
{
if(nc_core[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_core[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
else if(nt == 2)
{
if(nc_sp_ld[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_sp_ld[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
else if(nt == 3)
{
if(nc_cz_ld[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_cz_ld[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
}
}
}
if(rand() % 3 <= 1 && nt != 2)
{
q.push({{nx, ny - 1}, 3});
size++;
for(int i = 0;i < 9;i++)
{
for(int j = 0;j < 9;j++)
{
if(nt == 1)
{
if(nc_core[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_core[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
else if(nt == 2)
{
if(nc_sp_ld[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_sp_ld[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
else if(nt == 3)
{
if(nc_cz_ld[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_cz_ld[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
}
}
}
if(rand() % 3 <= 1 && nt != 2)
{
q.push({{nx, ny + 1}, 3});
size++;
for(int i = 0;i < 9;i++)
{
for(int j = 0;j < 9;j++)
{
if(nt == 1)
{
if(nc_core[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_core[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
else if(nt == 2)
{
if(nc_sp_ld[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_sp_ld[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
else if(nt == 3)
{
if(nc_cz_ld[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_cz_ld[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
}
}
}
if(rand() % 3 <= 1 && nt != 1)
{
q.push({{nx + random(-1, 2), ny + random(-1, 2)}, 1});
size++;
for(int i = 0;i < 9;i++)
{
for(int j = 0;j < 9;j++)
{
if(nt == 1)
{
if(nc_core[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_core[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
else if(nt == 2)
{
if(nc_sp_ld[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_sp_ld[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
else if(nt == 3)
{
if(nc_cz_ld[i][j] == 2)
{
block_copy(nx * 9 + i, ny * 9 + j, 19);
}
else if(nc_cz_ld[i][j] == 0) continue;
else block_copy(nx * 9 + i, ny * 9 + j, 36);
}
}
}
}
}
}
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++)
{
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] > 220) stgd[x] = 220;
if(stgd[x] < 160) stgd[x] = 160;
}
cout << "15%" << endl;
//拷贝石头(主世界下边界:y=501)
for(int x = 200;x < 2300;x++)
{
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);
}
//生成绿宝石
if(y <= 600 && random(1, 10000) <= 75)
{
block_copy(x, y, 22);
}
//生成岩浆
if(y <= 580 && random(1, 10000) <= 100)
{
block_copy(x, y, 13);
}
}
}
cout << "20%" << endl;
//增加海水(第二次构造)
for(int x = 200;x < 2300;x++)
{
for(int y = 501 + stgd[x] + 1;y <= 700;y++)
{
block_copy(x, y, 12);
}
}
cout << "23%" << endl;
for(int x = 200;x < 2300;x++)
{
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++)
{
if(world[xx][yy].id != 12) flag = false;
}
}
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},
{1, 0, 0, 1, 0, 1, 0, 0, 1},
{1, 0, 1, 0, 1, 0, 1, 0, 1},
{1, 0, 0, 1, 0, 1, 0, 0, 1},
{1, 1, 0, 0, 1, 0, 0, 1, 1},
{0, 1, 1, 0, 0, 0, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0}};
for(int i = x - 5;i <= x + 5;i++)
{
for(int j = y - 5;j <= y + 5;j++)
{
if(haizhihuan[i - (x - 5)][j - (y - 5)] == 1)
{
block_copy(i, j, 21);
}
}
}
block_copy(x, y, 20);
}
}
}
cout << "27%" << endl;
//最上3层为泥土
for(int x = 200;x < 2300;x++)
{
int dian = random(1, 10000);
int tree = random(1, 10000);
block_copy(x, 501 + stgd[x], 2);
block_copy(x, 501 + stgd[x] + 1, 2);
block_copy(x, 501 + stgd[x] + 2, 2);
//生成树
if(tree <= 250)
{
block_copy(x, 501 + stgd[x] + 2, 4);
block_copy(x, 501 + stgd[x] + 3, 4);
block_copy(x, 501 + stgd[x] + 4, 4);
block_copy(x - 1, 501 + stgd[x] + 4, 11);
block_copy(x + 1, 501 + stgd[x] + 4, 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);
block_copy(x, 501 + stgd[x] + 3, 4);
block_copy(x, 501 + stgd[x] + 4, 4);
block_copy(x, 501 + stgd[x] + 5, 4);
block_copy(x - 1, 501 + stgd[x] + 4, 4);
block_copy(x + 1, 501 + stgd[x] + 4, 4);
block_copy(x - 2, 501 + stgd[x] + 5, 4);
block_copy(x + 2, 501 + stgd[x] + 5, 4);
block_copy(x - 2, 501 + stgd[x] + 6, 11);
block_copy(x + 2, 501 + stgd[x] + 6, 11);
block_copy(x - 2, 501 + stgd[x] + 4, 11);
block_copy(x + 2, 501 + stgd[x] + 4, 11);
block_copy(x, 501 + stgd[x] + 6, 11);
block_copy(x - 1, 501 + stgd[x] + 5, 11);
block_copy(x + 1, 501 + stgd[x] + 5, 11);
block_copy(x - 1, 501 + stgd[x] + 6, 11);
block_copy(x + 1, 501 + stgd[x] + 6, 11);
block_copy(x, 501 + stgd[x] + 6, 11);
block_copy(x, 501 + stgd[x] + 7, 11);
block_copy(x - 1, 501 + stgd[x] + 7, 11);
block_copy(x + 1, 501 + stgd[x] + 7, 11);
}
//生成入云树
else if(tree <= 340)
{
for(int i = 501 + stgd[x] + 2;i <= 501 + stgd[x] + (rand()%10) + 6;i++)
{
block_copy(x, i, 4);
if(i >= 501 + stgd[x] + 4)
{
block_copy(x - 1, i, 11);
block_copy(x + 1, i, 11);
}
block_copy(x, i + 1, 11);
}
}
//生成巨树
else if(tree <= 370)
{
block_copy(x, 501 + stgd[x] + 2, 4);
block_copy(x - 1, 501 + stgd[x] + 2, 4);
block_copy(x + 1, 501 + stgd[x] + 2, 4);
block_copy(x, 501 + stgd[x] + 3, 4);
block_copy(x - 1, 501 + stgd[x] + 3, 4);
block_copy(x + 1, 501 + stgd[x] + 3, 4);
block_copy(x, 501 + stgd[x] + 4, 4);
block_copy(x - 1, 501 + stgd[x] + 4, 4);
block_copy(x + 1, 501 + stgd[x] + 4, 4);
block_copy(x, 501 + stgd[x] + 5, 4);
block_copy(x - 1, 501 + stgd[x] + 5, 4);
block_copy(x + 1, 501 + stgd[x] + 5, 4);
block_copy(x - 2, 501 + stgd[x] + 4, 11);
block_copy(x + 2, 501 + stgd[x] + 4, 11);
block_copy(x - 2, 501 + stgd[x] + 5, 11);
block_copy(x + 2, 501 + stgd[x] + 5, 11);
block_copy(x - 2, 501 + stgd[x] + 6, 11);
block_copy(x + 2, 501 + stgd[x] + 6, 11);
block_copy(x - 1, 501 + stgd[x] + 6, 11);
block_copy(x + 1, 501 + stgd[x] + 6, 11);
block_copy(x, 501 + stgd[x] + 6, 11);
block_copy(x, 501 + stgd[x] + 7, 11);
block_copy(x - 1, 501 + stgd[x] + 7, 11);
block_copy(x + 1, 501 + stgd[x] + 7, 11);
}
//生成于苗神殿
else if(tree <= 405)
{
int y = 501 + stgd[x] + 3;
block_copy(x, y, 24);
block_copy(x - 1, y, 24);
block_copy(x + 1, y, 24);
block_copy(x - 2, y, 24);
block_copy(x + 2, y, 24);
block_copy(x - 3, y, 24);
block_copy(x + 3, y, 24);
block_copy(x - 3, y + 1, 24);
block_copy(x + 3, y + 1, 24);
block_copy(x - 3, y + 2, 24);
block_copy(x + 3, y + 2, 24);
block_copy(x - 3, y + 3, 24);
block_copy(x + 3, y + 3, 24);
block_copy(x - 3, y + 4, 24);
block_copy(x + 3, y + 4, 24);
block_copy(x - 3, y + 5, 24);
block_copy(x + 3, y + 5, 24);
block_copy(x - 3, y + 6, 24);
block_copy(x + 3, y + 6, 24);
block_copy(x - 2, y + 6, 24);
block_copy(x + 2, y + 6, 24);
block_copy(x - 1, y + 6, 24);
block_copy(x + 1, y + 6, 24);
block_copy(x, y + 6, 24);
block_copy(x - 2, y + 6, 24);
block_copy(x + 2, y + 6, 24);
block_copy(x - 2, y + 7, 24);
block_copy(x + 2, y + 7, 24);
block_copy(x - 1, y + 7, 26);
block_copy(x + 1, y + 7, 27);
block_copy(x - 2, y + 8, 24);
block_copy(x + 2, y + 8, 24);
block_copy(x - 1, y + 9, 24);
block_copy(x + 1, y + 9, 24);
block_copy(x, y + 9, 25);
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++)
{
for(int j = 0;j < 29;j++)
{
int fangkuaiid = 0;
if(dilao_jiegou[i][j] == 1) continue;
else if(dilao_jiegou[i][j] == 2) fangkuaiid = 33;
else if(dilao_jiegou[i][j] == 3) fangkuaiid = 19;
else if(dilao_jiegou[i][j] == 5) fangkuaiid = 35;
else fangkuaiid = 34;
block_copy( x - 14 + j, 501 + stgd[x] + 3 - (t_high) + i, fangkuaiid);
}
}
}
}
cout << "30%" << endl;
for(int x = 200;x < 2300;x++)
{
int gaodu = max(741, 501 + stgd[x]);
for(int y = gaodu + 15;y <= gaodu + 20;y++)
{
if(rand() % 20000 < 1)
{
//生成宝藏岛
block_copy(x, y, 1);
for(int z = x - 2;z <= x + 2;z++) block_copy(z, y + 1, 1);
for(int z = x - 3;z <= x + 3;z++) block_copy(z, y + 2, 1);
for(int z = x - 4;z <= x + 4;z++) block_copy(z, y + 3, 1);
for(int z = x - 5;z <= x + 5;z++) block_copy(z, y + 4, 1);
block_copy(x - 2, y + 5, 9);
block_copy(x + 2, y + 5, 9);
block_copy(x - 2, y + 6, 7);
block_copy(x + 2, y + 6, 7);
block_copy(x - 2, y + 7, 5);
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;
}
}
}
cout << "34%" << endl;
for(int x = 200;x < 2300;x++)
{
block_copy(x, 500, 14);
block_copy(x, 499, 14);
block_copy(x, 498, 14);
block_copy(x, 497, 14);
}
cout << "36%" << endl;
for(int x = 200;x < 2300;x++)
{
for(int y = 496;y >= 100;y--)
{
block_copy(x, y, 15);
if(random(0, 10000) <= 60)
{
bool flag = false;
if(random(0, 10000) <= 1000) flag = true;
int r = random(2, 4);
for(int xx = x - r;xx <= x + r;xx++)
{
for(int yy = y - r;yy <= y + r;yy++)
{
block_copy(xx, yy, 19);
if(yy == y - r)
{
if(flag) block_copy(xx, yy, 13);
}
}
}
}
//添加岩浆
if(random(0, 10000) <= 1000) block_copy(x, y, 13);
//远古残骸
if(random(0, 10000) <= 20) block_copy(x, y, 16);
}
}
cout << "42%" << endl;
for(int x = 200;x < 2300;x++)
{
for(int y = 496;y >= 100;y--)
{
//下界城市
if(random(1, 10000) == 1 || (x == 1200 && y == 400))
{
if(random(1, 100) == 1 || (x == 1200 && y == 400))
{
chengshi(x, y);
}
}
}
}
playery = 501 + stgd[1200] + 3;
}
void block_pick(BLOCK blk)
{
for(int i = 0;i < 5;i++)
{
if(fkl[i].id == blk.id && blk.id != 0 && fknum[i] < 64)
{
fkl[i] = blk;
fknum[i]++;
return;
}
}
for(int i = 0;i < 5;i++)
{
if(fknum[i] <= 0)
{
fkl[i] = blk;
fknum[i] = 1;
return;
}
}
}
void block_delete(BLOCK blk)
{
for(int i = 0;i < 5;i++)
{
if(fkl[i].id == blk.id && fkl[i].txt == blk.txt)
{
fknum[i]--;
if(fknum[i] == 0)
{
fkl[i].id = 0;
fkl[i].name = "";
fkl[i].txt = "";
fkl[i].hard = 0;
fkl[i].level = 0;
fkl[i].fluid = 0;
fkl[i].color = 0;
}
return;
}
}
}
int block_num(BLOCK blk)
{
int num = 0;
for(int i = 0;i < 5;i++)
{
if(fkl[i].id == blk.id && fkl[i].txt == blk.txt)
{
num += fknum[i];
}
}
return num;
}
void item_pick(ITEM itm)
{
for(int i = 0;i < 5;i++)
{
if(wpl[i].id == itm.id && itm.id != 0 && wpnum[i] < 64)
{
wpl[i]= itm;
wpnum[i]++;
return;
}
}
for(int i = 0;i < 5;i++)
{
if(wpnum[i] <= 0)
{
wpl[i]= itm;
wpnum[i] = 1;
return;
}
}
}
void item_delete(ITEM itm)
{
for(int i = 0;i < 5;i++)
{
if(wpl[i].id == itm.id && wpl[i].name == itm.name)
{
wpnum[i]--;
if(wpnum[i] == 0)
{
wpl[i].id = 0;
wpl[i].hurt = 0;
wpl[i].speed = 0;
wpl[i].level = 0;
wpl[i].name = "";
wpl[i].rare = 0;
}
return;
}
}
}
int item_num(ITEM itm)
{
int num = 0;
for(int i = 0;i < 5;i++)
{
if(wpl[i].id == itm.id && wpl[i].name == itm.name)
{
num += wpnum[i];
}
}
return num;
}
void armor_delete()
{
kjl.id = 0;
kjl.defease = 0;
kjl.name = "空";
}
void armor_pick(ARMOR arm)
{
kjl.id = arm.id;
kjl.defease = arm.defease;
kjl.name = arm.name;
}
void buff_give(BUFF bff, int level, int time)
{
if(bff.id == 0) return;
if(xgnum == xgmax) return;
xgl[xgnum].id = bff.id;
xgl[xgnum].level = level;
xgl[xgnum].name = bff.name;
xgl[xgnum++].time = time;
}
void buff_delete(BUFF bff)
{
if(bff.id == 0) return;
for(int i = 0;i < xgnum;i++)
{
if(xgl[i].id == bff.id)
{
xgl[i].id = 0;
xgl[i].level = 0;
xgl[i].name = "空";
xgl[i].time = 0;
}
}
}
int get_buff_level(BUFF bff)
{
int mx = 0;
if(bff.id == 0) return 0;
for(int i = 0;i < xgnum;i++)
{
if(xgl[i].id == bff.id) mx = max(mx, xgl[i].level);
}
return mx;
}
void buff_merge() //效果合并(每短刻进行)
{
for(int i = 0;i < xgnum;i++)
{
for(int j = i + 1;j < xgnum;j++)
{
if(xgl[i].id == xgl[j].id && xgl[i].id != 0)
{
xgl[i].level = max(xgl[i].level, xgl[j].level);
xgl[i].time = xgl[i].time + xgl[j].time;
xgl[j].id = 0;
xgl[j].level = 0;
xgl[j].name = "空";
xgl[j].time = 0;
xgnum--;
//迁移效果
for(int k = j + 1;k < xgnum + 1;k++)
{
xgl[k - 1].level = xgl[k].level;
xgl[k - 1].id = xgl[k].id;
xgl[k - 1].time = xgl[k].time;
xgl[k - 1].name = xgl[k].name;
xgl[k].id = 0;
xgl[k].level = 0;
xgl[k].name = "空";
xgl[k].time = 0;
}
}
}
}
}
void buff_live()
{
for(int i = 0;i < xgnum;i++)
{
if(xgl[i].id != 0)
{
xgl[i].time--;
if(xgl[i].time <= 0)
{
xgl[i].id = 0;
xgl[i].level = 0;
xgl[i].name = "空";
xgl[i].time = 0;
}
}
}
}
void summon_entity(int x, int y, int type) //实体生成
{
stl[st_num].type = entity[type].type;
stl[st_num].color = entity[type].color;
stl[st_num].txt = entity[type].txt;
stl[st_num].xp = entity[type].xp;
stl[st_num].power = entity[type].power;
stl[st_num].ap = entity[type].ap;
stl[st_num].hp = entity[type].hp;
stl[st_num].boss = entity[type].boss;
stl[st_num].name = entity[type].name;
stl[st_num].x = x;
stl[st_num].y = y;
st_num++;
}
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";
SetPos(2, 4);
cout << die_str;
SetPos(2, 6);
cout << "极限模式下 你必须删除存档";
init();
print_data();
SetPos(2, 8);
system("pause");
exit(0);
}
else if(health < 0 && gamemode == 0) //玩家死亡 生存模式=复活
{
system("cls");
SetPos(2, 2);
cout << "GAME OVER";
SetPos(2, 4);
cout << die_str;
SetPos(2, 6);
cout << "重生";
SetPos(2, 8);
system("pause");
playerx = 1200;
playery = 700;
block_copy(playerx, playery, 19);
health = max_health + get_buff_level(buff[1]) * 4;
return;
}
}
void input_data() //输入数据
{
ifstream fin("data.txt", ios::in);
for(int i = 0;i < 2400;i++)
{
for(int j = 0;j < 1200;j++)
{
int ijid;
fin >> ijid;
block_copy(i, j, ijid);
}
}
fin >> playerx >> playery;
for(int i = 0;i < 5;i++) fin >> fknum[i] >> wpnum[i];
for(int i = 0;i < 5;i++)
{
int fkid, wpid;
fin >> fkid >> wpid;
if(fkid != 0)
{
fkl[i].id = fkid;
fkl[i].fluid = block[fkid].fluid;
fkl[i].color = block[fkid].color;
fkl[i].hard = block[fkid].hard;
fkl[i].level = block[fkid].level;
fkl[i].txt = block[fkid].txt;
fkl[i].name = block[fkid].name;
}
else fknum[i] = 0;
if(wpid != 0)
{
wpl[i].id = wpid;
wpl[i].name = item[wpid].name;
wpl[i].speed = item[wpid].speed;
wpl[i].hurt = item[wpid].hurt;
wpl[i].level = item[wpid].level;
wpl[i].rare = item[wpid].rare;
}
else wpnum[i] = 0;
}
int zbid;
fin >> zbid;
armor_pick(armor[zbid]);
fin >> xgnum;
for(int i = 0;i < xgnum;i++)
{
int xgid, xgtm, xglv;
fin >> xgid >> xgtm >> xglv;
xgl[i].id = xgid;
xgl[i].time = xgtm;
xgl[i].name = buff[xgid].name;
xgl[i].level = xglv;
}
fin >> health >> oxygen;
fin >> gamemode;
fin >> level >> xp >> max_health;
int stn;
fin >> stn;
for(int i = 0;i < stn;i++)
{
int type, x, y;
fin >> type >> x >> y;
summon_entity(x, y, type);
}
int bm, im;
fin >> bm >> im;
for(int i = 0;i < bm;i++)
{
fin >> box_fk_num[i];
}
for(int i = 0;i < im;i++)
{
fin >> box_wp_num[i];
}
}
void print_data() //输出数据
{
ofstream fout("data.txt", ios::out);
for(int i = 0;i < 2400;i++)
{
for(int j = 0;j < 1200;j++)
{
int id = world[i][j].id;
fout << id;
fout << ' ';
}
fout << endl;
}
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++)
{
fout << xgl[i].id << ' ' << xgl[i].time << ' ' << xgl[i].level;
fout << endl;
}
fout << health << endl << oxygen << endl;
fout << gamemode << endl;
fout << level << endl << xp << endl << max_health << endl;
fout << st_num << endl;
for(int i = 0;i < st_num;i++)
{
fout << stl[i].type << ' ' << stl[i].x << ' ' << stl[i].y << endl;
}
fout << block_max << endl << item_max << endl;
for(int i = 0;i < block_max;i++) fout << box_fk_num[i] << endl;
for(int i = 0;i < item_max;i++) fout << box_wp_num[i] << endl;
}
void item_choose() //创造物品选择器
{
system("cls");
SetPos(10, 1);
cout << "创造模式物品选择器:";
SetPos(10, 3);
cout << "a d 迭代手中物品 S 堆叠手中物品";
SetPos(10, 5);
cout << "K 确认";
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);
else if(wpl[now - 5].rare == 3) Color(4);
else Color(2);
cout << wpl[now - 5].name;
cout << " ";
Color(0);
}
Color(0);
if(_kbhit())
{
char f = _getch();
if(f == 'a')
{
if(now <= 4 && fkl[now].id > 0)
{
if(!fknum[now]) fknum[now]++;
fkl[now].id--;
fkl[now].color = block[fkl[now].id].color;
fkl[now].fluid = block[fkl[now].id].fluid;
fkl[now].hard = block[fkl[now].id].hard;
fkl[now].level = block[fkl[now].id].level;
fkl[now].name = block[fkl[now].id].name;
fkl[now].txt = block[fkl[now].id].txt;
}
else if(now >= 5 && wpl[now - 5].id > 0)
{
if(!wpnum[now - 5]) wpnum[now - 5]++;
wpl[now - 5].id--;
wpl[now - 5].hurt = item[wpl[now - 5].id].hurt;
wpl[now - 5].level = item[wpl[now - 5].id].level;
wpl[now - 5].name = item[wpl[now - 5].id].name;
wpl[now - 5].rare = item[wpl[now - 5].id].rare;
wpl[now - 5].speed = item[wpl[now - 5].id].speed;
}
}
else if(f == 'd')
{
if(now <= 4 && fkl[now].id < block_max)
{
if(!fknum[now]) fknum[now]++;
fkl[now].id++;
fkl[now].color = block[fkl[now].id].color;
fkl[now].fluid = block[fkl[now].id].fluid;
fkl[now].hard = block[fkl[now].id].hard;
fkl[now].level = block[fkl[now].id].level;
fkl[now].name = block[fkl[now].id].name;
fkl[now].txt = block[fkl[now].id].txt;
}
else if(now >= 5 && wpl[now - 5].id < item_max)
{
if(!wpnum[now - 5]) wpnum[now - 5]++;
wpl[now - 5].id++;
wpl[now - 5].hurt = item[wpl[now - 5].id].hurt;
wpl[now - 5].level = item[wpl[now - 5].id].level;
wpl[now - 5].name = item[wpl[now - 5].id].name;
wpl[now - 5].rare = item[wpl[now - 5].id].rare;
wpl[now - 5].speed = item[wpl[now - 5].id].speed;
}
}
else if(f == 's')
{
if(now <= 4) fknum[now] = 64;
else wpnum[now - 5] = 64;
}
else if(f == 'k')
{
system("cls");
return;
}
}
}
}
void crafting()
{
//合成
system("cls");
SetPos(10, 1);
cout << "合成";
SetPos(10, 3);
cout << "1 工具类";
SetPos(10, 5);
cout << "2 熔炼类";
SetPos(10, 7);
cout << "3 盔甲类";
SetPos(10, 9);
cout << "4 杂项";
SetPos(10, 11);
cout << "5 离开";
char cft0 = input('1', '5');
system("cls");
if(cft0 == '1')
{
SetPos(10, 1);
cout << "合成 - 工具类";
SetPos(10, 3);
cout << "1 木质";
SetPos(10, 5);
cout << "2 石质";
SetPos(10, 7);
cout << "3 铁质";
SetPos(10, 9);
cout << "4 金质";
SetPos(10, 11);
cout << "5 钻石/绿宝石质";
SetPos(10, 13);
cout << "6 合金质";
SetPos(10, 15);
cout << "7 灵魂物质";
SetPos(10, 17);
cout << "8 药水";
SetPos(10, 19);
cout << "9 离开";
char cft1 = input('1', '9');
system("cls");
if(cft1 == '1')
{
SetPos(10, 1);
cout << "合成 - 工具类 - 木质";
SetPos(10, 3);
cout << "1 木镐";
SetPos(10, 5);
cout << "2 木剑";
SetPos(10, 7);
cout << "3 离开";
char cft11 = input('1', '3');
if(cft11 == '1')
{
SetPos(10, 7);
cout << "需要 木头x4";
SetPos(10, 9);
cout << "1 确认";
SetPos(10, 11);
cout << "2 离开";
char cft111 = input('1', '2');
if(cft111 == '1')
{
if(block_num(block[4]) < 4) return;
block_delete(block[4]);
block_delete(block[4]);
block_delete(block[4]);
block_delete(block[4]);
item_pick(item[1]);
xp += 3;
}
else if(cft111 == '2')
{
return;
}
}
else if(cft11 == '2')
{
SetPos(10, 7);
cout << "需要 木头x4";
SetPos(10, 9);
cout << "1 确认";
SetPos(10, 11);
cout << "2 离开";
char cft112 = input('1', '2');
if(cft112 == '1')
{
if(block_num(block[4]) < 4) return;
block_delete(block[4]);
block_delete(block[4]);
block_delete(block[4]);
block_delete(block[4]);
item_pick(item[2]);
xp += 3;
}
else if(cft112 == '2')
{
return;
}
}
else if(cft11 == '3')
{
return;
}
}
else if(cft1 == '2')
{
SetPos(10, 1);
cout << "合成 - 工具类 - 石质";
SetPos(10, 3);
cout << "1 石镐";
SetPos(10, 5);
cout << "2 石剑";
SetPos(10, 7);
cout << "3 离开";
char cft12 = input('1', '3');
if(cft12 == '1')
{
SetPos(10, 9);
cout << "需要 石头x6";
SetPos(10, 11);
cout << "1 确认";
SetPos(10, 13);
cout << "2 离开";
char cft121 = input('1', '2');
if(cft121 == '1')
{
if(block_num(block[1]) < 6) return;
block_delete(block[1]);
block_delete(block[1]);
block_delete(block[1]);
block_delete(block[1]);
block_delete(block[1]);
block_delete(block[1]);
item_pick(item[3]);
xp += 3;
}
else if(cft121 == '2')
{
return;
}
}
else if(cft12 == '2')
{
SetPos(10, 9);
cout << "需要 石头x6";
SetPos(10, 11);
cout << "1 确认";
SetPos(10, 13);
cout << "2 离开";
char cft122 = input('1', '2');
if(cft122 == '1')
{
if(block_num(block[1]) < 6) return;
block_delete(block[1]);
block_delete(block[1]);
block_delete(block[1]);
block_delete(block[1]);
block_delete(block[1]);
block_delete(block[1]);
item_pick(item[4]);
xp += 3;
}
else if(cft122 == '2')
{
return;
}
}
else if(cft12 == '3')
{
return;
}
}
else if(cft1 == '3')
{
SetPos(10, 1);
cout << "合成 - 工具类 - 铁质";
SetPos(10, 3);
cout << "1 铁镐";
SetPos(10, 5);
cout << "2 铁剑";
SetPos(10, 7);
cout << "3 铁块";
SetPos(10, 9);
cout << "4 离开";
char cft13 = input('1', '4');
if(cft13 == '1')
{
SetPos(10, 11);
cout << "需要 铁锭x3";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft131 = input('1', '2');
if(cft131 == '1')
{
if(item_num(item[5]) < 3) return;
item_delete(item[5]);
item_delete(item[5]);
item_delete(item[5]);
item_pick(item[6]);
xp += 3;
}
else if(cft131 == '2')
{
return;
}
}
else if(cft13 == '2')
{
SetPos(10, 11);
cout << "需要 铁锭x3";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft132 = input('1', '2');
if(cft132 == '1')
{
if(item_num(item[5]) < 3) return;
item_delete(item[5]);
item_delete(item[5]);
item_delete(item[5]);
item_pick(item[7]);
xp += 3;
}
else if(cft132 == '2')
{
return;
}
}
else if(cft13 == '3')
{
SetPos(10, 11);
cout << "需要 铁锭x9";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft133 = input('1', '2');
if(cft133 == '1')
{
if(item_num(item[5]) < 9) return;
item_delete(item[5]);
item_delete(item[5]);
item_delete(item[5]);
item_delete(item[5]);
item_delete(item[5]);
item_delete(item[5]);
item_delete(item[5]);
item_delete(item[5]);
item_delete(item[5]);
block_pick(block[6]);
xp += 3;
}
else if(cft133 == '2')
{
return;
}
}
else if(cft13 == '4')
{
return;
}
}
else if(cft1 == '5')
{
SetPos(10, 1);
cout << "合成 - 工具类 - 钻石/绿宝石质";
SetPos(10, 3);
cout << "1 钻石镐";
SetPos(10, 5);
cout << "2 钻石剑";
SetPos(10, 7);
cout << "3 钻石块";
SetPos(10, 9);
cout << "4 绿宝石镐";
SetPos(10, 11);
cout << "5 绿宝石剑";
SetPos(10, 13);
cout << "6 绿宝石块";
SetPos(10, 9);
cout << "7 离开";
char cft15 = input('1', '7');
if(cft15 == '1')
{
SetPos(10, 11);
cout << "需要 钻石x6";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft151 = input('1', '2');
if(cft151 == '1')
{
if(item_num(item[11]) < 6) return;
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_pick(item[12]);
xp += 3;
}
else if(cft151 == '2')
{
return;
}
}
else if(cft15 == '2')
{
SetPos(10, 11);
cout << "需要 钻石x6";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft152 = input('1', '2');
if(cft152 == '1')
{
if(item_num(item[11]) < 6) return;
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_pick(item[13]);
xp += 3;
}
else if(cft152 == '2')
{
return;
}
}
else if(cft15 == '3')
{
SetPos(10, 11);
cout << "需要 钻石x9";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft153 = input('1', '2');
if(cft153 == '1')
{
if(item_num(item[11]) < 9) return;
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
block_pick(block[10]);
xp += 3;
}
else if(cft153 == '2')
{
return;
}
}
else if(cft15 == '4')
{
SetPos(10, 11);
cout << "需要 绿宝石x6";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft154 = input('1', '2');
if(cft154 == '1')
{
if(item_num(item[23]) < 6) return;
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
item_pick(item[24]);
xp += 3;
}
else if(cft154 == '2')
{
return;
}
}
else if(cft15 == '5')
{
SetPos(10, 11);
cout << "需要 绿宝石x6";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft155 = input('1', '2');
if(cft155 == '1')
{
if(item_num(item[23]) < 6) return;
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
item_pick(item[25]);
xp += 3;
}
else if(cft155 == '2')
{
return;
}
}
else if(cft15 == '6')
{
SetPos(10, 11);
cout << "需要 绿宝石x9";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft156 = input('1', '2');
if(cft156 == '1')
{
if(item_num(item[23]) < 9) return;
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
item_delete(item[23]);
block_pick(block[23]);
xp += 3;
}
else if(cft156 == '2')
{
return;
}
}
else if(cft15 == '7')
{
return;
}
}
else if(cft1 == '6')
{
SetPos(10, 1);
cout << "合成 - 工具类 - 下界合金质";
SetPos(10, 3);
cout << "1 下界合金镐";
SetPos(10, 5);
cout << "2 下界合金剑";
SetPos(10, 7);
cout << "3 下界合金块";
SetPos(10, 9);
cout << "4 离开";
char cft16 = input('1', '4');
if(cft16 == '1')
{
SetPos(10, 11);
cout << "需要 钻石x12 下界合金块x1";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft161 = input('1', '2');
if(cft161 == '1')
{
if(item_num(item[11]) < 12) return;
if(block_num(block[17]) < 1) return;
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
block_delete(block[17]);
item_pick(item[16]);
xp += 3;
}
else if(cft161 == '2')
{
return;
}
}
else if(cft16 == '2')
{
SetPos(10, 11);
cout << "需要 钻石x12 下界合金块x1";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft162 = input('1', '2');
if(cft162 == '1')
{
if(item_num(item[11]) < 12) return;
if(block_num(block[17]) < 1) return;
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
block_delete(block[17]);
item_pick(item[17]);
xp += 3;
}
else if(cft162 == '2')
{
return;
}
}
else if(cft16 == '3')
{
SetPos(10, 11);
cout << "需要 钻石块x1 下界合金锭x9";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft163 = input('1', '2');
if(cft163 == '1')
{
if(block_num(block[10]) < 1) return;
if(item_num(item[15]) < 9)
block_delete(block[10]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
block_pick(block[17]);
xp += 3;
}
else if(cft163 == '2')
{
return;
}
}
else if(cft16 == '4')
{
return;
}
}
else if(cft1 == '7')
{
SetPos(10, 1);
cout << "合成 - 工具类 - 灵魂物质";
SetPos(10, 3);
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')
{
SetPos(10, 11);
cout << "需要 下界合金锭x12 灵魂之星x1";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft161 = input('1', '2');
if(cft161 == '1')
{
if(item_num(item[15]) < 12) return;
if(item_num(item[30]) < 1) return;
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[30]);
item_pick(item[31]);
xp += 3;
}
else if(cft161 == '2')
{
return;
}
}
else if(cft16 == '2')
{
SetPos(10, 11);
cout << "需要 下界合金锭x12 灵魂之星x1";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft162 = input('1', '2');
if(cft162 == '1')
{
if(item_num(item[15]) < 12) return;
if(item_num(item[30]) < 1) return;
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[15]);
item_delete(item[30]);
item_pick(item[32]);
xp += 3;
}
else if(cft162 == '2')
{
return;
}
}
else if(cft16 == '3')
{
SetPos(10, 11);
cout << "需要 下界合金块x2 魂石x1";
SetPos(10, 13);
cout << "1 确认";
SetPos(10, 15);
cout << "2 离开";
char cft163 = input('1', '2');
if(cft163 == '1')
{
if(block_num(block[17]) < 2) return;
if(block_num(block[34]) < 1) return;
block_delete(block[17]);
block_delete(block[17]);
block_delete(block[34]);
item_pick(item[30]);
xp += 3;
}
else if(cft163 == '2')
{
return;
}
}
else if(cft16 == '4')
{
return;
}
}
else if(cft1 == '8')
{
SetPos(10, 1);
cout << "合成 - 工具类 - 药水";
SetPos(10, 3);
cout << "1 生命提升药水";
SetPos(10, 5);
cout << "2 急迫药水";
SetPos(10, 7);
cout << "3 生命吸收药水";
SetPos(10, 9);
cout << "4 中毒药水";
SetPos(10, 11);
cout << "5 离开";
char cft17 = input('1', '5');
if(cft17 == '1')
{
SetPos(10, 13);
cout << "需要 水桶x1 药水量子x1";
SetPos(10, 15);
cout << "1 确认";
SetPos(10, 17);
cout << "2 离开";
char cft171 = input('1', '2');
if(cft171 == '1')
{
if(item_num(item[19]) < 1) return;
if(item_num(item[21]) < 1) return;
item_delete(item[19]);
item_delete(item[21]);
buff_give(buff[1], 2, 1200);
xp += 3;
}
}
else if(cft17 == '2')
{
SetPos(10, 13);
cout << "需要 水桶x1 药水量子x1";
SetPos(10, 15);
cout << "1 确认";
SetPos(10, 17);
cout << "2 离开";
char cft172 = input('1', '2');
if(cft172 == '1')
{
if(item_num(item[19]) < 1) return;
if(item_num(item[21]) < 1) return;
item_delete(item[19]);
item_delete(item[21]);
buff_give(buff[2], 2, 1200);
xp += 3;
}
}
else if(cft17 == '3')
{
SetPos(10, 13);
cout << "需要 水桶x1 药水量子x1";
SetPos(10, 15);
cout << "1 确认";
SetPos(10, 17);
cout << "2 离开";
char cft173 = input('1', '2');
if(cft173 == '1')
{
if(item_num(item[19]) < 1) return;
if(item_num(item[21]) < 1) return;
item_delete(item[19]);
item_delete(item[21]);
buff_give(buff[3], 2, 1200);
xp += 3;
}
}
else if(cft17 == '4')
{
SetPos(10, 13);
cout << "需要 水桶x1 药水量子x1";
SetPos(10, 15);
cout << "1 确认";
SetPos(10, 17);
cout << "2 离开";
char cft174 = input('1', '2');
if(cft174 == '1')
{
if(item_num(item[19]) < 1) return;
if(item_num(item[21]) < 1) return;
item_delete(item[19]);
item_delete(item[21]);
buff_give(buff[4], 2, 1200);
xp += 3;
}
}
}
}
else if(cft0 == '2')
{
SetPos(10, 1);
cout << "合成 - 熔炼类";
SetPos(10, 3);
cout << "1 锭熔炼";
SetPos(10, 5);
cout << "2 远古残骸熔炼";
SetPos(10, 7);
cout << "3 离开";
char cft2 = input('1', '3');
system("cls");
if(cft2 == '1')
{
SetPos(10, 1);
cout << "合成 - 熔炼类 - 锭熔炼";
SetPos(10, 3);
cout << "1 铁锭";
SetPos(10, 5);
cout << "2 金锭";
SetPos(10, 7);
cout << "3 钻石";
SetPos(10, 9);
cout << "4 下界合金锭";
SetPos(10, 11);
cout << "5 离开";
char cft21 = input('1', '5');
if(cft21 == '1')
{
SetPos(10, 13);
cout << "需要 铁矿石x1";
SetPos(10, 15);
cout << "1 确认";
SetPos(10, 17);
cout << "2 离开";
char cft211 = input('1', '2');
if(cft211 == '1')
{
if(block_num(block[5]) < 1) return;
block_delete(block[5]);
item_pick(item[5]);
xp += 3;
}
else
{
return;
}
}
else if(cft21 == '2')
{
SetPos(10, 13);
cout << "需要 金矿石x1";
SetPos(10, 15);
cout << "1 确认";
SetPos(10, 17);
cout << "2 离开";
char cft212 = input('1', '2');
if(cft212 == '1')
{
if(block_num(block[7]) < 1) return;
block_delete(block[7]);
item_pick(item[8]);
xp += 3;
}
else
{
return;
}
}
else if(cft21 == '3')
{
SetPos(10, 13);
cout << "需要 钻石矿石x1";
SetPos(10, 15);
cout << "1 确认";
SetPos(10, 17);
cout << "2 离开";
char cft213 = input('1', '2');
if(cft213 == '1')
{
if(block_num(block[9]) < 1) return;
block_delete(block[9]);
item_pick(item[11]);
xp += 3;
}
else
{
return;
}
}
else if(cft21 == '4')
{
SetPos(10, 13);
cout << "需要 下界合金碎片x4 金锭x4";
SetPos(10, 15);
cout << "1 确认";
SetPos(10, 17);
cout << "2 离开";
char cft211 = input('1', '2');
if(cft211 == '1')
{
if(item_num(item[14]) < 4) return;
if(item_num(item[8]) < 4) return;
item_delete(item[14]);
item_delete(item[14]);
item_delete(item[14]);
item_delete(item[14]);
item_delete(item[8]);
item_delete(item[8]);
item_delete(item[8]);
item_delete(item[8]);
item_pick(item[15]);
xp += 3;
}
else
{
return;
}
}
else if(cft21 == '5')
{
return;
}
}
else if(cft2 == '2')
{
SetPos(10, 1);
cout << "合成 - 熔炼类 - 远古残骸熔炼";
SetPos(10, 3);
cout << "1 下界合金碎片";
SetPos(10, 5);
cout << "2 离开";
char cft22 = input('1', '2');
if(cft22 == '1')
{
SetPos(10, 7);
cout << "需要 远古残骸x1";
SetPos(10, 9);
cout << "1 确认";
SetPos(10, 11);
cout << "2 离开";
char cft221 = input('1', '2');
if(cft221 == '1')
{
if(block_num(block[16]) < 1) return;
block_delete(block[16]);
item_pick(item[14]);
xp += 3;
}
}
}
}
else if(cft0 == '3')
{
SetPos(10, 1);
cout << "合成 - 盔甲类";
SetPos(10, 3);
cout << "1 木盔甲";
SetPos(10, 5);
cout << "2 石盔甲";
SetPos(10, 7);
cout << "3 铁盔甲";
SetPos(10, 9);
cout << "4 钻石盔甲";
SetPos(10, 11);
cout << "5 下界合金盔甲";
SetPos(10, 13);
cout << "6 离开";
SetPos(10, 15);
Color(2), cout << "Tips:盔甲制造后立即替换当前盔甲!!", Color(0);
char cft3 = input('1', '6');
if(cft3 == '1')
{
SetPos(10, 17);
cout << "需要 木头x4";
SetPos(10, 19);
cout << "1 确认";
SetPos(10, 21);
cout << "2 离开";
char cft31 = input('1', '2');
if(cft31 == '1')
{
if(block_num(block[4]) < 4) return;
block_delete(block[4]);
block_delete(block[4]);
block_delete(block[4]);
block_delete(block[4]);
armor_pick(armor[1]);
xp += 3;
}
}
else if(cft3 == '2')
{
SetPos(10, 17);
cout << "需要 石头x6";
SetPos(10, 19);
cout << "1 确认";
SetPos(10, 21);
cout << "2 离开";
char cft32 = input('1', '2');
if(cft32 == '1')
{
if(block_num(block[1]) < 6) return;
block_delete(block[1]);
block_delete(block[1]);
block_delete(block[1]);
block_delete(block[1]);
block_delete(block[1]);
block_delete(block[1]);
armor_pick(armor[2]);
xp += 3;
}
}
else if(cft3 == '3')
{
SetPos(10, 17);
cout << "需要 铁锭x3";
SetPos(10, 19);
cout << "1 确认";
SetPos(10, 21);
cout << "2 离开";
char cft33 = input('1', '2');
if(cft33 == '1')
{
if(item_num(item[5]) < 3) return;
item_delete(item[5]);
item_delete(item[5]);
item_delete(item[5]);
armor_pick(armor[3]);
xp += 3;
}
}
else if(cft3 == '4')
{
SetPos(10, 17);
cout << "需要 钻石x12";
SetPos(10, 19);
cout << "1 确认";
SetPos(10, 21);
cout << "2 离开";
char cft34 = input('1', '2');
if(cft34 == '1')
{
if(item_num(item[11]) < 12) return;
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
armor_pick(armor[4]);
xp += 3;
}
}
else if(cft3 == '5')
{
SetPos(10, 17);
cout << "需要 钻石x12 下界合金块x1";
SetPos(10, 19);
cout << "1 确认";
SetPos(10, 21);
cout << "2 离开";
char cft35 = input('1', '2');
if(cft35 == '1')
{
if(item_num(item[11]) < 12) return;
if(block_num(block[17]) < 1) return;
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
item_delete(item[11]);
block_delete(block[17]);
armor_pick(armor[5]);
xp += 3;
}
}
else if(cft3 == '6')
{
return;
}
}
else if(cft0 == '4')
{
SetPos(10, 1);
cout << "合成 - 杂项";
int page = 1, pagemax = 2;
while(1)
{
system("cls");
SetPos(10, 1);
cout << "合成 - 杂项";
SetPos(10, 3);
cout << "A 上一页 D 下一页 E 离开";
SetPos(10, 5);
cout << page << '/' << pagemax << "页";
if(page == 1)
{
SetPos(10, 7);
cout << "1 桶";
SetPos(10, 9);
cout << "2 药水量子";
SetPos(10, 11);
cout << "3 强化量子";
SetPos(10, 13);
cout << "4 海洋创造锤";
}
else if(page == 2)
{
SetPos(10, 7);
cout << "1 箱子";
SetPos(10, 9);
cout << "2 无尽核心";
SetPos(10, 11);
cout << "3 宝藏探测器";
SetPos(10, 13);
cout << "4 守卫祭坛";
}
char cft4 = input();
if(cft4 == 'a' && page != 1) page--;
else if(cft4 == 'd' && page != pagemax) page++;
else if(cft4 == 'e')
{
return;
}
else if(cft4 >= '1' && cft4 <= '4')
{
char choose;
if(page == 1)
{
switch(cft4)
{
case '1':
SetPos(10, 15);
cout << "需要 铁锭x3";
SetPos(10, 17);
cout << "1 确认";
SetPos(10, 19);
cout << "2 离开";
choose = input('1', '2');
if(choose == '1')
{
if(item_num(item[5]) < 3) return;
item_delete(item[5]);
item_delete(item[5]);
item_delete(item[5]);
item_pick(item[18]);
xp += 3;
}
break;
case '2':
SetPos(10, 15);
cout << "需要 下界合金锭x1";
SetPos(10, 17);
cout << "1 确认";
SetPos(10, 19);
cout << "2 离开";
choose = input('1', '2');
if(choose == '1')
{
if(item_num(item[15]) < 1) return;
item_delete(item[15]);
item_pick(item[21]);
xp += 3;
}
break;
case '3':
SetPos(10, 15);
cout << "需要 海洋之星x1 药水量子x1";
SetPos(10, 17);
cout << "1 确认";
SetPos(10, 19);
cout << "2 离开";
choose = input('1', '2');
if(choose == '1')
{
if(item_num(item[21]) < 1) return;
if(block_num(block[20]) < 1) return;
item_delete(item[21]);
block_delete(block[20]);
item_pick(item[22]);
xp += 3;
}
break;
case '4':
SetPos(10, 15);
cout << "需要 海洋之星x1";
SetPos(10, 17);
cout << "1 确认";
SetPos(10, 19);
cout << "2 离开";
choose = input('1', '2');
if(choose == '1')
{
if(block_num(block[20]) < 1) return;
block_delete(block[20]);
item_pick(item[26]);
xp += 3;
}
break;
default:
break;
}
}
else if(page == 2)
{
switch(cft4)
{
case '1':
SetPos(10, 15);
cout << "需要 木头x16";
SetPos(10, 17);
cout << "1 确认";
SetPos(10, 19);
cout << "2 离开";
choose = input('1', '2');
if(choose == '1')
{
if(block_num(block[4]) < 16) return;
for(int i = 0;i < 16;i++) block_delete(block[4]);
block_pick(block[37]);
xp += 3;
}
break;
case '2':
SetPos(10, 15);
cout << "需要 下界合金块x4";
SetPos(10, 17);
cout << "1 确认";
SetPos(10, 19);
cout << "2 离开";
choose = input('1', '2');
if(choose == '1')
{
if(block_num(block[17]) < 4) return;
block_delete(block[17]);
block_delete(block[17]);
block_delete(block[17]);
block_delete(block[17]);
item_pick(item[27]);
xp += 3;
}
break;
case '3':
SetPos(10, 15);
cout << "需要 无尽核心x1 钻石块x32";
SetPos(10, 17);
cout << "1 确认";
SetPos(10, 19);
cout << "2 离开";
choose = input('1', '2');
if(choose == '1')
{
if(item_num(item[27]) < 1) return;
if(block_num(block[10]) < 32) return;
item_delete(item[27]);
for(int i = 0;i < 32;i++) block_delete(block[10]);
item_pick(item[28]);
xp += 3;
}
break;
case '4':
SetPos(10, 15);
cout << "需要 下界合金锭x1 绿宝石块x4";
SetPos(10, 17);
cout << "1 确认";
SetPos(10, 19);
cout << "2 离开";
SetPos(10, 21);
Color(2), cout << "【请谨慎使用BOSS祭坛,否则……】";
Color(0);
choose = input('1', '2');
if(choose == '1')
{
if(item_num(item[15]) < 1) return;
if(block_num(block[23]) < 4) return;
SetPos(10, 23);
Color(2), cout << "【最严重的警告】";
Color(4), cout << "守卫BOSS的破坏力极其强大,你需要面临方圆200格内地图被摧毁的风险!";
Color(0);
SetPos(10, 25);
system("pause");
item_delete(item[15]);
block_delete(block[23]);
block_delete(block[23]);
block_delete(block[23]);
block_delete(block[23]);
block_pick(block[39]);
xp += 3;
}
break;
default:
break;
}
}
}
}
}
else if(cft0 == '5')
{
return;
}
}
void sea_crafting()
{
SetPos(10, 1);
cout << "海洋合成";
SetPos(10, 3);
cout << "1 强化型药水";
SetPos(10, 5);
cout << "2 离开";
char sft0 = input('1', '2');
system("cls");
if(sft0 == '1')
{
SetPos(10, 1);
cout << "海洋合成 - 强化型药水";
SetPos(10, 3);
cout << "1 强化急迫药水";
SetPos(10, 5);
cout << "2 强化中毒药水";
SetPos(10, 7);
cout << "3 离开";
char sft1 = input('1', '3');
if(sft1 == '1')
{
SetPos(10, 9);
cout << "需要 岩浆桶x1 强化量子x1";
SetPos(10, 11);
cout << "1 确认";
SetPos(10, 13);
cout << "2 离开";
char sft11 = input('1', '2');
if(sft11 == '1')
{
if(item_num(item[20]) < 1) return;
if(item_num(item[22]) < 1) return;
item_delete(item[20]);
item_delete(item[22]);
buff_give(buff[2], 4, 1200);
xp += 3;
}
}
else if(sft1 == '2')
{
SetPos(10, 9);
cout << "需要 岩浆桶x1 强化量子x1";
SetPos(10, 11);
cout << "1 确认";
SetPos(10, 13);
cout << "2 离开";
char sft12 = input('1', '2');
if(sft12 == '1')
{
if(item_num(item[20]) < 1) return;
if(item_num(item[22]) < 1) return;
item_delete(item[20]);
item_delete(item[22]);
buff_give(buff[4], 4, 1200);
xp += 3;
}
}
}
else if(sft0 == '2')
{
return;
}
}
void bomb(int x, int y, int lvl)
{
for(int i = x - lvl * 5;i <= x + lvl * 5;i++)
{
for(int j = y - lvl * 5;j <= y + lvl * 5;j++)
{
if(sqrt(abs(i - x) * abs(i - x) + abs(j - y) * abs(j - y)) <= lvl * 2)
{
block_copy(i, j, 19);
}
}
}
if(sqrt(abs(playerx - x) * abs(playerx - x) + abs(playery - y) * abs(playery - y)) <= lvl * 2)
{
attack(lvl * 4, "玩家被炸成了灰烬");
}
}
void other()
{
while(1)
{
SetPos(0, 0);
cout << "属性";
SetPos(0, 2);
cout << "Z键开启合成界面";
if(now >= 5 && wpl[now - 5].id == 26)
{
Color(3), cout << " 手持海洋创造锤 可进入专项合成区";
Color(0);
}
SetPos(0, 4);
cout << "药水效果:";
if(xgnum < 5)
{
for(int i = 0;i < xgnum;i++)
{
SetPos(0, 6 + 4 * i);
cout << xgl[i].name << "[" << xgl[i].level << "级]";
SetPos(0, 7 + 4 * i);
cout << xgl[i].time / 600 << ":" << xgl[i].time % 600 / 10;
SetPos(0, 8 + 4 * i);
cout << buff_str[xgl[i].id];
}
}
else if(xgnum < 12)
{
for(int i = 0;i < xgnum;i++)
{
SetPos(0, 6 + 2 * i);
cout << xgl[i].name << "[" << xgl[i].level << "级]";
}
}
else
{
for(int i = 0;i < 12;i++)
{
SetPos(0, 6 + 2 * i);
cout << xgl[i].name << "[" << xgl[i].level << "级]";
}
}
SetPos(40, 4);
cout << "基本属性:";
SetPos(40, 6);
cout << "生命值:" << health;
SetPos(40, 8);
cout << "生命值上限:" << max_health + get_buff_level(buff[1]) * 4 << endl;
SetPos(40, 10);
cout << "挖掘速度:";
if(now <= 4) cout << "0";
else cout << (10 + wpl[now - 5].speed) * (1 + get_buff_level(buff[2]) * 0.25) * (sqrt(level * 2.5 + 1) * 0.2) << "每短刻";
SetPos(40, 13);
cout << "等级:" << level;
SetPos(60, 13);
cout << "经验:" << xp << "/" << 100 + (level + 1) * 10;
int xp_of_level = 100 + (level + 1) * 10;
int xp_ge = xp * 30 / xp_of_level;
for(int i = 0;i < min(xp_ge, 30);i++) SetPos(40 + i, 15), Color(2), cout << "█";
for(int i = xp_ge;i < 30;i++) SetPos(40 + 1, 15), Color(0), cout << "█";
SetPos(40, 14);
cout << "X键返回主页面";
if(_kbhit())
{
char x = _getch();
if(x == 'z')
{
system("cls");
if(now >= 5 && wpl[now - 5].id == 26) sea_crafting();
else crafting();
system("cls");
}
else if(x == 'x')
{
system("cls");
return;
}
}
}
}
void shouwei_gongji(float x0, float y0, float x1, float y1)
{
float Ax=x1-x0,Ay=y1-y0,Dis=sqrt(Ax*Ax+Ay*Ay);
bool left=0;
if(Ax<0) swap(x1,x0),swap(y1,y0),Ax*=-1,Ay*=-1;
if(Ay<0) left=1;
float ax=Ax/Dis*1.0,ay=Ay/Dis*1.0;
float i=x0,j=y0;
while(i<=x1&&((j<=y1&&left==0)||(j>=y1&&left==1)))
{
block_copy(to_int(i), to_int(j), 38);
i+=ax;j+=ay;
}
}
void xinshouyindao()
{
//新手引导
if(yindao != -1)
{
SetPos(94, 30);
cout << " ";
SetPos(94, 30);
if(yindao >= 0 && yindao <= 10)
{
cout << "你目前处于我们的新手教程房屋中";
yindao++;
}
else if(yindao >= 11 && yindao <= 20)
{
cout << "接下来右侧会出现一个标靶";
yindao++;
}
else if(yindao == 21)
{
cout << "标靶出现!我想你需要按d走过去";
block_copy(416, 401, 40);
}
else if(yindao >= 22 && yindao <= 26)
{
cout << "Excellent!";
yindao++;
}
else if(yindao == 27)
{
cout << "d--》右移,a--》左移";
block_copy(406, 401, 40);
}
else if(yindao >= 28 && yindao <= 32)
{
cout << "Excellent!";
yindao++;
}
else if(yindao == 33)
{
cout << "为了到达新标靶,你需要按W跳跃";
block_copy(406, 404, 40);
}
else if(yindao >= 34 && yindao <= 38)
{
cout << "Excellent!";
yindao++;
}
else if(yindao >= 39 && yindao <= 41)
{
cout << "挖掘右边出现的方块!";
block_copy(409, 404, 4);
yindao++;
}
else if(yindao == 42)
{
cout << "使用i j k l来挖掘";
}
else if(yindao >= 43 && yindao <= 47)
{
cout << "Excellent!";
yindao++;
}
else if(yindao == 48)
{
yindao = 49;
cout << "切换物品来挖掘方块!";
item_pick(item[1]);
item_pick(item[6]);
block_copy(406, 404, 9);
}
else if(yindao >= 50 && yindao <= 54)
{
cout << "Excellent!";
yindao++;
}
else if(yindao == 55)
{
cout << "点击E,点击Z,合成一把合金镐!";
for(int i = 0;i < 12;i++) item_pick(item[11]);
block_pick(block[17]);
}
SetPos(94, 30);
//标靶
if(yindao == 21 && abs(playerx - 416) <= 1 && playery == 401)
{
SetPos(94, 30);
cout << " ";
SetPos(94, 30);
cout << "Excellent!";
yindao = 22;
block_copy(416, 401, 19);
}
if(yindao == 27 && abs(playerx - 406) <= 1 && playery == 401)
{
SetPos(94, 30);
cout << " ";
SetPos(94, 30);
cout << "Excellent!";
yindao = 28;
block_copy(406, 401, 19);
}
if(yindao == 33 && abs(playerx - 406) <= 1 && playery == 404)
{
SetPos(94, 30);
cout << " ";
SetPos(94, 30);
cout << "Excellent!";
yindao = 34;
block_copy(406, 404, 19);
}
if(yindao == 42 && world[409][404].id != 4)
{
SetPos(94, 30);
cout << " ";
SetPos(94, 30);
cout << "Excellent!";
yindao = 43;
}
if(yindao == 49 && world[406][404].id != 9)
{
SetPos(94, 30);
cout << " ";
SetPos(94, 30);
cout << "Excellent!";
yindao = 50;
}
}
}
void chuangshengzhili(int i)
{
summon_entity(stl[i].x - 2, stl[i].y - 2, 0);
summon_entity(stl[i].x + 2, stl[i].y - 2, 0);
summon_entity(stl[i].x - 2, stl[i].y + 2, 0);
summon_entity(stl[i].x + 2, stl[i].y + 2, 0);
}
void huimiebaopo(int i)
{
int num = 12, r = 14;
int next = 360 / num;
for(int ss = 0;ss < 360;ss++)
{
if(ss % next == 0)
{
float X, Y;
X = Sin(ss)*r;
Y = Cos(ss)*r;
bomb(stl[i].x + (int)X, stl[i].y + (int)Y, 2);
}
}
}
void chuanshanlieshi(int i)
{
float x0, y0, x1, y1;
int pianyix = 0, pianyiy = 0;
for(int pianyix = -2;pianyix <= 2;pianyix++)
{
for(int pianyiy = -2;pianyiy <= 2;pianyiy++)
{
x0=stl[i].x+pianyix;y0=stl[i].y+pianyiy;x1=stl[i].x+pianyix+(-stl[i].x-pianyix+playerx)*10;y1=stl[i].y+pianyiy+(-stl[i].y-pianyiy+playery)*10;
shouwei_gongji(x0, y0, x1, y1);
}
}
attack(19, "玩家在强激光中灰飞烟灭了");
stl[i].hp += 5;
if(stl[i].hp >= entity[stl[i].type].hp) stl[i].hp = entity[stl[i].type].hp;
}
void siwangtuci(int i)
{
shouwei_gongji(stl[i].x, stl[i].y, stl[i].x + (-stl[i].x + playerx), stl[i].y + (-stl[i].y + playery));
stl[i].x = playerx;
stl[i].y = playery;
attack(9, "玩家在剧烈的动能中死亡");
}
void jiliu(int i, int j)
{
int dx[16] = {1, -1, 0, 0, 1, -1, 1, -1, 2, -2, 0, 0, 2, -2, 2, -2};
int dy[16] = {0, 0, 1, -1, 1, -1, -1, 1, 0, 0, 2, -2, 2, -2, -2, 2};
int nx = i, ny = j;
for(int i = 0;i < 21;i++)
{
int r = rand() % 16;
if(!(nx + dx[r] == i && ny + dy[r] == j))
{
nx += dx[r];
ny += dy[r];
if(world[nx][ny].id != 42) block_copy(nx, ny, 41);
}
}
}
void box_gui()
{
int now_item = 0, now_block = 0;
int type = 0, subtype = 0;
system("cls");
while(1)
{
Sleep(50);
system("cls");
SetPos(12, 4);
cout << "按Q键退出箱子GUI";
for(int i = 0;i < 5;i++)
{
SetPos(6 + i * 20, 6);
Color(fkl[i].color);
cout << fkl[i].txt << ' ' << fkl[i].name;
SetPos(18 + i * 20, 6);
cout << "X" << fknum[i];
}
for(int i = 0;i < 5;i++)
{
SetPos(6 + i * 20, 8);
if(wpl[i].rare == 0) Color(0);
else if(wpl[i].rare == 1) Color(1);
else if(wpl[i].rare == 2) Color(3);
else if(wpl[i].rare == 3) Color(4);
else Color(-1);
cout << wpl[i].name;
SetPos(18 + i * 20, 8);
cout << "X" << fknum[i];
}
SetPos(12, 12);
if(type == 0) cout << "【取出模式】选择要取出的物品/方块:M更改模式 E更改物品或方块 A向左 D向右 S取出 W全部取出";
else if(type == 1) cout << "【存储模式】选择要存入的物品/方块:M更改模式 E更改物品或方块 A向左 D向右 S存入 W全部存入";
if(subtype == 0)
{
SetPos(12, 14);
if(item[now_item].rare == 0) Color(0);
else if(item[now_item].rare == 1) Color(1);
else if(item[now_item].rare == 2) Color(3);
else if(item[now_item].rare == 3) Color(4);
else Color(-1);
cout << item[now_item].name;
SetPos(32, 14);
Color(0), cout << "X" << box_wp_num[now_item];
}
else if(subtype == 1)
{
SetPos(12, 14);
Color(block[now_block].color);
cout << block[now_block].txt;
SetPos(16, 14);
cout << block[now_block].name;
SetPos(32, 14);
Color(0), cout << "X" << box_fk_num[now_block];
}
if(_kbhit())
{
char x = _getch();
if(x == 'q')
{
system("cls");
return;
}
else if(x == 'm')
{
type = (type + 1) % 2;
}
else if(x == 'e') subtype = (subtype + 1) % 2;
else if(x == 'a' && subtype == 0) now_item = max(0, now_item - 1);
else if(x == 'd' && subtype == 0) now_item = min(item_max, now_item + 1);
else if(x == 'a' && subtype == 1) now_block = max(0, now_block - 1);
else if(x == 'd' && subtype == 1) now_block = min(block_max, now_block + 1);
else if(x == 's' && subtype == 0 && type == 0 && box_wp_num[now_item])
{
box_wp_num[now_item]--;
item_pick(item[now_item]);
}
else if(x == 'w' && subtype == 0 && type == 0 && box_wp_num[now_item])
{
for(int i = 0;i < box_wp_num[now_item];i++) item_pick(item[now_item]);
box_wp_num[now_item] = 0;
}
else if(x == 's' && subtype == 1 && type == 0 && box_fk_num[now_item])
{
box_fk_num[now_block]--;
block_pick(block[now_block]);
}
else if(x == 'w' && subtype == 1 && type == 0 && box_fk_num[now_block])
{
for(int i = 0;i < box_fk_num[now_block];i++) block_pick(block[now_block]);
box_fk_num[now_block] = 0;
}
else if(x == 's' && subtype == 0 && type == 1 && item_num(item[now_item]))
{
item_delete(item[now_item]);
box_wp_num[now_item]++;
}
else if(x == 'w' && subtype == 0 && type == 1 && item_num(item[now_item]))
{
box_wp_num[now_item] += item_num(item[now_item]);
int now_num = item_num(item[now_item]);
for(int i = 0;i < now_num;i++) item_delete(item[now_item]);
}
else if(x == 's' && subtype == 1 && type == 1 && block_num(block[now_block]))
{
block_delete(block[now_block]);
box_fk_num[now_block]++;
}
else if(x == 'w' && subtype == 1 && type == 1 && block_num(block[now_block]))
{
box_fk_num[now_block] += block_num(block[now_block]);
int now_num = block_num(block[now_block]);
for(int i = 0;i < now_num;i++) block_delete(block[now_block]);
}
}
}
}
void minecraft()
{
int jianweitishi = 20, wajuetishi = 0;
int fangzhihuanchong = 10;
int gongjihuanchong = 0;
system("cls");
int clocknum = clock();
while(1)
{
bool flagjian = false;
int c;
while(clock() - clocknum < 100)
{
c = 1;
}
if(_kbhit()) flagjian = true;
//时刻流逝
short_tick++;
for(int i = playerx - 20;i <= playerx + 20;i++)
{
for(int j = playery - 20;j <= playery + 20;j++)
{
if(world[i][j].id == 38 && rand() % 4 == 0) block_copy(i, j, 19);
if(world[i][j].id == 41 && rand() % 2 == 0) block_copy(i, j, 19);
if(world[i][j].id == 42) jiliu(i, j);
}
}
if(short_tick == 10)
{
print_data();
short_tick = 0;
tick++;
tick_attack = false;
int zhongdulevel = get_buff_level(buff[4]);
if(zhongdulevel > 0) attack(zhongdulevel, "玩家中毒而死");
for(int i = 0;i < st_num;i++)
{
stl[i].color = entity[stl[i].type].color;
}
}
if(jianweitishi) jianweitishi--;
if(wajuetishi) wajuetishi--;
if(fangzhihuanchong) fangzhihuanchong--;
if(gongjihuanchong) gongjihuanchong--;
//处理药水效果
buff_merge();
buff_live();
//处理生命溢出
if(health >= max_health + get_buff_level(buff[1]) * 4)
{
health = max_health + get_buff_level(buff[1]) * 4;
}
//处理等级提升
int i = 0;
while(xp >= 100 + (level + 1) * 10)
{
i++;
xp -= 100 + (level + 1) * 10;
level++;
if(level % 2 == 0) max_health++; //每两级加一滴血
}
//处理TNT爆炸
for(int i = 0;i < st_num;i++)
{
if(stl[i].type >= 4 && stl[i].type <= 7)
{
stl[i].hp--;
if(stl[i].hp <= 0)
{
if(stl[i].type == 4) bomb(stl[i].x, stl[i].y, 3);
if(stl[i].type == 5) bomb(stl[i].x, stl[i].y, 4);
if(stl[i].type == 6) bomb(stl[i].x, stl[i].y, 5);
if(stl[i].type == 7) bomb(stl[i].x, stl[i].y, 6);
for(int j = i + 1;j < st_num;j++)
{
stl[i] = stl[j];
}
st_num--;
}
}
}
//处理实体溢出
for(int i = 0;i < st_num;i++)
{
if(!stl[i].boss && abs(stl[i].x - playerx) + abs(stl[i].y - playery) >= 20)
{
stl[i].hp /= 4;
stl[i].hp -= 2;
if(stl[i].hp <= 0)
{
for(int j = i + 1;j < st_num;j++)
{
stl[i] = stl[j];
}
st_num--;
}
}
}
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(94, 2); //输出玩家坐标
cout << "X:" << playerx;
SetPos(94, 4);
cout << "Y:" << playery;
for(int i = 0;i < 5;i++) //打印物品栏 方块栏
{
SetPos(94, 6 + i * 2);
if(now == i) Color(5);
else if(wajuetishi) Color(2);
cout << i << " ";
Color(0);
if(fknum[i] > 0)
{
Color(fkl[i].color);
cout << fkl[i].txt << " " << fkl[i].name;
Color(0);
cout << " " << fknum[i] << "x ";
}
else
{
cout << " ";
}
SetPos(94, 6 + (i + 5) * 2);
if(now == i + 5) Color(5);
else if(wajuetishi) Color(1);
cout << i + 5 << " ";
Color(0);
if(wpnum[i] > 0)
{
if(wpl[i].rare == 0) Color(0);
else if(wpl[i].rare == 1) Color(1);
else if(wpl[i].rare == 2) Color(3);
else if(wpl[i].rare == 3) Color(4);
else Color(-1);
if(wpl[i].rare == 4)
{
string s = wpl[i].name;
for(int i = 0;i < s.size();i++)
{
Color(-1), cout << s[i];
}
}
else cout << wpl[i].name;
if(wpl[i].rare == 4) Color(2);
cout << " " << wpnum[i] << "x ";
Color(0);
}
else
{
cout << " ";
}
}
SetPos(94, 26);
cout << "盔甲:" << kjl.name;
SetPos(0, 34);
cout << " ";
SetPos(0, 35);
cout << " ";
SetPos(0, 36);
cout << "E键开启属性界面";
SetPos(0, 37);
cout << "S键保存当前存档";
if(gamemode == 0 || gamemode == 2)
{
SetPos(0, 38);
cout << "Q键摧毁手持物品";
}
else
{
SetPos(0, 38);
cout << "Q键选择手持物品";
}
SetPos(30, 38);
cout << " ";
SetPos(30, 38);
if(fangzhihuanchong)
{
for(int i = 0;i < fangzhihuanchong * 2;i++)
{
Color(5), cout << "[]";
}
for(int i = fangzhihuanchong * 2;i < 20;i++)
{
cout << " ";
}
}
int bosscnt = 0;
for(int i = 0;i < st_num;i++)
{
if(stl[i].boss && abs(stl[i].x - playerx) <= 30 && abs(stl[i].y - playery) <= 30) bosscnt++;
}
xinshouyindao();
//输出地图
SetPos(0, 5);
int jhh = 4;
for(int i = playery + 15;i >= playery - 9;i--)
{
jhh++;
SetPos(0, jhh);
int s = 0;
for(int j = playerx - 19;j <= playerx + 19;j++)
{
s++;
SetPos(s * 2, jhh);
if((s >= 5 || s <= 25) && (jhh >= 5 && jhh <= 6) && bosscnt >= 1)
{
continue;
}
if((s >= 5 || s <= 25) && (jhh >= 8 && jhh <= 9) && bosscnt >= 2)
{
continue;
}
if((s >= 5 || s <= 25) && (jhh >= 11 && jhh <= 12) && bosscnt >= 3)
{
continue;
}
if((s >= 5 || s <= 25) && (jhh >= 14 && jhh <= 15) && bosscnt >= 4)
{
continue;
}
if(i == playery && j == playerx)
{
cout << "[]";
continue;
}
bool flag = false;
for(int k = 0;k < st_num;k++)
{
if(stl[k].x == j && stl[k].y == i)
{
Color(stl[k].color);
cout << stl[k].txt;
flag = true;
break;
}
}
//进入游戏后一秒键位提示
if(jianweitishi)
{
if(world[j][i].fluid)
{
if(j == playerx && i == playery + 1)
{
Color(5), cout << "W^";
Color(0);
continue;
}
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>";
Color(0);
continue;
}
}
else
{
if(j == playerx && i == playery + 1)
{
Color(2), cout << "I^";
Color(0);
continue;
}
else if(j == playerx && i == playery - 1)
{
Color(2), cout << "Kv";
Color(0);
continue;
}
else if(j == playerx - 1 && i == playery)
{
Color(2), cout << "J<";
Color(0);
continue;
}
else if(j == playerx + 1 && i == playery)
{
Color(2), cout << "L>";
Color(0);
continue;
}
}
}
if(!flag) Color(world[j][i].color), cout << world[j][i].txt;
Color(0);
}
}
SetPos(0, 5);
int jjj = 5;
//BOSS血条
for(int i = 0;i < st_num;i++)
{
if(jjj > 14) break;
if(stl[i].boss && abs(stl[i].x - playerx) <= 30 && abs(stl[i].y - playery) <= 30)
{
SetPos(10, jjj);
Color(stl[i].color), cout << "|==";
SetPos(51, jjj);
cout << "==|";
SetPos(20, jjj);
Color(2), cout << "[BOSS]" << stl[i].name;
SetPos(10, jjj + 1);
for(int i = 0;i < 40;i++)
{
Color(stl[i].color), cout << "=";
}
SetPos(10, jjj + 1);
for(int smm = 0;smm < stl[i].hp * 20 / entity[stl[i].type].hp;smm++)
{
Color(stl[i].color);
cout << "■";
}
SetPos(10, jjj + 1);
cout << "|<>|";
SetPos(50, jjj + 1);
cout << "|<>|";
jjj += 3;
}
}
Color(0);
//流体下降
for(int i = playery + 20;i >= playery - 20;i--)
{
for(int j = playerx - 20;j <= playerx + 20;j++)
{
if(world[j][i].fluid && world[j][i - 1].id == 19
&& world[j][i].id != 38)
{
block_copy(j, i - 1, world[j][i].id);
}
}
}
//生命恢复
if(short_tick == 9 && tick % 2 == 0 && health < the_mx && !tick_attack)
{
health++;
if(health > the_mx) health = the_mx;
}
//重力下落
if(((tick * 10 + short_tick) % 3 == 0) && energy < 25)
{
if(world[playerx][playery - 1].fluid)
{
playery--;
zhuiluo++;
}
else //落地
{
if(zhuiluo > 9) attack((zhuiluo - 9), "玩家摔死了");//摔落伤害
zhuiluo = 0;
}
}
//岩浆
if(world[playerx][playery].id == 13 && short_tick % 2 == 1)
{
attack(2, "玩家在熔岩里游泳");
}
//地幔
if(world[playerx][playery].id == 18)
{
attack(5, "玩家在地幔里游泳");
}
//死水
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++;
energy -= 334;
}
else energy = 0;
if(energy < 0) energy = 0;
}
//怪物实体跟随
for(int i = 0;i < st_num;i++)
{
if(abs(stl[i].x - playerx) + abs(stl[i].y - playery) >= 2
&& abs(stl[i].x - playerx) + abs(stl[i].y - playery) <= 128
&& short_tick % 5 == 0
&& !(stl[i].type >= 4 && stl[i].type <= 7))
{
if(stl[i].x < playerx)
{
if(world[stl[i].x + 1][stl[i].y].fluid)
{
stl[i].x++;
}
else if(stl[i].power)
{
block_copy(stl[i].x + 1, stl[i].y, 19);
stl[i].x++;
}
}
else if(stl[i].x > playerx)
{
if(world[stl[i].x - 1][stl[i].y].fluid)
{
stl[i].x--;
}
else if(stl[i].power)
{
block_copy(stl[i].x - 1, stl[i].y, 19);
stl[i].x--;
}
}
if(stl[i].y < playery)
{
if(world[stl[i].x][stl[i].y + 1].fluid)
{
stl[i].y++;
}
else if(stl[i].power)
{
block_copy(stl[i].x, stl[i].y + 1, 19);
stl[i].y++;
}
}
else if(stl[i].y > playery)
{
if(world[stl[i].x][stl[i].y - 1].fluid)
{
stl[i].y--;
}
else if(stl[i].power)
{
block_copy(stl[i].x, stl[i].y - 1, 19);
stl[i].y--;
}
}
}
}
//怪物攻击
for(int i = 0;i < st_num;i++)
{
if(abs(stl[i].x - playerx) + abs(stl[i].y - playery) <= 4
&& short_tick % 5 == 0)
{
attack(stl[i].ap, "玩家被" + stl[i].name + "杀死了");
}
//守卫 创生之力
if(stl[i].type == 3
&& abs(stl[i].x - playerx) + abs(stl[i].y - playery) <= 12
&& rand() % 100 == 0)
{
chuangshengzhili(i);
}
//守卫 毁灭爆破
if(stl[i].type == 3
&& abs(stl[i].x - playerx) + abs(stl[i].y - playery) <= 16
&& rand() % 100 == 0)
{
huimiebaopo(i);
}
//守卫 穿山裂石
if(stl[i].type == 3
&& abs(stl[i].x - playerx) + abs(stl[i].y - playery) <= 17
&& rand() % 60 == 0)
{
chuanshanlieshi(i);
}
//守卫 死亡突刺
if(stl[i].type == 3
&& abs(stl[i].x - playerx) + abs(stl[i].y - playery) >= 10
&& abs(stl[i].x - playerx) + abs(stl[i].y - playery) <= 25
&& rand() % 20 == 0)
{
siwangtuci(i);
}
//守卫连招
if(stl[i].type == 3
&& abs(stl[i].x - playerx) + abs(stl[i].y - playery) <= 25
&& stl[i].hp <= 500
&& rand() % 1 == 0)
{
if(rand() % 12 == 0) chuangshengzhili(i);
if(rand() % 4 == 0) chuanshanlieshi(i);
if(rand() % 30 == 0)siwangtuci(i);
if(rand() % 30 == 0) huimiebaopo(i);
}
}
int ddx, ddy;
char x;
if(flagjian)
{
x = _getch();
if(x == ' ')
{
if(now >= 5 && wpl[now - 5].hurt > 0)
{
bool flag = true;
for(int i = 0;i < st_num;i++)
{
if(abs(stl[i].x - playerx) + abs(stl[i].y - playery) <= 9
&& gongjihuanchong == 0)
{
SetPos(0, 24);
stl[i].color = 2;
stl[i].hp -= wpl[now - 5].hurt;
if(stl[i].hp < 0) stl[i].hp = 0;
if(stl[i].hp == 0)
{
if(stl[i].type == 3) block_copy(stl[i].x, stl[i].y, 42);
xp += stl[i].xp;
for(int j = i + 1;j < st_num;j++)
{
stl[i] = stl[j];
}
st_num--;
}
flag = false;
}
}
if(!flag) gongjihuanchong = 3;
}
}
if(x == 'a')
{
if(world[playerx - 1][playery].fluid)
{
playerx--;
}
wjjd = 0;
}
else if(x == 'd')
{
if(world[playerx + 1][playery].fluid)
{
playerx++;
}
wjjd = 0;
}
else if(x == 'w')
{
energy += 1000;
wjjd = 0;
}
else if(x >= '0' && x <= '9')
{
now = x - '0';
wjjd = 0;
fangzhihuanchong = 0;
}
else if(x == 'i' || x == 'j' || x == 'k' || x == 'l')
{
if(x == 'i') ddx = 0, ddy = 1;
else if(x == 'j') ddx = -1, ddy = 0;
else if(x == 'k') ddx = 0, ddy = -1;
else if(x == 'l') ddx = 1, ddy = 0;
//桶的收集判定
if(now >= 5 && wpl[now - 5].id == 18)
{
if(world[playerx + ddx][playery + ddy].id == 12)
{
item_delete(item[18]);
item_pick(item[19]);
block_copy(playerx + ddx, playery + ddy, 19);
}
else if(world[playerx + ddx][playery + ddy].id == 13)
{
item_delete(item[18]);
item_pick(item[20]);
block_copy(playerx + ddx, playery + ddy, 19);
}
else if(world[playerx + ddx][playery + ddy].id == 35)
{
item_delete(item[18]);
item_pick(item[29]);
block_copy(playerx + ddx, playery + ddy, 19);
}
}
//宝藏探测器判定
else if(now >= 5 && wpl[now - 5].id == 28)
{
int mindis = 100000000, mx, my;
for(int x = 101;x <= 2300;x++)
{
for(int y = 1; y <= 1100;y++)
{
if(world[x][y].id == 28)
{
if(mindis > abs(x - playerx) + abs(y - playery)) mx = x, my = y;
mindis = min(mindis, abs(x - playerx) + abs(y - playery));
}
}
}
if(mindis != 100000000)
{
playerx = mx;
playery = my;
}
}
//BOSS祭坛判定
if(world[playerx + ddx][playery + ddy].id == 39)
{
block_copy(playerx + ddx, playery + ddy, 19);
summon_entity(playerx + ddx, playery + ddy, 3);
}
//TNT判定
else if(world[playerx + ddx][playery + ddy].id >= 29
&& world[playerx + ddx][playery + ddy].id <= 32)
{
int tntid = world[playerx + ddx][playery + ddy].id;
switch(tntid)
{
case 29:
block_copy(playerx + ddx, playery + ddy, 19);
summon_entity(playerx + ddx, playery + ddy, 4);
break;
case 30:
block_copy(playerx + ddx, playery + ddy, 19);
summon_entity(playerx + ddx, playery + ddy, 5);
break;
case 31:
block_copy(playerx + ddx, playery + ddy, 19);
summon_entity(playerx + ddx, playery + ddy, 6);
break;
case 32:
block_copy(playerx + ddx, playery + ddy, 19);
summon_entity(playerx + ddx, playery + ddy, 7);
break;
default:
break;
}
}
//箱子判定
else if(world[playerx + ddx][playery + ddy].id == 37)
{
box_gui();
}
//其它判定
else if(world[playerx + ddx][playery + ddy].fluid && now <= 4 && !fangzhihuanchong)
{
wajuetishi = 20;
if(fknum[now] > 0 && fkl[now].id != 0)
{
block_copy(playerx + ddx, playery + ddy, fkl[now].id);
block_delete(fkl[now]);
}
fangzhihuanchong = max(fangzhihuanchong - 2, 0);
}
else if(!world[playerx + ddx][playery + ddy].fluid && now >= 5)
{
wajuetishi = 20;
if(gamemode == 1)
{
block_copy(playerx + ddx, playery + ddy, 19);
continue;
}
wjjd += (10 + wpl[now - 5].speed) * (1 + get_buff_level(buff[2]) * 0.25) * (sqrt(level * 2.5 + 1) * 0.2);
if(wjjd >= world[playerx + ddx][playery + ddy].hard)
{
wjjd = 0;
if(max(0, wpl[now - 5].level) >= world[playerx + ddx][playery + ddy].level)
{
block_pick(world[playerx + ddx][playery + ddy]);
}
block_copy(playerx + ddx, playery + ddy, 19);
xp++;
}
else
{
SetPos(0, 34);
cout << "正在挖掘: " << world[playerx + ddx][playery + ddy].name;
SetPos(0, 35);
cout << "进度: ";
cout << 1.0 * wjjd / world[playerx + ddx][playery + ddy].hard * 100;
cout << "%";
}
}
else if(!world[playerx + ddx][playery + ddy].fluid && now < 5)
{
if(gamemode == 1)
{
block_copy(playerx + ddx, playery + ddy, 19);
continue;
}
wjjd += (10) * (1 + get_buff_level(buff[2]) * 0.25) * (sqrt(level * 2.5 + 1) * 0.2);
if(wjjd >= world[playerx + ddx][playery + ddy].hard)
{
wjjd = 0;
if(max(0, wpl[now - 5].level) >= world[playerx + ddx][playery + ddy].level)
{
block_pick(world[playerx + ddx][playery + ddy]);
}
block_copy(playerx + ddx, playery + ddy, 19);
xp++;
}
else
{
SetPos(0, 34);
cout << "正在挖掘: " << world[playerx + ddx][playery + ddy].name;
SetPos(0, 35);
cout << "进度: ";
cout << 1.0 * wjjd / world[playerx + ddx][playery + ddy].hard * 100;
cout << "%";
}
fangzhihuanchong = 7;
}
}
else if(x == 'e')
{
system("cls");
other();
system("cls");
}
else if(x == 's')
{
print_data();
}
else if(x == 'q')
{
if(gamemode == 1) item_choose(); //创造物品选择器
else if(now >= 5) wpnum[now - 5]--;
else if(now < 5) fknum[now]--;
}
else if(x == 'z')
{
jianweitishi += 20;
}
else if(x == '/')
{
//命令
SetPos(0, 40);
cout << "/";
SetPos(0, 41);
cout << "输入命令";
SetPos(0, 43);
cout << "请勿随意换行 否则后果自负";
SetPos(1, 40);
string main_com;
cin >> main_com; //关键字
if(main_com == "gamemode")
{
int mode;
cin >> mode;
if(mode < 0 || mode > 2)
{
SetPos(0, 42);
cout << "错误:游戏模式错误";
}
else
{
gamemode = mode;
SetPos(0, 42);
cout << "游戏模式已更新:";
if(gamemode == 0) cout << "生存模式";
else if(gamemode == 1) cout << "创造模式";
else if(gamemode == 2) cout << "极限模式";
}
}
else if(main_com == "give")
{
string type;
cin >> type;
if(type == "block")
{
int id, num;
cin >> id >> num;
if(id < 0 || id > block_max)
{
SetPos(0, 42);
cout << "错误:方块ID越界";
}
else
{
fkl[now].id = id;
fkl[now].fluid = block[fkl[now].id].fluid;
fkl[now].hard = block[fkl[now].id].hard;
fkl[now].color = block[fkl[now].id].color;
fkl[now].level = block[fkl[now].id].level;
fkl[now].name = block[fkl[now].id].name;
fkl[now].txt = block[fkl[now].id].txt;
fknum[now] = num;
SetPos(0, 42);
cout << "已将方块栏第" << now << "处";
cout << "设为" << block[id].name;
}
}
else if(type == "item")
{
int id, num;
cin >> id >> num;
if(id < 0 || id > item_max)
{
SetPos(0, 42);
cout << "错误:物品ID越界";
}
else
{
wpl[now - 5].id = id;
wpl[now - 5].hurt = item[wpl[now - 5].id].hurt;
wpl[now - 5].level = item[wpl[now - 5].id].level;
wpl[now - 5].rare = item[wpl[now - 5].id].rare;
wpl[now - 5].speed = item[wpl[now - 5].id].speed;
wpl[now - 5].name = item[wpl[now - 5].id].name;
wpnum[now - 5] = num;
SetPos(0, 42);
cout << "已将物品栏第" << now - 5 << "处";
cout << "设为" << item[id].name;
}
}
else if(type == "effect")
{
int id, time, level;
cin >> id >> time >> level;
if(id < 0 || id > buff_max)
{
SetPos(0, 42);
cout << "错误:效果ID越界";
}
else
{
buff_give(buff[id], level, time);
buff_merge();
SetPos(0, 42);
cout << "已给予" << level << "级" << buff[id].name;
}
}
else
{
SetPos(0, 32);
cout << "错误:没有该类型";
}
}
else if(main_com == "delete")
{
string type;
cin >> type;
if(type == "block")
{
int id;
cin >> id;
if(id < 0 || id > block_max)
{
SetPos(0, 42);
cout << "错误:方块ID越界";
}
else
{
block_delete(block[id]);
SetPos(0, 42);
cout << "已删除 " << block[id].name;
}
}
else if(type == "item")
{
int id;
cin >> id;
if(id < 0 || id > item_max)
{
SetPos(0, 42);
cout << "错误:物品ID越界";
}
else
{
item_delete(item[id]);
SetPos(0, 42);
cout << "已删除 " << item[id].name;
}
}
else
{
SetPos(0, 42);
cout << "错误:没有该类型";
}
}
else if(main_com == "add_xp")
{
int ax;
cin >> ax;
if(ax < 0)
{
SetPos(0, 42);
cout << "错误:不能降低xp" << endl;
}
else
{
xp += ax;
}
}
else if(main_com == "bomb")
{
int lvl;
cin >> lvl;
if(lvl < 0)
{
SetPos(0, 42);
cout << "错误:爆炸等级不能为负数" << endl;
}
else if(lvl > 20)
{
SetPos(0, 42);
cout << "错误:爆炸等级不能高于20" << endl;
}
else
{
bomb(playerx, playery, lvl);
}
}
else if(main_com == "tp")
{
int x, y;
cin >> x >> y;
playerx = x;
playery = y;
block_copy(playerx, playery, 19);
}
else if(main_com == "kill")
{
attack(1e9, "玩家被一种奇怪的力量抹杀");
}
else if(main_com == "attack")
{
int num;
cin >> num;
attack(num, "玩家被一种奇怪的力量抹杀");
}
else if(main_com == "health")
{
int num;
cin >> num;
health += num;
}
else if(main_com == "set_health")
{
int new_health;
cin >> new_health;
health = new_health;
attack(0, "玩家被一种奇怪的力量抹杀");
}
else if(main_com == "set_oxygen")
{
int new_oxygen;
cin >> new_oxygen;
if(new_oxygen >= 20 || new_oxygen < 0)
{
SetPos(0, 42);
cout << "错误:氧气值不在正常范围内" << endl;
}
else
{
oxygen = new_oxygen;
}
}
else if(main_com == "summon")
{
int type;
cin >> type;
if(type < 0 || type > entity_max)
{
SetPos(0, 42);
cout << "错误:实体ID不存在" << endl;
}
else
{
summon_entity(playerx, playery, type);
}
}
else
{
SetPos(0, 42);
cout << "错误:未知命令";
}
SetPos(0, 43);
cout << " ";
SetPos(0, 43);
system("pause");
SetPos(0, 40);
cout << " ";
SetPos(0, 41);
cout << " ";
SetPos(0, 42);
cout << " ";
SetPos(0, 43);
cout << " ";
}
}
else wjjd = 0;
clocknum = clock();
}
}
void jiaocheng()
{
init_junior();
cout << "50%";
print_data();
cout << "100%";
minecraft();
}
void gaiziti(int size)
{
CONSOLE_FONT_INFOEX cfi;
cfi.cbSize = sizeof cfi;
cfi.nFont = 0;
cfi.dwFontSize.X = 0;
cfi.dwFontSize.Y = size;
cfi.FontFamily = FF_DONTCARE;
cfi.FontWeight = FW_NORMAL;
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
}
int main()
{
gaiziti(14);
//世界准备
system("mode con cols=160 lines=50");
srand(time(0));
HideCursor();
SetConsoleTitle("世界与我 0.8_v4");
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 << "5 设置" << endl;
cout << "版本: 测试版0.8_v4" << endl;
char n = input('1', '5');
if(n == '5')
{
cout << endl;
cout << "1~5 调整字体(普通为3级)" << endl;
cout << "6 开关黑白模式" << endl;
char x = input('1', '6');
switch(x - '0')
{
case 1:
gaiziti(11);
break;
case 2:
gaiziti(12);
break;
case 3:
gaiziti(14);
break;
case 4:
gaiziti(16);
break;
case 5:
gaiziti(17);
break;
case 6:
dark = !dark;
break;
}
goto cundang;
}
else if(n == '1') input_data();
else if(n == '2')
{
cout << "世界种子:(数字 输入0以随机选择)" << endl;
int zhongzi;
cin >> zhongzi;
if(zhongzi != 0) srand(zhongzi);
cout << "选择模式:" << endl;
cout << "1 生存:" << endl;
cout << " 挖掘 战斗 成为英雄!" << endl;
cout << "2 创造:" << endl;
cout << " 建造 规划 成为上帝!" << endl;
cout << "3 极限:" << endl;
cout << " 求生 变强 成为王者!" << endl;
char m = input('1', '3');
if(m == '1') gamemode = 0;
else if(m == '2') gamemode = 1;
else gamemode = 2;
system("cls");
SetPos(0, 0);
cout << "Map 地图生成中 0%" << endl;
init();
cout << "50%" << endl;
print_data();
cout << "100%" << endl;
system("cls");
srand(time(0));
}
else if(n == '3')
{
system("cls");
cout << "更新日志" << endl;
int page = 1, pagemax = 3;
while(1)
{
Color(0);
system("cls");
cout << "A 上一页 D 下一页 E退出" << endl;
cout << page << '/' << pagemax << "页" << endl;
if(page == 1)
{
Color(6), cout << "(1) 0.6pre1" << endl;
Color(6), cout << "(2) 0.6pre2" << endl;
Color(5), cout << "(3) 0.6" << endl;
Color(6), cout << "(4) 0.7pre1" << endl;
Color(6), cout << "(5) 0.7pre2" << endl;
Color(6), cout << "(6) 0.7pre3" << endl;
Color(6), cout << "(7) 0.7pre4" << endl;
Color(5), cout << "(8) 0.7" << endl;
Color(5), cout << "(9) 0.7a" << endl;
}
else if(page == 2)
{
Color(5), cout << "(1) 0.7b" << endl;
Color(5), cout << "(2) 0.7c" << endl;
Color(6), cout << "(3) 0.8pre1" << endl;
Color(6), cout << "(4) 0.8pre1.1" << endl;
Color(6), cout << "(5) 0.8pre1.2" << endl;
Color(6), cout << "(6) 0.8pre2" << endl;
Color(6), cout << "(7) 0.8pre2.1" << endl;
Color(5), cout << "(8) 0.8_v1" << endl;
Color(5), cout << "(9) 0.8_v2" << endl;
}
else if(page == 3)
{
Color(5), cout << "(1) 0.8_v2.1" << endl;
Color(5), cout << "(2) 0.8_v2.2" << endl;
Color(5), cout << "(3) 0.8_v2.3" << endl;
Color(5), cout << "(4) 0.8_v2.4" << endl;
Color(5), cout << "(5) 0.8_v2.5" << endl;
Color(5), cout << "(6) 0.8_v3" << endl;
Color(5), cout << "(7) 0.8_v3.1" << endl;
Color(5), cout << "(8) 0.8_v3.2" << endl;
Color(5), cout << "(9) 0.8_v4" << endl;
}
char n = input();
if(n == 'a')
{
if(page != 1) page--;
}
else if(n == 'd')
{
if(page != pagemax) page++;
}
else if(n >= '1' && n <= '9')
{
if(page == 1)
{
switch(n)
{
case '1':
Color(6), cout << "内部版0.6pre1" << endl, Color(0);
cout << "- 更新2种新的效果" << endl;
cout << "- 更新4种新的方块" << endl;
cout << "- 新增更新日志栏" << endl;
cout << "- 更新血量栏的颜色" << endl;
system("pause");
system("cls");
break;
case '2':
Color(6), cout << "内部版0.6pre2" << endl, Color(0);
cout << "- 更新1个新的配方栏" << endl;
cout << "- 使药水配方能够合成" << endl;
cout << "- 修改属性界面" << endl;
cout << "- 修改日志界面" << endl;
cout << "- 使桶能够收集流体" << endl;
cout << "- 修复一些漏洞" << endl;
system("pause");
system("cls");
break;
case '3':
Color(5), cout << "测试版0.6" << endl, Color(0);
cout << "- 更新2个新的命令" << endl;
cout << "- 新增命令系统" << endl;
cout << "- 修复一些漏洞" << endl;
system("pause");
system("cls");
break;
case '4':
Color(6), cout << "内部版0.7pre1" << endl, Color(0);
cout << "- 更新4个方块 5个物品" << endl;
cout << "- 增加结构 海之环" << endl;
cout << "- 扩大地图(与之前存档不兼容)" << endl;
system("pause");
system("cls");
break;
case '5':
Color(6), cout << "内部版0.7pre2" << endl, Color(0);
cout << "- 更新海洋合成专区" << endl;
cout << "- 新增Z键键位提示" << endl;
cout << "- 修复一些漏洞" << endl;
system("pause");
system("cls");
break;
case '6':
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");
system("cls");
break;
default:
break;
}
}
else if(page == 2)
{
switch(n)
{
case '1':
Color(5), cout << "测试版0.7b" << endl, Color(0);
cout << "- 修复了0.7pre1以来致命的错误(错误发现者 武意程先生)" << endl;
system("pause");
system("cls");
break;
case '2':
Color(5), cout << "测试版0.7c" << endl, Color(0);
cout << "- 增加了几种新的树" << endl;
system("pause");
system("cls");
break;
case '3':
Color(6), cout << "内部版0.8pre1" << endl, Color(0);
cout << "- 全新结构:于苗神殿登场!" << endl;
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;
cout << "- BUG 修改:修改了许多BUG !" << endl;
system("pause");
system("cls");
break;
case '6':
Color(6), cout << "内部版0.8pre2" << endl, Color(0);
cout << "- 修改代码结构" << endl;
system("pause");
system("cls");
break;
case '7':
Color(6), cout << "内部版0.8pre2.1" << endl, Color(0);
cout << "- 灵魂套前导预告:灵魂地牢" << endl;
cout << "- 灵魂地牢:大型地牢结构(好吧没多大),内部含有珍贵魂石" << endl;
system("pause");
system("cls");
break;
case '8':
Color(5), cout << "测试版0.8_v1" << endl, Color(0);
cout << "- 灵魂地牢更新:" << endl;
cout << "- 地牢扩大,增加死水池" << endl;
cout << "- 预计地牢在接下来几个版本里将会持续扩张" << endl;
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;
cout << "- 地牢再一次扩大 增加了几个目前没用的房间" << endl;
cout << "- 地牢石和魂石的硬度大幅提升 成为目前可以破坏的最坚硬的物质" << endl;
cout << "- 新增灵魂装备 目前灵魂装备是全游戏最强的装备" << endl;
cout << "- 修改了合成中的一些BUG" << endl;
cout << "- BETA测试专属功能:x=1200格下方必生成灵魂地牢" << endl;
cout << "- 修复了日志栏一直跳转不显示目录的BUG" << endl;
system("pause");
system("cls");
break;
default:
break;
}
}
else if(page == 3)
{
switch(n)
{
case '1':
Color(5), cout << "测试版0.8_v2.1" << endl, Color(0);
cout << "- 改了一下生成 现在不会卡崩了" << endl;
cout << "- 船新新手教程 基础操作手把手指引!" << endl;
system("pause");
system("cls");
break;
case '2':
Color(5), cout << "测试版0.8_v2.2" << endl, Color(0);
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;
system("pause");
system("cls");
case '4':
Color(5), cout << "测试版0.8_v2.4" << endl, Color(0);
cout << "- 现在可以在方块栏挖掘方块了" << endl;
cout << "- 修复了无法丢弃方块的BUG" << endl;
system("pause");
system("cls");
case '5':
Color(5), cout << "测试版0.8_v2.5" << endl, Color(0);
cout << "- 增加实体系统 但是仍然处于测试状态" << endl;
cout << "- 增加“守卫”BOSS 需要指令召唤(但是超强)" << endl;
cout << "- 一些我也说不清的小改动" << endl;
cout << "- 箱子的测试版 但是还没有GUI" << endl;
system("pause");
system("cls");
case '6':
Color(5), cout << "测试版0.8_v3" << endl, Color(0);
cout << "- BOSS系统调试完成 准备迎接强大的挑战吧!!!" << endl;
cout << "- 更新了新的TNT爆炸系统" << endl;
cout << "- 更新了新的Tick流逝系统" << endl;
cout << "- 修改了BOSS激光的机制" << endl;
cout << "- 增加了一些合成表" << endl;
cout << "- 修改了摔落和跳跃的机制" << endl;
cout << "- 【一次大规模更新,迎接新的世界吧!】" << endl;
system("pause");
system("cls");
case '7':
Color(5), cout << "测试版0.8_v3.1" << endl, Color(0);
cout << "- 修改了一下" << endl;
system("pause");
system("cls");
case '8':
Color(5), cout << "测试版0.8_v3.2" << endl, Color(0);
cout << "- 新增BOSS掉落物" << endl;
system("pause");
system("cls");
case '9':
Color(5), cout << "测试版0.8_v4" << endl, Color(0);
cout << "- 更新了【箱子】的存取GUI,使得游戏步入物品/方块无限制阶段!" << endl;
cout << "- 小小的修改了一些东西" << endl;
cout << "- 更新了黑白模式,适合……某些场景" << endl;
system("pause");
system("cls");
default:
break;
}
}
}
else if(n == 'e')
{
system("cls");
goto cundang;
}
}
}
else if(n == '4')
{
system("cls");
jiaocheng();
}
minecraft();
return 0;
}