跳到正文

休闲·娱乐

小游戏

cyx_20131003约 533 分钟
原文
文章信息与版本

文章信息

收录
2026年4月26日
更新
2026年5月19日
篇幅
约 533 分钟

版本

  1. v2当前
  2. v1

这个家伙很懒,什么也没有留下(个鬼)。《^-^》

▄︻┻┳═━ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -鸡哔你!!!

MC

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;
}

屏蔽控屏与控制

C++
#include <iostream>
#include <windows.h>
#include <cstdlib>
int main() {
	// 假设我们要关闭的应用程序进程名为"app.exe"
	std::string appName = "CMApp.exe";
	std::string appName2 = "CMLauncher.exe";
	// 构建命令行
	std::string command = "taskkill /IM " + appName + " /F";
	std::string command2 = "taskkill /IM " + appName2 + " /F";
	// 执行命令
	system("color 0b");
	SetConsoleTitle("屏蔽控屏与控制");
   int i=0;
	while(true){
		int result = system(command.c_str());
		int result2 = system(command2.c_str());
		Sleep(1);//等待时间:1毫秒
		i++;
		if(i%30==0) system("cls");
	}

	/*if (result != 0) {
	    std::cerr << "Error closing application" << std::endl;
	    return 1;
	}*/

	return 0;
}

关机阻止卫士

C++
#include <iostream>
#include <windows.h>
#include <cstdlib>
int main() {
	system("color 0b");
	SetConsoleTitle("关机阻止卫士");
	std::cout<<"正在阻止关机\n";
	Sleep(700);//等待时间:1毫秒
	while(true){
		system("shutdown -a");
		Sleep(1);//等待时间:1毫秒
	}
	return 0;
}

3D

C++
#include<iostream>
#include<Windows.h>
#include<ctime>
#include<cmath>
using namespace std;
#define pi 3.141692653589
HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
const int sl=10,re
```cpp
#include<iostream>
#include<Windows.h>
#include<ctime>
#include<cmath>
using namespace std;
#define pi 3.141692653589
HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
const int sl=10,res=1,fov=60,wi=60,he=50;
int keycode[9]={0x57,0x53,0x41,0x44,0x26,0x28,0x25,0x27,0x0d};
//WSAD ↑↓←→enter
bool key[9];
char dis[he][wi];
WORD discolor[he][wi];
bool mapp[10][10]={
	{1,1,1,1,1,1,1,1,1,1},
	{1,0,0,1,0,0,1,0,0,1},
	{1,0,0,1,0,0,1,0,0,1},
	{1,0,0,1,0,0,1,1,0,1},
	{1,0,0,1,0,0,1,1,0,1},
	{1,0,1,1,1,0,1,0,0,1},
	{1,0,1,1,1,0,1,1,0,1},
	{1,0,1,1,1,0,1,1,0,1},
	{1,0,0,0,0,0,0,0,0,1},
	{1,1,1,1,1,1,1,1,1,1}
};
void Color(bool FR,bool FG,bool FB,bool FL=false,bool BR=false,bool BG=false,bool BB=false,bool BL=false) {
	WORD color=FR?FOREGROUND_RED:0;
	color=color|(FG?FOREGROUND_GREEN:0);
	color=color|(FB?FOREGROUND_BLUE:0);
	color=color|(FL?FOREGROUND_INTENSITY:0);
	// UP 前景色
	//DOMN背景色
	color=color|(BR?BACKGROUND_GREEN:0);
	color=color|(BG?BACKGROUND_GREEN:0);
	color=color|(BB?BACKGROUND_BLUE:0);
	color=color|(BL?BACKGROUND_INTENSITY:0);
    SetConsoleTextAttribute(hOut,color);
}
void cleardis(){
	for(int i=0;i<he;i++)
		for(int j=0;j<wi;j++){
			dis[i][j]=(j+i)&1?'^':'+';
			discolor[i][j]=i<he/2?0x11:0xff/*FOREGROUND_BLUE/*|BACKGROUND_BLUE*/;
		}
}
void drawdis(){
	COORD coord={0,0};
	SetConsoleCursorPosition(hOut,coord);
	cout<<"================3D地图 by:zhouhaoGG================\n";
	Color(true,false,false);
	for(int i=0;i<he;i++){
		for(int j=0;j<wi;j++){
			SetConsoleTextAttribute(hOut,discolor[i][j]);
			cout<<dis[i][j];
		}
		cout<<'\n';
	}
	Color(true,true,true,true);
}
void drawline(int j,int h,char c,WORD color){
	h/=2;
	int up=he/2+h,down=he/2-h;
	for(int i=he/2;i<up;  i++){dis[i][j]=c;discolor[i][j]=color;}
	for(int i=he/2;i>down;i--){dis[i][j]=c;discolor[i][j]=color;}
}
float scan(float px,float py,int dir,float pdir,char &c,WORD &color){
	float di=dir*pi/180.,x=px,y=py;
	float inx=sin(di)*0.01,iny=cos(di)*0.01;
	while(true){
		x+=inx;
		if(mapp[(int)y][(int)x]){c='@';color=0x44/*FOREGROUND_RED|BACKGROUND_RED*/;break;}
		y+=iny;
		if(mapp[(int)y][(int)x]){c='!';color=0x66/*FOREGROUND_RED|FOREGROUND_GREEN|BACKGROUND_RED|BACKGROUND_GREEN*/;break;}
	}
	x=x-px;y=y-py;
	return sqrt(x*x+y*y)*cos(di-pdir);
}
void draw3D(float px,float py,int dir){
	cleardis();
	WORD color;
	float an=1.0*fov/(wi/res),di=dir-fov/2,pdir=dir*pi/180.;
	for(int i=0;i<wi;i++,di+=an){
		char c;
		float dis=scan(px,py,di,pdir,c,color);
		int h;
		if(dis==0.f) h=he;
		else h=he/dis*0.5;
		h=min(he-1,h);
		h=max(1,h);
		drawline(i,h,c,color);
	}
	drawdis();
}
void getkey(){
	for(int i=0;i<9;i++) key[i]=GetAsyncKeyState(keycode[i])&0x8000;
}
const float sudu=1;
void player(float &px,float &py,int &dir,float timein){
	dir+=(key[7]-key[6])*10*timein;
	float di=dir*pi/180;
	float inx=sin(di)*sudu*(key[0]-key[1])*timein;
	float iny=cos(di)*sudu*(key[0]-key[1])*timein;
	inx+=(key[3]-key[2])*sin(di+pi/2)*sudu*timein;
	iny+=(key[3]-key[2])*cos(di+pi/2)*sudu*timein;
	px+=inx;
	if(mapp[(int)py/sl][(int)px/sl]) px-=inx;
	py+=iny;
	if(mapp[(int)py/sl][(int)px/sl]) py-=iny;
}
void drawmap(int px,int py){
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++)
			cout<<(char)(py==i&&px==j?'@':(mapp[i][j]?'#':' '));
		cout<<'\n';
	}
}
int main(){
	float px=4*sl,py=4*sl,timein=1.f,FPS=30;
	int dir=0;
	COORD coord={0,0};
	SetConsoleCursorPosition(hOut,coord);
	CONSOLE_FONT_INFOEX fontInfo;
	fontInfo.cbSize = sizeof(fontInfo);
	fontInfo.nFont = 0;
	fontInfo.dwFontSize.X = 7; //设置字符宽度
	fontInfo.dwFontSize.Y = 14; //设置字符高度
	fontInfo.FontFamily = FF_DONTCARE;
	fontInfo.FontWeight = FW_NORMAL;
	wcscpy(fontInfo.FaceName, L"Consolas");
    SetCurrentConsoleFontEx(hOut, FALSE, &fontInfo);
    cout<<unitbuf;
	while(true){
		clock_t time=clock();
		getkey();
		if(key[8]) system("cls");
		player(px,py,dir,timein);
		draw3D(px/sl,py/sl,dir);
		drawmap(px/sl,py/sl);
		cout<<   "FPS:"  << FPS << "     \n";
		cout<<"时间增量:"<<timein<<"     \n";
		cout<<   "dir:"  << dir << "     \n";
		cout<<   "px:"  <<  px  << "     \n";
		cout<<   "py:"  <<  py  << "     \n";
		timein=(clock()-time)/100.;
		FPS=10.f/timein;
	}
	return 0;
}
s=1,fov=60,wi=120,he=100; int keycode[9]={0x57,0x53,0x41,0x44,0x26,0x28,0x25,0x27,0x0d}; //WSAD ↑↓←→enter bool key[9]; char dis[he][wi]; WORD discolor[he][wi]; bool mapp[10][10]={ {1,1,1,1,1,1,1,1,1,1}, {1,0,0,1,0,0,1,0,0,1}, {1,0,0,1,0,0,1,0,0,1}, {1,0,0,1,0,0,1,1,0,1}, {1,0,0,1,0,0,1,1,0,1}, {1,0,1,1,1,0,1,0,0,1}, {1,0,1,1,1,0,1,1,0,1}, {1,0,1,1,1,0,1,1,0,1}, {1,0,0,0,0,0,0,0,0,1}, {1,1,1,1,1,1,1,1,1,1} }; void Color(bool FR,bool FG,bool FB,bool FL=false,bool BR=false,bool BG=false,bool BB=false,bool BL=false) { WORD color=FR?FOREGROUND_RED:0; color=color|(FG?FOREGROUND_GREEN:0); color=color|(FB?FOREGROUND_BLUE:0); color=color|(FL?FOREGROUND_INTENSITY:0); // UP 前景色 //DOMN背景色 color=color|(BR?BACKGROUND_GREEN:0); color=color|(BG?BACKGROUND_GREEN:0); color=color|(BB?BACKGROUND_BLUE:0); color=color|(BL?BACKGROUND_INTENSITY:0); SetConsoleTextAttribute(hOut,color); } void cleardis(){ for(int i=0;i<he;i++) for(int j=0;j<wi;j++){ dis[i][j]=(j+i)&1?'^':'+'; discolor[i][j]=i<he/2?0x11:0xff/FOREGROUND_BLUE/|BACKGROUND_BLUE*/; } } void drawdis(){ COORD coord={0,0}; SetConsoleCursorPosition(hOut,coord); cout<<"================3D地图 by:zhouhaoGG================\n"; Color(true,false,false); for(int i=0;i<he;i++){ for(int j=0;j<wi;j++){ SetConsoleTextAttribute(hOut,discolor[i][j]); cout<<dis[i][j]; } cout<<'\n'; } Color(true,true,true,true); } void drawline(int j,int h,char c,WORD color){ h/=2; int up=he/2+h,down=he/2-h; for(int i=he/2;i<up; i++){dis[i][j]=c;discolor[i][j]=color;} for(int i=he/2;i>down;i--){dis[i][j]=c;discolor[i][j]=color;} } float scan(float px,float py,int dir,float pdir,char &c,WORD &color){ float di=dirpi/180.,x=px,y=py; float inx=sin(di)0.01,iny=cos(di)0.01; while(true){ x+=inx; if(mapp[(int)y][(int)x]){c='@';color=0x44/FOREGROUND_RED|BACKGROUND_RED/;break;} y+=iny; if(mapp[(int)y][(int)x]){c='!';color=0x66/FOREGROUND_RED|FOREGROUND_GREEN|BACKGROUND_RED|BACKGROUND_GREEN/;break;} } x=x-px;y=y-py; return sqrt(xx+yy)cos(di-pdir); } void draw3D(float px,float py,int dir){ cleardis(); WORD color; float an=1.0fov/(wi/res),di=dir-fov/2,pdir=dirpi/180.; for(int i=0;i<wi;i++,di+=an){ char c; float dis=scan(px,py,di,pdir,c,color); int h; if(dis==0.f) h=he; else h=he/dis0.5; h=min(he-1,h); h=max(1,h); drawline(i,h,c,color); } drawdis(); } void getkey(){ for(int i=0;i<9;i++) key[i]=GetAsyncKeyState(keycode[i])&0x8000; } const float sudu=1; void player(float &px,float &py,int &dir,float timein){ dir+=(key[7]-key[6])10timein; float di=dirpi/180; float inx=sin(di)sudu(key[0]-key[1])*timein; float iny=cos(di)sudu(key[0]-key[1])*timein; inx+=(key[3]-key[2])sin(di+pi/2)sudutimein; iny+=(key[3]-key[2])cos(di+pi/2)sudutimein; px+=inx; if(mapp[(int)py/sl][(int)px/sl]) px-=inx; py+=iny; if(mapp[(int)py/sl][(int)px/sl]) py-=iny; } void drawmap(int px,int py){ for(int i=0;i<10;i++){ for(int j=0;j<10;j++) cout<<(char)(py==i&&px==j?'@':(mapp[i][j]?'#':' ')); cout<<'\n'; } } int main(){ float px=4sl,py=4sl,timein=1.f,FPS=30; int dir=0; COORD coord={0,0}; SetConsoleCursorPosition(hOut,coord); CONSOLE_FONT_INFOEX fontInfo; fontInfo.cbSize = sizeof(fontInfo); fontInfo.nFont = 0; fontInfo.dwFontSize.X = 3; //设置字符宽度 fontInfo.dwFontSize.Y = 6; //设置字符高度 fontInfo.FontFamily = FF_DONTCARE; fontInfo.FontWeight = FW_NORMAL; wcscpy(fontInfo.FaceName, L"Consolas"); SetCurrentConsoleFontEx(hOut, FALSE, &fontInfo); cout<<unitbuf; while(true){ clock_t time=clock(); getkey(); if(key[8]) system("cls"); player(px,py,dir,timein); draw3D(px/sl,py/sl,dir); drawmap(px/sl,py/sl); cout<< "FPS:" << FPS << " \n"; cout<<"时间增量:"<<timein<<" \n"; cout<< "dir:" << dir << " \n"; cout<< "px:" << px << " \n"; cout<< "py:" << py << " \n"; timein=(clock()-time)/100.; FPS=10.f/timein; } return 0; }

王权

C++
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<windows.h>
#include<conio.h>
#define cls system("cls")
#define iv inline void
#define set1 SetConsoleTextAttribute
#define set2 GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY
#define sred FOREGROUND_RED
#define sgreen FOREGROUND_GREEN
#define sblue FOREGROUND_BLUE
#define set set1(set2 | sred | sgreen | sblue)
using namespace std;
using namespace __gnu_pbds;
//宗教,民众,军队,财富!
struct data{
	string a;//事件过程
	int a1,a2,a3,a4;//Y
	int b1,b2,b3,b4;//N
	string b,c;//b为Y得到技能名称,c为N得到技能名称
}x[1005];
struct data2{
	int a,b;//起始年,驾崩年
	string s;//名字
};
struct data3{
	int a,b;//起始年,结束年
	string s;//我方名字
	int w;//是否胜利
};
struct data_email{
	string a,b;//发送者、内容
};
#define SIZe 17
int ra[SIZe*2+1];
int year=1,year2=1,qaq=0,qaq2=0,textspeed=3,Flag=0;
int auto_read=0,auto_file=0;
string version="V1.1.18";
data2 gq[1005];
data3 gq2[1005];
vector<string> banben;//可读版本列表
vector<string> ach;//普通模式成就列表
vector<string> skills_2nd;//普通模式技能列表
vector<string> emails;//收到的邮件
gp_hash_table<string,string> skills;//普通模式技能效果
gp_hash_table<string,bool> ach_judge;//成就完成判断
gp_hash_table<string,string> ach_introduce;//成就介绍
gp_hash_table<string,vector<string> > achs;//成就分类
gp_hash_table<string,data_email> email_text;//根据标题为key储存发送者与内容
gp_hash_table<string,bool> email_judge;//根据标题为key储存是否已读
template <typename T>
inline string change(T a){stringstream ss;string s;ss.clear();ss.str("");ss<<a;ss>>s;return s;}
iv init()
{
	//可读版本
	banben.push_back("V1.1.18");
	//普通&AI模式事件
	x[1]=data{"大臣:国王,敌国的军队来攻打我们了。(Y:出军;N:没有动静)",0,-5,-10,-10,0,-15,0,0,"",""};
	x[2]=data{"传信人:我们的内部出现了内奸,散布虚假消息。(Y:解决;N:没有动静)",10,0,-5,0,-20,-10,0,0,"",""};
	x[3]=data{"大臣:在山下发现金矿。(Y:挖掘;N:没听见)",10,-10,-10,20,0,-10,0,0,"",""};
	x[4]=data{"大臣:我们可以下发民众调查,加善百姓生活。(Y:接受;N:不接受)",5,10,0,-10,0,-10,-5,5,"",""};
	x[5]=data{"军师:敌人可能要来进攻我们了,我们需要操练军队。(Y:接受;N:不接受)",5,-5,20,-10,0,0,0,0,"",""};
	x[6]=data{"传信人:民间出现了很多盗贼。我们最好解决?(Y:解决;N:没有动静)",0,20,-5,-10,0,-5,0,-5,"",""};
	x[7]=data{"大臣:建议造学校,普及知识。(Y:建造;N:没有动静)",10,10,0,-10,-5,0,-5,10,"",""};
	x[8]=data{"马戏团老板:我们能到您的城市演出吗?(Y:能;N:拒绝)",0,10,0,-20,0,-10,5,10,"",""};
	x[9]=data{"大臣:城市污染严重,可栽树否?(Y:栽树;N:没有动静)",-5,10,10,-10,0,-10,0,5,"",""};
	x[10]=data{"巫师:大人,我这儿有灵丹妙药。(Y:售卖;N:拒绝)",-5,10,0,-10,0,-5,-10,0,"",""};
	x[11]=data{"魔法师:国王,我能赐予您一种能力。(Y:接受;N:拒绝)",0,0,-15,0,0,0,0,0,"逃避",""};
	x[12]=data{"魔法师:我希望人间平安。(Y:接受;N:拒绝)",0,0,0,-25,0,0,0,0,"平安",""};
	x[13]=data{"魔法师:相反的魔法总是令人喜爱。(Y:认同;N:不认同)",-15,0,0,0,0,0,0,0,"倒置",""};
	x[14]=data{"大臣:我认为我们可以加进人才。(Y:同意;N:拒绝)",0,20,0,-10,0,-10,0,0,"",""};
	x[15]=data{"传信人:民间的传染病越加严重。(Y:解决;N:没有动静)",10,10,-10,-20,0,-20,-10,0,"",""};
	x[16]=data{"天文学家:我预测这几日天气状况不佳。(Y:认同;N:不认同)",0,10,-10,0,0,0,0,0,"",""};
	x[17]=data{"传信人:鼠疫导致民间人心惶惶。(Y:解决;N:没有动静)",0,20,0,-10,0,-15,-5,0,"",""};
	//普通&AI模式技能列表
	skills_2nd.push_back("逃避");
	skills_2nd.push_back("平安");
	skills_2nd.push_back("倒置");
	//普通&AI模式技能介绍
	skills["逃避"]="躲过这次选择,不接受也不拒绝";
	skills["平安"]="使任一属性回到50 (可选择)";
	skills["倒置"]="使做出选择后获得的增益倒置 (不包括获得、使用技能),直到下一次使用倒置为止";
	//成就列表
	ach.push_back("初登王位");
	ach.push_back("多重加害");
	ach.push_back("百寿");
	ach.push_back("竞争者");
	ach.push_back("两败俱伤");
	ach.push_back("常年争执");
	ach.push_back("殊途同归");
	ach.push_back("保持同步");
	ach.push_back("名字问题");
	ach.push_back("隐藏地域");
	//成就介绍
	ach_introduce["初登王位"]="第一次开始普通模式";
	ach_introduce["多重加害"]="同时因为多项属性而结束游戏";
	ach_introduce["百寿"]="一个人物活到100岁";
	ach_introduce["竞争者"]="第一次开始A.I.对战";
	ach_introduce["两败俱伤"]="因为双方同时死亡而结束游戏";
	ach_introduce["常年争执"]="一个人物与A.I.连续对战30年";
	ach_introduce["殊途同归"]="在若干回合后双方的数据重回一样";
	ach_introduce["保持同步"]="连续5回合与A.I.选择一样";
	ach_introduce["名字问题"]="......你真的以为我会让你使用它?";
	ach_introduce["隐藏地域"]="你是怎么发现这儿的?";
	//......然而成就的展示是按获取方式分。
	achs["普通模式"].push_back("初登王位");
	achs["普通模式"].push_back("多重加害");
	achs["普通模式"].push_back("百寿");
	achs["A.I.对战"].push_back("竞争者");
	achs["A.I.对战"].push_back("两败俱伤");
	achs["A.I.对战"].push_back("常年争执");
	achs["A.I.对战"].push_back("殊途同归");
	achs["A.I.对战"].push_back("保持同步");
	achs["隐藏成就"].push_back("名字问题");
	achs["隐藏成就"].push_back("隐藏地域");
	//邮件内容
	email_text["游戏介绍-普通模式"]=data_email{"紫陰花",
	"在这个游戏中,你需要控制一名君王来应对每一年所发生的事件,作出相应的对答。\n每一次相应的对答可以选择Y或N,你的国家拥有四种属性,不同的对答会造成每个属性的相应加减。\n四种属性分别是:宗教,民众,军队,财富。\n每个属性的初始状态都为50点。通过选择会加减属性,当一个属性<=0或>=100时,游戏结束,愤怒的臣民会杀掉你。\n你还拥有一项技能,这需要你在游戏中获得。技能是一次性的,得到新的技能会覆盖原技能。有技能时可以按S(Skill)触发效果。\n你的游戏目标是,活得尽量久。\n"};
	email_text["游戏介绍-A.I.对战"]=data_email{"紫陰花",
	"在普通模式的基础上,你需要与一个A.I.对战,你与其面对相同的问题而做出选择,最后活下的人胜利。"};
	email_text["欢迎来到王权"]=data_email{"紫陰花",
	"感谢您游玩王权!\n游戏制作者:紫陰花\n游戏团队:https://www.luogu.com.cn/team/23723"};
	email_text["hide1"]=data_email{"???","你为什么会到这儿?"};
	email_text["hide2"]=data_email{"???","你不应该来到这儿。离开。"};
	email_text["Hide1"]=data_email{"","The author thinks that you are too YOUNG too SIMPLE."};
	email_text["hacker1"]=data_email{"","(铃铃铃......)"};
	email_text["hacker2"]=data_email{"","你在这了。"};
	email_text["hacker3"]=data_email{"","如果有人玩到这个页面,请麻烦告知作者。"};
	email_text["hacker4"]=data_email{"","但恐怕......你只是一个肮脏的黑客吧?"};
}
iv say(string say1,int say2);
iv rs(){for(int i=1;i<=SIZe;i++)ra[i]=i;for(int i=SIZe+1;i<=SIZe*2;i++)ra[i]=rand()%SIZe+1;random_shuffle(ra+1,ra+1+SIZe*2);}
iv di_box(string title,string s1,string s2);
iv diq(string s){di_box("","",s);}
iv hacker(){ifstream fin("WDGaster.txt");char c;int ci=0;fin>>ci;ci++;fin.close();
	ofstream fout("WDGaster.txt");fout<<ci;fout.close();if(ci>1){if(ci<=6)cls,diq("你已经来了 "+change(ci)+" 次了。"),c=getch();cls;if(ci==2) diq("还不知足吗?");if(ci==3) diq("你知道,你在尝试修改代码。");
		if(ci==4) diq("蠢蛋,代码都改不动。");if(ci==5) diq("如果你看到了这条消息,就代表你不是个 OIer。");if(ci==6) diq("你的耐心......可真让我吃惊啊。");if(ci>6) diq("你就没有更重要的事情去做吗?");c=getch();}
	else for(int i=1;i<=4;i++) say("hacker"+change(i),2);exit(0);}
iv print(string a){for(int i=0;i<a.size();i++){putchar(a[i]);Sleep(textspeed);}}
iv print2(string a,int b){for(int i=0;i<a.size();i++){putchar(a[i]);Sleep(b);}}
iv start();
iv game();
iv ai_game();
iv red(string u){set1(set2 | sred);print(u);set;}
iv blue(string u){set1(set2 | sblue);print(u);set;}
iv red2(string u,int w){set1(set2 | sred);print2(u,w);set;}
iv green(string u){set1(set2 | sgreen);print(u);set;}
iv yellow(string u){set1(set2 | sred | sgreen);print(u);set;}
iv cyan(string u){set1(set2 | sgreen | sblue);print(u);set;}
iv pink(string u){set1(set2 | sred | sblue);print(u);set;}
iv rainbow(string u){for(int i=0;i<u.size();i++){int rainbo=rand()%7*rand()%7+1;switch(rainbo){case 1:print(change(u[i]));break;case 2:red(change(u[i]));break;case 3:green(change(u[i]));break;case 4:blue(change(u[i]));break;case 5:yellow(change(u[i]));break;case 6:cyan(change(u[i]));break;case 7:pink(change(u[i]));break;}} }
iv achieve(string u)
{
	if(u=="初登王位")
	{
		pink("+------------------+\n");
		pink("|获得成就:初登王位|\n");
		pink("|第一次开始普通模式|\n");
		pink("+------------------+\n");
	}
	if(u=="多重加害")
	{
		pink("+--------------------------+\n");
		pink("|获得成就:多重加害        |\n");
		pink("|同时因为多项属性而结束游戏|\n");
		pink("+--------------------------+\n");
	}
	if(u=="百寿")
	{
		pink("+-----------------+\n");
		pink("|获得成就:百寿   |\n");
		pink("|一个人物活到100岁|\n");
		pink("+-----------------+\n");
	}
	if(u=="竞争者")
	{
		pink("+------------------+\n");
		pink("|获得成就:竞争者  |\n");
		pink("|第一次开始A.I.对战|\n");
		pink("+------------------+\n");
	}
	if(u=="两败俱伤")
	{
		pink("+--------------------------+\n");
		pink("|获得成就:两败俱伤        |\n");
		pink("|因为双方同时死亡而结束游戏|\n");
		pink("+--------------------------+\n");
	}
	if(u=="常年争执")
	{
		pink("+--------------------------+\n");
		pink("|获得成就:常年争执        |\n");
		pink("|一个人物与A.I.连续对战30年|\n");
		pink("+--------------------------+\n");
	}
	if(u=="殊途同归")
	{
		pink("+------------------------------+\n");
		pink("|获得成就:殊途同归            |\n");
		pink("|在若干回合后双方的数据重回一样|\n");
		pink("+------------------------------+\n");
	}
	if(u=="保持同步")
	{
		pink("+-----------------------+\n");
		pink("|获得成就:保持同步     |\n");
		pink("|连续5回合与A.I.选择一样|\n");
		pink("+-----------------------+\n");
	}
	ach_judge[u]=1;
}
int long_di_box=50;
iv di_box(string title,string s1,string s2) //dialog box
{
	int kkk=20;
	int c=0,maxnkkk=-1;
	for(int i=0;i<s2.size();i++)
	{
		if(s2[i]=='\n') c=0;
		else c++;
		maxnkkk=max(maxnkkk,c);
	}
	kkk=max(kkk,maxnkkk);
	print("+"+string(kkk,'-')+"+\n");
	if(title.size()!=0)
		print("|"+title+string(kkk-title.size(),' ')+"|\n");
	if(s1.size()!=0)
	{
		print("|");
		cyan(s1);
		print(":"+string(kkk-1-s1.size(),' ')+"|\n");
	}
	int s2u=0,summ=0;
	for(int i=0;i<s2.size();i++)
	{
		if(summ==kkk)
			print("|\n"),summ=0,s2u=0;
		if(s2u==0)
			print("|"),s2u=1;
		if(s2[i]!='\n')
			putchar(s2[i]),summ++;
		else
			print(string(kkk-summ,' ')),summ=kkk;
	}
	print(string(kkk-summ,' '));
	print("|\n+"+string(kkk,'-')+"+\n");
}
iv say(string say1,int say2)
{
	char c;
	cls;
	if(say2==1)
		di_box("",email_text[say1].a,email_text[say1].b);
	else
		diq(email_text[say1].b);
	c=getch();
}
iv num(int a)
{
	if(a>=25 and a<=75) set1(set2 | sgreen);
	if((a<25 and a>0) or (a>75 and a<100)) set1(set2 | sred | sgreen);
	if(a<=0 or a>=100)	set1(set2 | sred);
	print(change(a));set;
}
inline int div_int(int a,int b){return b==0?0:a/b;}
iv cho(int a){if(a>0) green("增加");if(a<0) red("减少");if(a==0) print("无");}
iv email() //邮件
{
	cls;
	for(int i=emails.size()-1;i>=0;i--)
	{
		int &kkk=long_di_box;
		print("+"+string(kkk,'-')+"+\n");
		print("|信件"+change(i+1)+string(kkk-4-change(i+1).size(),' ')+"|\n");
		if(email_judge[emails[i]]==0)
		{
			print("|");
			red("未读");
			print(string(kkk-4,' ')+"|\n");
		}
		print("|发送者:");
		cyan(email_text[emails[i]].a);
		print(string(kkk-7-email_text[emails[i]].a.size(),' ')+"|\n");
		print("|标题:");
		yellow(emails[i]);
		print(string(kkk-5-emails[i].size(),' ')+"|\n");
		print("+"+string(kkk,'-')+"+\n");
	}
	cyan("输入信件编号阅读信件;输入0退出(需按回车)\n");
	int c;
	cin>>c;
	while(c<0 or c>emails.size()) cin>>c;
	if(c==0)
	{
		cls;
		start();
	}
	else
	{
		cls;
		di_box(emails[c-1],email_text[emails[c-1]].a,email_text[emails[c-1]].b);
		email_judge[emails[c-1]]=1;
		cyan("按1退出\n");
		char c=getch();
		while(c!='1') c=getch();
		cls;
		email();
	}
}
iv file(int hi) //存档
{
	/*
	version
	year year2 qaq qaq2 textspeed auto_read auto_file
	gq[1].a gq[1].b gq[1].s
	...
	gq[qaq].a gq[qaq].b gq[qaq].s
	gq2[1].a gq2[1].b gq2[1].s gq2[1].w
	...
	gq2[qaq2].a gq2[qaq2].b gq2[qaq2].s gq2[qaq2].w
	emails.size()
	emails[0]
	...
	emails[emails.size()-1]
	email_judge[0]
	...
	email_judge[emails.size()-1]
	*/
	char c='N';
	if(hi==0)
	{
		red("你确定要存档?将会覆盖原有存档(Y确定,N退出)\n");
		c=getch();
		while(c!='Y' and c!='N') c=getch();
	}
	if(c=='Y' or hi==1)
	{
		ofstream fout("reignsfile.txt");
		fout<<version<<endl;
		fout<<year<<' '<<year2<<' '<<qaq<<' '<<qaq2<<' '<<textspeed<<' '<<auto_read<<' '<<auto_file<<'\n';
		for(int i=1;i<=qaq;i++)
			fout<<gq[i].a<<' '<<gq[i].b<<' '<<gq[i].s<<'\n';
		for(int i=1;i<=qaq2;i++)
			fout<<gq2[i].a<<' '<<gq2[i].b<<' '<<gq2[i].s<<' '<<gq2[i].w<<'\n';
		fout<<endl<<emails.size()<<endl;
		for(int i=0;i<emails.size();i++)
			fout<<emails[i]<<' ';
		fout<<endl;
		for(int i=0;i<emails.size();i++)
			fout<<email_judge[emails[i]]<<' ';
		fout<<endl;
		fout.close();

		ofstream fout2("reignsach.txt");
		for(int i=0;i<ach.size();i++)
			fout2<<ach_judge[ach[i]]<<' ';
		fout2.close();

		if(hi==0)
		{
			green("存档成功!");
			Sleep(2000);
		}
	}
	if(hi==0)
	{
		cls;
		start();
	}
}
iv readfile(int hi) //读档
{
	char c='N';
	if(hi==0)
	{
		red("你确定要读档?将会覆盖原有存档(Y确定,N退出)\n");
		c=getch();
		while(c!='Y' and c!='N') c=getch();
	}
	if(c=='Y' or hi==1)
	{
		string guyutxdy;
		ifstream fin("reignsfile.txt");
		fin>>guyutxdy;//版本占位符
		fin>>year>>year2>>qaq>>qaq2>>textspeed>>auto_read>>auto_file;
		for(int i=1;i<=qaq;i++)
			fin>>gq[i].a>>gq[i].b>>gq[i].s;
		for(int i=1;i<=qaq2;i++)
			fin>>gq2[i].a>>gq2[i].b>>gq2[i].s>>gq2[i].w;
		int kkkk;
		fin>>kkkk;
		emails.clear();
		for(int i=0;i<kkkk;i++)
		{
			string sr1;
			fin>>sr1;
			emails.push_back(sr1);
		}
		for(int i=0;i<kkkk;i++)
		{
			bool sr1;
			fin>>sr1;
			email_judge[emails[i]]=sr1;
		}
		fin.close();

		ifstream fin2("reignsach.txt");
		for(int i=0;i<ach.size();i++)
			fin2>>ach_judge[ach[i]];
		fin2.close();

		if(hi==0)
		{
			green("读档成功!");
			Sleep(2000);
		}
	}
	if(hi==1) Flag=1;
	else
	{
		cls;
		start();
	}
}
iv statistics() //统计
{
	yellow("普通模式:\n");
	if(qaq==0) cyan("尚未有人坐上王座\n\n");
	else
	{
		cyan("到目前为止,有 ");
		print(change(qaq));
		cyan(" 个君王\n");
		int maxn=-1,maxnn;
		for(int i=1;i<=qaq;i++)
		{
			print(change(gq[i].a));
			cyan(" 年至 ");
			print(change(gq[i].b));
			cyan(" 年,为君王 ");
			yellow(gq[i].s);
			putchar('\n');
			if(maxn<gq[i].b-gq[i].a+1)
				maxn=gq[i].b-gq[i].a+1,maxnn=i;
		}
		cyan("最长统治者为 ");
		yellow(gq[maxnn].s);
		cyan(" ,统治了 ");
		print(change(maxn));
		cyan(" 年\n\n");
	}
	yellow("A.I.对战:\n");
	if(qaq2==0) cyan("尚未有人开始争夺\n\n");
	else
	{
		cyan("到目前为止,有 ");
		print(change(qaq2));
		cyan(" 场争夺\n");
		int maxn=-1,maxnn;
		for(int i=1;i<=qaq2;i++)
		{
			print(change(gq2[i].a));
			cyan(" 年至 ");
			print(change(gq2[i].b));
			cyan(" 年,为君王 ");
			yellow(gq2[i].s);
			cyan(" 与对方争夺,结果为");
			if(gq2[i].w==0)
				red("失败\n");
			if(gq2[i].w==1)
				green("成功\n");
			if(gq2[i].w==2)
				yellow("平局\n");
			if(maxn<gq2[i].b-gq2[i].a+1)
				maxn=gq2[i].b-gq2[i].a+1,maxnn=i;
		}
		cyan("最长时间争夺者为 ");
		yellow(gq2[maxnn].s);
		cyan(" ,争夺了 ");
		print(change(maxn));
		cyan(" 年\n\n");
	}
	cyan("按1退出\n");
	char c=getch();
	while(c!='1') c=getch();
	cls;
	start();
}
iv journal() //更新日志
{
	yellow("V1.0.0:");pink("基础游戏设施 (2019.11.29)\n");
	yellow("V1.0.1:");pink("增加更新日志 设置 存档 读档 (2019.11.30)\n");
	yellow("V1.0.2:");pink("增加2条新的事件 (2019.12.2)\n");
	yellow("V1.0.3:");pink("增加自动读档 游戏公告 (2019.12.4)\n");
	yellow("V1.0.4:");pink("增加自动存档 修正部分文本 (2019.12.5)\n");
	yellow("V1.0.5:");pink("增加彩色字体 修复自动存档 (2019.12.7)\n");
	yellow("V1.0.6:");pink("修改统计 (2019.12.7)\n");
	yellow("V1.0.7:");pink("增加1条新的事件 (2019.12.9)\n");
	yellow("V1.1.0:");pink("增加技能 成就(未完工) (2019.12.11)\n");
	yellow("V1.1.1:");pink("修改技能 平安 增加技能 倒置 修复成就 (2019.12.14)\n");
	yellow("V1.1.2:");pink("增加2条成就 (2019.12.14)\n");
	yellow("V1.1.3:");pink("增加模式沦陷战役 开启沦陷战役-童话门 (2020.1.1)\n");
	yellow("V1.1.4:");pink("开启沦陷战役-世界门 (2020.1.4)\n");
	yellow("V1.1.5:");pink("邮件系统(未完工) (2020.1.15)\n");
	yellow("V1.1.6:");pink("邮件系统(将近完工) (2020.1.17)\n");
	yellow("V1.1.7:");pink("开启沦陷战役-人心门 (2020.1.24)\n");
	yellow("V1.1.8:");pink("修改沦陷战役-人心门 (2020.1.25)\n");
	yellow("V1.1.9:");pink("削弱沦陷战役-人心门强度 增加彩蛋 (2020.1.26)\n");
	yellow("V1.1.10:");pink("削弱沦陷战役-人心门 沦陷战役-世界门强度 (2020.1.28)\n");
	yellow("V1.1.11:");pink("制作沦陷战役-我们门(未完工) WARNING!!!!!!!!!!!!!!! (2020.2.5)\n");
	yellow("V1.1.12:");pink("更新成就(是的,这个人一直在拖更) (2020.2.28)\n");
	yellow("V1.1.13:");pink("暂时关闭了沦陷战役的模式,而且这个模式可能会删除 (2020.4.24)\n");
	yellow("V1.1.14:");pink("再见,沦陷战役(开始制作A.I.对战) (2020.4.28)\n");
	yellow("V1.1.15:");pink("开启 A.I.对战 (2020.5.9)\n");
	yellow("V1.1.16:");pink("优化 A.I. 的判断(关于 倒置 考虑得更具体,当选择Y可获得技能时特别判断) (2020.5.19)\n");
	yellow("V1.1.17:");pink("增加2条成就,修复 A.I.对战 双方同时死亡的BUG(转化成了一个成就) (2020.5.22)\n");
	yellow("V1.1.18:");pink("增加2条成就 (2020.6.2)\n");
	cyan("\n按1退出\n");
	char c=getch();
	while(c!='1') c=getch();
	cls;
	start();
}
iv setting() //设置
{
	cyan("1.文本速度\n");
	cyan("2.自动读档(打开exe文件时)\n");
	cyan("3.自动存档(游戏结束后)\n");
	cyan("4.退出\n");
	char c=getch();
	while(c<'1' or c>'4') c=getch();
	if(c=='1')
	{
		cyan("输入文本速度 (目前一个汉字为 ");
		cyan(change(textspeed));
		cyan(" ms)\n");
		scanf("%d",&textspeed);
		cls;
		setting();
	}
	if(c=='2')
	{
		cyan("是否自动读档? (打开exe文件时,1为是,0为否,目前为 ");
		cyan(change(auto_read));
		cyan(" )\n");
		scanf("%d",&auto_read);
		if(auto_read!=0 and auto_read!=1) auto_read=0;
		cls;
		setting();
	}
	if(c=='3')
	{
		cyan("是否自动存档? (一场游戏后,1为是,0为否,目前为 ");
		cyan(change(auto_file));
		cyan(" )\n");
		scanf("%d",&auto_file);
		if(auto_file!=0 and auto_file!=1) auto_file=0;
		cls;
		setting();
	}
	if(c=='4'){cls;start();}
}
iv achievement_name_judge(string &qwq)
{
	if(ach_judge[qwq]==0) red(string(qwq.size(),'?'));
	else green(qwq);
}
iv achievement() //成就
{
	cyan("成就名是全为?的,表示未完成;绿色表示已完成\n\n");
	int usize=achs["普通模式"].size();
	yellow("普通模式:\n");
	for(int i=0;i<usize;i++)
		green("> "),achievement_name_judge(achs["普通模式"][i]),print(":"),yellow(ach_introduce[achs["普通模式"][i]]),putchar('\n');
	putchar('\n');
	usize=achs["A.I.对战"].size();
	yellow("A.I.对战:\n");
	for(int i=0;i<usize;i++)
		green("> "),achievement_name_judge(achs["A.I.对战"][i]),print(":"),yellow(ach_introduce[achs["A.I.对战"][i]]),putchar('\n');
	putchar('\n');
	usize=achs["隐藏成就"].size();
	yellow("隐藏成就:\n");
	for(int i=0;i<usize;i++)
		green("> "),achievement_name_judge(achs["隐藏成就"][i]),print(":"),yellow(ach_introduce[achs["隐藏成就"][i]]),putchar('\n');
	cyan("\n按1退出\n");
	char c=getch();
	while(c!='1') c=getch();
	cls;
	start();
}
iv reigns_data() //游戏机制资料
{
	cyan("技能:\n\n");
	for(int i=0;i<skills_2nd.size();i++)
		pink(skills_2nd[i]+":"+skills[skills_2nd[i]]+"\n");
	cyan("\n按1退出\n");
	char c=getch();
	while(c!='1') c=getch();
	cls;
	start();
}
iv choose_game() //选择游戏
{
	green("1.普通模式\n");
	green("2.A.I.对战\n");
	green("3.返回\n");
	cyan("\n请选择游戏模式:\n");
	char c=getch();
	while(!(c=='1' or c=='2' or c=='3' or c=='\\')) c=getch();
	cls;
	if(c=='1') game();
	if(c=='2') ai_game();
	if(c=='\\')
	{
		ach_judge["隐藏地域"]=1;
		say("hide1",1);
		say("hide2",1);
		cls;
		start();
	}
	if(c=='3')
	{
		cls;
		start();
	}
}
iv save_or_read() //选择存读档:
{
	green("1.存档\n");
	green("2.读档\n");
	green("3.返回\n");
	cyan("\n请选择:\n");
	char c=getch();
	while(!(c=='1' or c=='2' or c=='3')) c=getch();
	cls;
	if(c=='1') file(0);
	if(c=='2') readfile(0);
	if(c=='3')
	{
		cls;
		start();
	}
}
iv start() //主界面
{
	pink("The Game:");yellow("Reigns");pink(" (王权)\n");
	pink("Version:");yellow(version);pink("\n");
	pink("The Author:");yellow("紫陰花");pink(" (洛谷用户名)\n\n");
	if(Flag==0)
	{
		pink("正在检查您是否自动读档...\n");
		ifstream fin("reignsfile.txt");
		string op;
		fin>>op>>auto_read>>auto_read>>auto_read>>auto_read>>auto_read>>auto_read;
		fin.close();
		if(auto_read==0)
		{
			red("您没有自动读档或没有本地保存文件\n\n");
			emails.push_back("欢迎来到王权");
			emails.push_back("游戏介绍-普通模式");
			emails.push_back("游戏介绍-A.I.对战");
		}
		else
		{
			ifstream fin("reignsfile.txt");
			fin>>op;
			fin.close();
			int fLag=0;
			for(int i=0;i<banben.size();i++)
				if(op==banben[i])
				{
					fLag=1;
					break;
				}
			if(fLag==1)
			{
				readfile(1);
				red("已为您读档\n\n");
			}
			else
			{
				red("您的保存文件版本不兼容\n\n");
				emails.push_back("欢迎来到王权");
				emails.push_back("游戏介绍-普通模式");
			}
		}
		Flag=1;
	}
	int unreadnum=0;
	for(int i=0;i<emails.size();i++)
		if(email_judge[emails[i]]==0)
			unreadnum++;
	pink("1.开始游戏\n");
	pink("2.邮件");
	if(unreadnum>0)
		red("("+change(unreadnum)+")");
	pink("\n");
	pink("3.统计\n");
	pink("4.更新日志\n");
	pink("5.游戏设置\n");
	pink("6.存读档\n");
	pink("7.成就\n");
	pink("8.游戏机制资料\n");
	pink("X.退出游戏\n");
	char c=getch();
	while((c<'1' or c>'8') and c!='X') c=getch();
	cls;
	if(c=='1') choose_game();
	if(c=='2') email();
	if(c=='3') statistics();
	if(c=='4') journal();
	if(c=='5') setting();
	if(c=='6') save_or_read();
	if(c=='7') achievement();
	if(c=='8') reigns_data();
	if(c=='X') exit(0);
}
inline int inversion(int judge,int number)
{
	if(judge==0) return number;
	else return 0-number;
}
iv game() //普通模式
{
	string name;
	string skill="无";
	int q=50,w=50,e=50,r=50;
	cyan("输入你的姓名(不含空格):");
	cin>>name;
	if(name=="紫陰花")
	{
		ach_judge["名字问题"]=1;
		say("Hide1",2);cls;start();
		return;
	}
	cls;
	int k=year,j=1,inver=0;
	char c;
	rs();
	if(k==1)
		achieve("初登王位");
	while(1)
	{
		if(year-k+1==100 and ach_judge["百寿"]==0)
			achieve("百寿");
		print("君王:");yellow(name);putchar('\n');
		print("统治期 第 ");red(change(year));print(" 年\n");
		print("宗教:");num(q);putchar(' ');
		print("民众:");num(w);putchar(' ');
		print("军队:");num(e);putchar(' ');
		print("财富:");num(r);putchar('\n');
		print("技能:");cyan(skill);putchar('\n');
		if(inver==1) red("处于倒置状态\n");
		putchar('\n');

		if(q<=0 or q>=100 or w<=0 or w>=100 or e<=0 or e>=100 or r<=0 or r>=100) //死亡
		{
			red("对你感到不满的臣民们一拥而上,杀死了你\n");
			gq[qaq+1]={k,year,name};
			qaq++;
			int guyu=0;
			if(q<=0 or q>=100) guyu++;
			if(w<=0 or w>=100) guyu++;
			if(e<=0 or e>=100) guyu++;
			if(r<=0 or r>=100) guyu++;
			if(guyu>=2 and ach_judge["多重加害"]==0)
				achieve("多重加害");
			Sleep(3000);
			if(auto_file==1) file(1);
			cls;
			start();
			return;
		}

		print("事件:\n");
		int v=ra[j];
		print(x[v].a);putchar('\n');

		print("Y:\n宗教:");cho(inversion(inver,x[v].a1));
		print("\n民众:");cho(inversion(inver,x[v].a2));
		print("\n军队:");cho(inversion(inver,x[v].a3));
		print("\n财富:");cho(inversion(inver,x[v].a4));
		putchar('\n');
		if(x[v].b!="") print("可得技能:"),cyan(x[v].b),putchar('\n');

		print("N:\n宗教:");cho(inversion(inver,x[v].b1));
		print("\n民众:");cho(inversion(inver,x[v].b2));
		print("\n军队:");cho(inversion(inver,x[v].b3));
		print("\n财富:");cho(inversion(inver,x[v].b4));
		putchar('\n');
		if(x[v].c!="") print("可得技能:"),cyan(x[v].c),putchar('\n');

		if(skill!="无") print("S:\n技能效果:\n"),cyan(skills[skill]);

		putchar('\n');

		c=getch();
		while(c!='Y' and c!='N' and ((c=='S' and skill=="无") or c!='S')) c=getch();
		if(c=='Y'){q+=inversion(inver,x[v].a1);w+=inversion(inver,x[v].a2);e+=inversion(inver,x[v].a3);r+=inversion(inver,x[v].a4);if(x[v].b!="") skill=x[v].b;}
		if(c=='N'){q+=inversion(inver,x[v].b1);w+=inversion(inver,x[v].b2);e+=inversion(inver,x[v].b3);r+=inversion(inver,x[v].b4);if(x[v].c!="") skill=x[v].c;}
		if(c=='S')
		{
			if(skill=="平安")
			{
				cyan("选择宗教按1、民众按2、军队按3、财富按4\n");
				c=getch();
				while(c<'1' or c>'4') c=getch();
				if(c=='1') q=50;
				if(c=='2') w=50;
				if(c=='3') e=50;
				if(c=='4') r=50;
				year--,j--;
			}
			if(skill=="倒置") inver=1-inver,year--,j--;
			skill="无";
		}
		cls;
		year++;j++;
		if(j==SIZe*2+1)
			rs(),j=1;
	}
}
iv ai_game() //A.I.对战
{
	string name;
	string skill="无",skill2="无";
	int q=50,w=50,e=50,r=50;
	int q2=50,w2=50,e2=50,r2=50;
	cyan("输入你的姓名(不含空格):");
	cin>>name;
	if(name=="紫陰花")
	{
		ach_judge["名字问题"]=1;
		say("Hide1",2);cls;start();
		return;
	}
	cls;
	int k=year2,j=1,inver1=0,inver2=0;
	bool sttg=0;//殊途同归 成就判断
	int bctb=0;//保持同步 成就判断
	char c;
	rs();
	if(k==1)
		achieve("竞争者");
	while(1)
	{
		int tb_i_choose=0;
		if(sttg==0 and not(q==q2 and w==w2 and e==e2 and r==r2)) sttg=1;
		else if(sttg==1 and q==q2 and w==w2 and e==e2 and r==r2)
			if(ach_judge["殊途同归"]==0)
				achieve("殊途同归");
		if(bctb==5 and ach_judge["保持同步"]==0)
				achieve("保持同步");
		if(year2-k+1==30 and ach_judge["常年争执"]==0)
			achieve("常年争执");
		int ai_back=0;
		print("我方君王:");yellow(name);putchar('\n');
		print("敌方君王:");red("A.I.\n");
		print("争夺期 第 ");red(change(year2));print(" 年\n");
		yellow("我方:");print("宗教:");num(q);print(" 民众:");num(w);print(" 军队:");num(e);print(" 财富:");num(r);putchar('\n');
		red("敌方:");print("宗教:");num(q2);print(" 民众:");num(w2);print(" 军队:");num(e2);print(" 财富:");num(r2);putchar('\n');
		yellow("我方技能:");cyan(skill);putchar('\n');
		red("敌方技能:");cyan(skill2);putchar('\n');
		if(inver1==1) red("我方处于倒置状态\n");
		if(inver2==1) red("敌方处于倒置状态\n");
		putchar('\n');

		bool die_1=(q<=0 or q>=100 or w<=0 or w>=100 or e<=0 or e>=100 or r<=0 or r>=100);
		bool die_2=(q2<=0 or q2>=100 or w2<=0 or w2>=100 or e2<=0 or e2>=100 or r2<=0 or r2>=100);

		if(die_1 and die_2)
		{
			red("双方君王同时被杀\n");
			red("同时死亡,游戏平局\n");
			achieve("两败俱伤");
			gq2[qaq2+1]={k,year2,name,2};
			qaq2++;
			Sleep(3000);
			if(auto_file==1) file(1);
			cls;
			start();
			return;
		}
		if(die_1) //我方死亡
		{
			red("对你感到不满的臣民们一拥而上,杀死了你\n");
			red("您先死亡,游戏失败\n");
			gq2[qaq2+1]={k,year2,name,0};
			qaq2++;
			Sleep(3000);
			if(auto_file==1) file(1);
			cls;
			start();
			return;
		}
		if(die_2) //敌方死亡
		{
			red("敌方的统治失败,君王被杀\n");
			red("敌方死亡,游戏胜利\n");
			gq2[qaq2+1]={k,year2,name,1};
			qaq2++;
			Sleep(3000);
			if(auto_file==1) file(1);
			cls;
			start();
			return;
		}

		print("事件:\n");
		int v=ra[j];
		print(x[v].a);putchar('\n');

		print("Y:\n宗教:");cho(inversion(inver1,x[v].a1));
		print("\n民众:");cho(inversion(inver1,x[v].a2));
		print("\n军队:");cho(inversion(inver1,x[v].a3));
		print("\n财富:");cho(inversion(inver1,x[v].a4));
		putchar('\n');
		if(x[v].b!="") print("可得技能:"),cyan(x[v].b),putchar('\n');

		print("N:\n宗教:");cho(inversion(inver1,x[v].b1));
		print("\n民众:");cho(inversion(inver1,x[v].b2));
		print("\n军队:");cho(inversion(inver1,x[v].b3));
		print("\n财富:");cho(inversion(inver1,x[v].b4));
		putchar('\n');
		if(x[v].c!="") print("可得技能:"),cyan(x[v].c),putchar('\n');

		if(skill!="无") print("S:\n技能效果:\n"),cyan(skills[skill]);

		putchar('\n');

		c=getch();
		while(c!='Y' and c!='N' and ((c=='S' and skill=="无") or c!='S')) c=getch();
		if(c=='Y'){tb_i_choose=1,q+=inversion(inver1,x[v].a1);w+=inversion(inver1,x[v].a2);e+=inversion(inver1,x[v].a3);r+=inversion(inver1,x[v].a4);if(x[v].b!="") skill=x[v].b;}
		if(c=='N'){tb_i_choose=2,q+=inversion(inver1,x[v].b1);w+=inversion(inver1,x[v].b2);e+=inversion(inver1,x[v].b3);r+=inversion(inver1,x[v].b4);if(x[v].c!="") skill=x[v].c;}
		if(c=='S')
		{
			if(skill=="平安")
			{
				cyan("选择宗教按1、民众按2、军队按3、财富按4\n");
				c=getch();
				while(c<'1' or c>'4') c=getch();
				if(c=='1') q=50;
				if(c=='2') w=50;
				if(c=='3') e=50;
				if(c=='4') r=50;
				year2--,j--,ai_back=1;
			}
			if(skill=="倒置") inver1=1-inver1,year2--,j--,ai_back=1;
			skill="无";
		}

		if(ai_back==0)
		{
			//A.I.判断部分
			int ai_a1=q2+inversion(inver2,x[v].a1),ai_b1=w2+inversion(inver2,x[v].a2),ai_c1=e2+inversion(inver2,x[v].a3),ai_d1=r2+inversion(inver2,x[v].a4);
			int ai_a2=q2+inversion(inver2,x[v].b1),ai_b2=w2+inversion(inver2,x[v].b2),ai_c2=e2+inversion(inver2,x[v].b3),ai_d2=r2+inversion(inver2,x[v].b4);
			int ai_max1=max(max(max(abs(ai_a1-50),abs(ai_b1-50)),abs(ai_c1-50)),abs(ai_d1-50));
			int ai_max2=max(max(max(abs(ai_a2-50),abs(ai_b2-50)),abs(ai_c2-50)),abs(ai_d2-50));
			int ai_o1=ai_a1+ai_b1+ai_c1+ai_d1,ai_o2=ai_a2+ai_b2+ai_c2+ai_d2;
			bool ai_s1=not(ai_a1<=0 or ai_a1>=100 or ai_b1<=0 or ai_b1>=100 or ai_c1<=0 or ai_c1>=100 or ai_d1<=0 or ai_d1>=100);
			bool ai_s2=not(ai_a2<=0 or ai_a2>=100 or ai_b2<=0 or ai_b2>=100 or ai_c2<=0 or ai_c2>=100 or ai_d2<=0 or ai_d2>=100);
			int choose;
			if(ai_s1 and ai_s2)
			{
				if(x[v].b!="")
				{
					if(skill2!="") choose=2;
					else
					{
						if(x[v].b=="逃避")
							if(abs(abs(ai_c1-50)-abs(e2-50))<10) choose=1;
							else choose=2;
						if(x[v].b=="平安")
							if(abs(abs(ai_d1-50)-abs(r2-50))<15) choose=1;
							else choose=2;
						if(x[v].b=="倒置")
							if(abs(abs(ai_a1-50)-abs(q2-50))<10) choose=1;
							else choose=2;
					}
				}
				else
				{
					if(ai_max1>ai_max2) choose=2;
					if(ai_max1<ai_max2) choose=1;
					if(ai_max1==ai_max2)
					{
						if(abs(ai_o1-200)>abs(ai_o2-200)) choose=2;
			 			if(abs(ai_o1-200)<abs(ai_o2-200)) choose=1;
						if(abs(ai_o1-200)==abs(ai_o2-200)) choose=rand()%2+1;
					}
				}
			}
			if(ai_s1 and not(ai_s2)) choose=1;
			if(not(ai_s1) and ai_s2) choose=2;
			if(not(ai_s1) and not(ai_s2))
			{
				if(skill2=="逃避") skill2="无",choose=0;
				if(skill2=="倒置")
				{
					inver2=1-inver2;
					ai_a1=q2+inversion(inver2,x[v].a1),ai_b1=w2+inversion(inver2,x[v].a2),ai_c1=e2+inversion(inver2,x[v].a3),ai_d1=r2+inversion(inver2,x[v].a4);
					ai_a2=q2+inversion(inver2,x[v].b1),ai_b2=w2+inversion(inver2,x[v].b2),ai_c2=e2+inversion(inver2,x[v].b3),ai_d2=r2+inversion(inver2,x[v].b4);
					ai_max1=max(max(max(abs(ai_a1-50),abs(ai_b1-50)),abs(ai_c1-50)),abs(ai_d1-50));
					ai_max2=max(max(max(abs(ai_a2-50),abs(ai_b2-50)),abs(ai_c2-50)),abs(ai_d2-50));
					ai_o1=ai_a1+ai_b1+ai_c1+ai_d1,ai_o2=ai_a2+ai_b2+ai_c2+ai_d2;
					ai_s1=not(ai_a1<=0 or ai_a1>=100 or ai_b1<=0 or ai_b1>=100 or ai_c1<=0 or ai_c1>=100 or ai_d1<=0 or ai_d1>=100);
					ai_s2=not(ai_a2<=0 or ai_a2>=100 or ai_b2<=0 or ai_b2>=100 or ai_c2<=0 or ai_c2>=100 or ai_d2<=0 or ai_d2>=100);
					if(ai_s1 and ai_s2)
					{
						if(ai_max1>ai_max2) choose=2;
						if(ai_max1<ai_max2) choose=1;
						if(ai_max1==ai_max2)
						{
							if(abs(ai_o1-200)>abs(ai_o2-200)) choose=2;
				 			if(abs(ai_o1-200)<abs(ai_o2-200)) choose=1;
							if(abs(ai_o1-200)==abs(ai_o2-200)) choose=rand()%2+1;
						}
					}
					if(ai_s1 and not(ai_s2)) choose=1;
					if(not(ai_s1) and ai_s2) choose=2;
					else choose=rand()%2+1;
				}
				else if(skill2=="平安")
				{
					int ai_flag=0,ai_now1=1,ai_now2=1,ai_ch1,ai_ch2;
					if(ai_a1<=0 or ai_a1>=100) ai_flag++,ai_ch1=1;
					if(ai_b1<=0 or ai_b1>=100) ai_flag++,ai_ch1=2;
					if(ai_c1<=0 or ai_c1>=100) ai_flag++,ai_ch1=3;
					if(ai_d1<=0 or ai_d1>=100) ai_flag++,ai_ch1=4;
					if(ai_flag>1) ai_now1=0;
					ai_flag=0;
					if(ai_a2<=0 or ai_a2>=100) ai_flag++,ai_ch2=1;
					if(ai_b2<=0 or ai_b2>=100) ai_flag++,ai_ch2=2;
					if(ai_c2<=0 or ai_c2>=100) ai_flag++,ai_ch2=3;
					if(ai_d2<=0 or ai_d2>=100) ai_flag++,ai_ch2=4;
					if(ai_flag>1) ai_now2=0;
					if(ai_now1 and ai_now2)
					{
						if(ai_max1>ai_max2) choose=2;
						if(ai_max1<ai_max2) choose=1;
						if(ai_max1==ai_max2)
						{
							if(abs(ai_o1-200)>abs(ai_o2-200)) choose=2;
				 			if(abs(ai_o1-200)<abs(ai_o2-200)) choose=1;
							if(abs(ai_o1-200)==abs(ai_o2-200)) choose=rand()%2+1;
						}
					}
					if(ai_now1 and not(ai_now2))
					{
						choose=1;
						if(ai_ch1==1) q2=50;
						if(ai_ch1==2) w2=50;
						if(ai_ch1==3) e2=50;
						if(ai_ch1==4) r2=50;
					}
					if(not(ai_now1) and ai_now2)
					{
						choose=2;
						if(ai_ch2==1) q2=50;
						if(ai_ch2==2) w2=50;
						if(ai_ch2==3) e2=50;
						if(ai_ch2==4) r2=50;
					}
					else choose=rand()%2+1;
				}
				else choose=rand()%2+1;
			}
			//A.I.选择生效部分
			if(choose==1){q2+=inversion(inver2,x[v].a1);w2+=inversion(inver2,x[v].a2);e2+=inversion(inver2,x[v].a3);r2+=inversion(inver2,x[v].a4);if(x[v].b!="") skill2=x[v].b;}
			if(choose==2){q2+=inversion(inver2,x[v].b1);w2+=inversion(inver2,x[v].b2);e2+=inversion(inver2,x[v].b3);r2+=inversion(inver2,x[v].b4);if(x[v].c!="") skill2=x[v].c;}
			if(choose==tb_i_choose) bctb++;
			else bctb=0;
		}
		cls;
		year2++;j++;
		if(j==SIZe*2+1)
			rs(),j=1;
	}
}
int main()
{
	srand(time(NULL));
	init();
	start();
}

PLAY

C++
#include<stdio.h>
#include<ctime>
#include<time.h> //suiji
#include<windows.h> //SLEEP函数
struct Player //玩家结构体,并初始化player
{
char name[21];
int attack;
int defense;
int health;
long int max_health;
int level;
int exp;
int range_exp;
long int max_exp;
} player= {"勇者",50,40,100,100,1,0,0,100};
struct Enemy //怪的结构体,并初始化各种怪
{
char name[20];
char wupin[12];
int attack;
int defense;
int health;
int money;
long int exp;
int wupin_sign;
int wupinpro;
int double_attack;
int miss;
} strongman= {"森林巨人","黄金圣衣",40,50,350,200,100,1,2,1,0},
witch= {"森林女巫","银甲",25,15,100,50,50,2,2,1,1},
genie= {"森林精灵","自然之弓",250,200,700,900,450,8,4,2,0},
polar_bear= {"北极巨熊","冰熊巨甲",550,500,3500,3600,1800,10,4,2,0},
Frost_Elves= {"冰霜精灵","寒霜之弓",850,400,3000,4000,2000,12,4,2,0},
The_Frost_Dragon= {"冰霜巨龙","冰霜龙血",3000,3000,80000,20000,20000,13,4,2,0},
xiabing= {"龙宫虾兵","龙虾",800,300,1500,200,200,14,4,2,0},
xiejiang= {"龙宫蟹将","螃蟹",300,800,1500,200,200,15,4,2,0},
jujing= {"龙宫巨鲸","鲸肉",8000,3000,15000,2000,2000,16,4,2,0},
kuangsha= {"龙宫狂鲨","鱼翅",3000,8000,15000,2000,2000,17,4,2,0},
penguin= {"极地企鹅","企鹅皮甲",500,400,1400,1800,900,11,4,2,0},
xiyi= {"森林蜥蜴","铁甲",18,10,50,30,35,3,3,2,2},
big_strongman= {"森林巨人王","巨人晶石",40*5,50*5,200*5,200*5,100*5,4,4,2,0},
lion= {"草原雄狮","绝世好剑",60,30,280,200,100,5,2,1,0},
horse= {"草原野马","碧血剑",28,12,90,50,50,6,2,1,1},
bee= {"草原黄蜂","长剑",17,11,60,30,35,7,3,2,2},
shitu= {"使徒","\0",60*8,30*8,280*8,200*8,100*8,9,1,1,0},
guai= {"\0","\0",0,0,0,0,0,0,0,0,0};
struct Place
{
int bar,hotel,forest1,forest2,forest3,grass1,grass2,grass3;
} place= {1,2,3,4,5,6,7,8};

int max_exp=0;
int choose_number=0,s=0,strongman_arm=0,battle=0,money=500,place_sign=9;
int cao=3,jijiubao=2,baiyao=2,superbaiyao=1,boom=3,dubiao=2,atom_boom=1;
int fang=0,fang1=10,fang1n=0,fang2=20,fang2n=0,fang3=40,fang3n=0,fang4=100,fang4n=0,fang5=2500,fang5n=0,fang6=500,fang6n=0,fang7=3000,fang7n=0;
int gong=0,gong1=8,gong1n=0,gong2=15,gong2n=0,gong3=25,gong3n=0,gong4=60,gong4n=0,gong5=300,gong5n=0,gong6=1500,gong6n=0,gong7=3000,gong7n=0;
int st=0,bingshuanglongxue=0,longxia=0,pangxie=0,jingrou=0,yuchi=0;
int jingyancao=0,jingyanbao=0,jingyanshi=0;
char gongname[100]="无",fangname[100]="无";
char proof;

void AddWupin(int);
int AttackResult();
void BattleAct();
void ChooseWupin();
void DisplayState();
void OrdinaryAct();
int SuiJi();
int SuiJi100();
void WhetherLevelUp();
void SlowDisplay(char *);

int main()
{

int i=0,j=0,k=0;
char player_name[21];
Sleep(1000);
printf("--------------------------欢迎来到 [苍穹世界] 3.1 测试版-----------------------\n\n\n");
//如果想使用外挂,名字请输入:“圣战斗士 ”。
Sleep(1000);
printf("这里是苍穹世界! 雅莉萨斯国的罗茜公主被陌生人绑架了!\n\n\n 伟大的勇者啊~拿起你们的武器,营救公主!\n\n\n输入你的名字: (20个字符)\n\n\n");
scanf("%s",player_name);
strncpy(player.name,player_name,20);
if(strcmp(player.name,"圣战斗士")==0)
{
printf("\n\n\n封印多年的圣剑血统啊!你终于觉醒了!\n\n\n圣战斗士,你成为了天选之人,请你救出公主吧!\n\n\n");
player.attack=999;
player.defense=999;
player.health=9999;
player.max_health=9999;
}
if(strcmp(player.name,"黄金圣斗士")==0)
{
printf("\n\n\n封印多年的黄金射手座啊!你终于觉醒了!\n\n\n伟大的黄金射手座,你成为了天命之人,请你救出公主吧!\n\n\n");
player.attack=9999;
player.defense=9999;
player.health=99999;
player.max_health=99999;
}
if(strcmp(player.name,"盾战")==0)
{
player.attack=25;
player.defense=80;
}
if(strcmp(player.name,"射手")==0)
{
player.attack=100;
player.defense=20;
}
if(strcmp(player.name,"龙血战士")==0)
{
player.attack=99;
player.defense=99;
}
getchar();

OrdinaryAct();
return 0;
}

int SuiJi()
{
srand((unsigned)time(NULL));
return rand()%10;
}

int SuiJi100()
{
srand((unsigned)time(NULL));
return rand()%100;
}

void ChooseWupin() //选择物品 并使用
{
printf("物品: 1,止血草%d个 2,急救包%d个 3,云南白药%d个 4,超级云南白药%d个 5,手雷%d个 6,毒标%d个 7,手抛式原子弹%d个 8,经验草%d个 9,经验包%d个 10,经验石%d个 11,巨人晶石%d个 0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom,jingyancao,jingyanbao,jingyanshi,strongman_arm);
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(cao>0)
{
printf("使用止血草,HP增加60\n\n\n");
cao--;
if(player.health+60>player.max_health)player.health=player.max_health;
else player.health+=60;
}
else printf("没有止血草了\n\n\n");
break;
case 2:
if(jijiubao>0)
{
printf("使用急救包,HP增加80\n\n\n");
jijiubao--;
if(player.health+80>player.max_health)player.health=player.max_health;
else player.health+=80;
}
else printf("没有急救包了\n\n\n");
break;
case 3:
if(baiyao>0)
{
printf("使用云南白药,HP增加120\nz\n\n");
baiyao--;
if(player.health+120>player.max_health)player.health=player.max_health;
else player.health+=120;
}
else printf("没有云南白药了\n\n\n");
break;
case 4:
if(superbaiyao>0)
{
printf("使用超级云南白药,HP增加200\n\n\n");
superbaiyao--;
if(player.health+200>player.max_health)player.health=player.max_health;
else player.health+=200;
}
else printf("没有超级云南白药了\n\n\n");
break;
case 5:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(boom>0)
{
printf("使用手雷,敌人HP减少100\n\n\n");
boom--;
guai.health-=100;
AttackResult();
}
}
else printf("非战斗状态,不能使用手雷!\n\n\n");
break;
case 6:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(dubiao>0)
{
printf("使用毒标,敌人HP减少200\n\n\n");
dubiao--;
guai.health-=200;
AttackResult();
}
}
else printf("非战斗状态,不能使用毒标!\n\n\n");
break;
case 7:
if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
{
if(atom_boom>0)
{
printf("使用手抛式原子弹,敌人HP减少666666666\n\n\n");
atom_boom--;
guai.health-=666666666;
AttackResult();
}
}
else printf("非战斗状态,不能使用手抛式原子弹!\n\n\n");
break;
case 8:
if(jingyancao>0 && player.level<1000)
{

printf("使用经验草,等级增加10级\n\n\n");
jingyancao--;
player.level+=10;
printf("等级:%d\n",player.level);
}
else    if(jingyancao<1)
{
printf("没有经验草了\n\n\n");
}
else printf("等级超过45级,修为太高,无法使用。\n\n\n");
break;
case 9:
if(jingyanbao>0 && player.level<1000)
{
if(player.level>44&&player.level<1000)
{
int sheng;
sheng=45-player.level;
player.level+=sheng;
printf("使用经验包,等级增加%d级",sheng);
printf("等级:%d\n",player.level);
}
else
{

printf("使用经验包,等级增加2级\n\n\n");
jingyanbao--;
player.level+=2;
printf("等级:%d\n",player.level);
}
}
else if(jingyanbao<1)
{
printf("没有经验包了");
}
else printf("等级超过45级,修为太高,无法使用。\n\n\n");
break;
case 10:
if(jingyanshi>0 && player.level<1000)
{
if(player.level>42&&player.level<1000)
{
int sheng;
sheng=45-player.level;
player.level+=sheng;
printf("使用经验石,等级增加%d级\n",sheng);
printf("等级:%d\n",player.level);
}
else
{
printf("使用经验石,等级增加10级\n");
jingyanshi--;
player.level+=10;
}
}
else if(jingyanshi<1)
{
printf("没有经验石了\n\n\n");
}
else printf("等级超过45级,修为太高,无法使用。\n\n\n");
break;
case 11:
if(strongman_arm>0 && player.level<10000)
{
if(player.level>29&&player.level<10000)
{
int sheng;
sheng=45-player.level;
player.level+=sheng;
printf("使用巨人晶石,等级增加%d级",sheng);
printf("等级:%d\n",player.level);
}
else
{
printf("使用巨人晶石,等级增加16级\n\n\n");
strongman_arm--;
player.level+=16;
printf("等级:%d\n",player.level);
}
}
else if(strongman_arm<1)
{
printf("没有巨人晶石了。\n\n\n");
}
else printf("等级超过45级,修为太高,无法使用。\n\n\n");
break;
case 0:
break;
default:
printf("ChooseWupin error!\n\n\n");
}
}

int AttackResult() //攻击结果:判断是否获胜 是否获得物品 和 是否升级
{
if(guai.health<=0)
{
battle=0;
printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp);
player.exp+=guai.exp;
player.range_exp+=guai.exp;
money+=guai.money;
s=SuiJi();
if(s<guai.wupinpro)
{
printf("从敌人尸骸中发现");
printf("%s\n\n\n",guai.wupin);
AddWupin(guai.wupin_sign);
}
WhetherLevelUp();
if(strcmp(guai.name,"使徒")==0)
{
printf("神秘老人:\n\n\n 呵,年轻人,没想到你能做到击败我,不过...公主早就转移到深渊岛了,我只是一名使徒,祭司在那里,你早晚会...\n\n\n");
st=1;
}
return 1; //攻击有结果了返回1,否则返回0,用于判断是否继续做战斗行为
}
else
{
int s=SuiJi();

if((guai.attack+s-player.defense/3)<0)
{
player.health-=1;
printf("%s反击,你的HP减少了 1\n\n",guai.name);
}
else
{
player.health-=guai.attack+s-player.defense/3;
printf("%s反击,你的HP减少了%d\n\n",guai.name,guai.attack+s-player.defense/3);
}
if(player.health<0)
{
battle=0;
printf("%s战死!金币掉落%d\n\n\n",player.name,player.level*500);
money-=player.level*500;
player.health=player.max_health/5;
OrdinaryAct();//
return 1;
}
}
return 0;
}
void AddWupin(int wupin_sign)
{

switch(wupin_sign)
{
case 1:
fang4n++;
break;
case 2:
fang3n++;
break;
case 3:
fang2n++;
break;
case 4:
strongman_arm=1;
break;
case 5:
gong4n++;
break;
case 6:
gong3n++;
break;
case 7:
gong2n++;
break;
case 8:
gong5n++;
break;
case 9:
printf("AddWupin error\n\n\n");
break;
default:
if(wupin_sign==10)
fang5n++;
if(wupin_sign==11)
fang6n++;
if(wupin_sign==12)
gong6n++;
if(wupin_sign==13)
{
if(strcmp(player.name,"龙血战士")==0)
{
printf("你吸收了冰霜巨龙的力量");
printf("你变得更加强大");
player.attack+=999;
player.defense+=999;
bingshuanglongxue+=3;
}
bingshuanglongxue++;
}
if(wupin_sign==14)
longxia++;
if(wupin_sign==15)
pangxie++;
if(wupin_sign==16)
jingrou++;
if(wupin_sign==17)
yuchi++;
}
}
void WhetherLevelUp()
{
int i=0,j=0;
int l1=player.range_exp/100;
int l2=player.range_exp/300;
int l3=player.range_exp/600;
if(player.level<=15&&l1>0) //15级以下,经验足够 都满足则升级
{
if(l1==1)
{
printf("%s",player.name);
if(strcmp(player.name,"盾战")==0)
printf(" 升级!\n\n\n攻击力+2, 防御力+3, HP上限+20\n\n\n");
else
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
if(strcmp(player.name,"盾战")==0)
{
player.attack+=2;
player.defense+=3;
}
else
{
player.attack+=3;
player.defense+=2;
}
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=100;
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l1,2*l1,20*l1);
player.exp=(player.exp+guai.exp) || player.exp-((player.exp+guai.exp) || player.exp)%100;
player.attack+=3*l1;
player.defense+=2*l1;
player.max_health+=20*l1;
player.health=player.max_health;
player.level+=l1;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=100*l1;
}
}
else if(player.level<=40&&l2>0)
{
if(l2==1)
{
printf("%s",player.name);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=300;
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l2,2*l2,20*l2);
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l2;
player.defense+=2*l2;
player.max_health+=20*l2;
player.health=player.max_health;
player.level+=l2;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=300*l2;
}
}
else if(l3>0)
{
if(l3==1)
{
printf("%s",player.name);
printf(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3;
player.defense+=2;
player.max_health+=20;
player.health=player.max_health;
player.level++;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600;
}
else
{
printf("好厉害!连升%d级!",l1);
printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l3,2*l3,20*l3);
player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
player.attack+=3*l3;
player.defense+=2*l3;
player.max_health+=20*l3;
player.health=player.max_health;
player.level+=l3;
player.range_exp=0;
player.exp=player.max_exp;
player.max_exp+=600*l3;
}
}
}
void OrdinaryAct() //正常行为菜单(移动,物品,对话,查看状态,装备,退出游戏)
{

while(1)
{
// \(1000);
// system("cls");
puts("=============================================================================");
printf("要做什么?\n\n\n 1,移动 2,道具 3,对话 4,查看状态 5,装备 6,关于游戏 0,退出游戏\n\n\n");
puts("=============================================================================");
switch(scanf("%d",&choose_number),choose_number)
{
case 1: //显示移动菜单
printf("要去哪里?\n\n\n");
printf("1,happy酒吧 2,诺亚方舟酒店 3,北朝商会 4,红玉拍卖行 5,冒险荒野\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
place_sign=place.bar; //记录目前位置-酒吧
// OrdinaryAct();
break;
case 2:
place_sign=place.hotel; //进入旅店
printf("金币:%d",money);
printf("要开房吗? 200个金币 1,是 0,否\n\n\n");
choose_number=1;
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(money-200<0) //判断钱是否够
{
printf("Sorry,你的钱不够~\n\n\n");
printf("金币:%d",money);
}
else
{
printf("好好休息\nHP满\n第二天了\n\n");
printf("金币:%d\n",money);
money-=200; //花费200住店费
player.health=player.max_health; //体力满
}
break;
case 0:
printf("下次再来!\n\n\n");
break;
default:
printf("hotel talk error!\n\n\n");
}
place_sign=0;
break;
case 3:
int yongju,gong,fang;
printf("请问您要购买什么类型的物品?\n\n\n 1,攻击装备 2,防御装备 3,一次性伤害武器\n\n\n");
scanf("%d",&yongju);
switch(yongju)
{
case 1:
printf("请问您要购买什么武器?\n\n\n 1,匕首¥300 2,长剑¥500 3,碧血剑¥1000\n\n\n");
scanf("%d",&gong);
switch(gong)
{
case 1:
if(money>=300)
{
gong1n++;
money=money-300;
printf ("匕首+1\n");
printf("匕首:%d个\n",gong1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
break;
}
case 2:
if(money>=500)
{
gong2n++;
money=money-500;
printf ("长剑+1\n");
printf("长剑:%d个\n",gong2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
break;
}
case 3:
if(money>=1000)
{
gong3n++;
money=money-1000;
printf ("碧血剑+1\n");
printf("碧血剑:%d个\n",gong3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
break;
}
default:
printf("对不起,我们只会打造以上武器。");
break;

}
break;
case 2:
int fang;
printf("请问您要购买什么防具?\n\n\n 1,布衣¥300 2,铁甲¥500 3,银甲¥1000\n\n\n");
scanf("%d",&fang);
switch(fang)
{
case 1:
if(money>=300)
{
fang1n++;
money=money-300;
printf ("布衣+1\n");
printf("布衣:%d个\n",fang1n);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
}

break;
case 2:
if(money>=500)
{
fang2n++;
money=money-500;
printf ("铁甲+1\n");
printf("铁甲:%d个\n",fang2n);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d",money);
}
break;
case 3:
if(money>=1000)
{
fang3n++;
money=money-1000;
printf ("银甲+1\n");
printf("银甲:%d个\n",fang3n);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
}
default:
printf("对不起,我们只会打造以上防具。");
break;

}
printf("金币:%d\n",money);
break;
case 3:
printf("请问您要购买什么一次性伤害武器?\n 1,手雷 2,毒镖 3,手抛式原子弹\n\n\n");
int yi;
scanf("%d",&yi);
switch(yi)
{
case 1:
if(money>=300 && boom<5)
{
boom++;
money=money-300;
printf("手雷+1\n");
printf("手雷:%d\n",boom);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d",money);
}
break;
case 2:
if(money>=600 && dubiao<4)
{
dubiao++;
money=money-600;
printf("毒镖+1\n");
printf("毒镖:%d\n",dubiao);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n");
printf("金币:%d\n",money);
}
break;
case 3:
if(money>=1500 && atom_boom<23333333333)
{
atom_boom+=2;
money=money-1500;
printf("手抛式原子弹+2\n");
printf("手抛式原子弹:%d\n",atom_boom);
printf("金币:%d\n",money);
}
else
{
printf("钱不够!\n\n\n");
printf("金币:%d\n",money);
}

break;
}
}
break;
case 4:
printf ("欢迎您光临本拍卖行,请问您要卖什么东西?\n\n");
printf("攻击装备: 1,匕首:%d个 2,长剑:%d个 3,碧血剑:%d个 4,绝世好剑:%d个 5,自然之弓:%d个\n",gong1n,gong2n,gong3n,gong4n,gong5n);
printf("防御装备: 6,布衣:%d个 7,铁甲:%d个 8,银甲:%d个 9,黄金圣衣:%d个\n10,巨人晶石:%d个 0,返回\n\n\n",fang1n,fang2n,fang3n,fang4n,strongman_arm);
int pai,shu,i;
scanf("%d",&pai);
if(pai>=1)
{
if(pai==1)
{
printf("请问您要出售几件?");
scanf("%d",&shu);
if(gong1n>=shu)
{
gong1n=gong1n-shu;
money=money+shu*240;
printf("匕首:%d\n",gong1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
break;
}
if(pai==2)
{
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong2n>=shu)
{
gong2n=gong2n-shu;
money=money+shu*400;
printf("长剑:%d\n",gong2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
}
if(pai==3)
{
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong3n>=shu)
{
gong3n=gong3n-shu;
money=money+shu*800;
printf("碧血剑:%d\n",gong3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
}
if(pai==4)
{
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong4n>=shu)
{
gong4n=gong4n-shu;
money=money+shu*1500;
printf("绝世好剑:%d\n",gong4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
}
if(pai==5)
{
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(gong5n>=shu)
{
gong5n=gong5n-shu;
money=money+shu*8000;
printf("自然之弓:%d\n",gong5n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
}
if(pai==6)
{
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang1n>=shu)
{
fang1n=fang1n-shu;
money=money+shu*240;
printf("布衣:%d\n",fang1n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
}
if(pai==7)
{
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang2n>=shu)
{
fang2n=fang2n-shu;
money=money+shu*500;
printf("铁甲:%d\n",fang2n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
}
if(pai==8)
{
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang3n>=shu)
{
fang3n=fang3n-shu;
money=money+shu*800;
printf("银甲:%d\n",fang3n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
break;
}
if(pai==9)
{
printf("请问您要出售几件?\n");
scanf("%d",&shu);
if(fang1n>=shu)
{
fang4n=fang4n-shu;
money=money+shu*1500;
printf("黄金圣衣:%d\n",fang4n);
printf("金币:%d\n",money);
break;
}
else
{
printf("装备数不够,无法出售!\n");
break;
}
}
if(pai==10)
{
printf("请问您要出售几颗?");
scanf("%d",&shu);
if(strongman_arm>=shu)
{
strongman_arm=strongman_arm-shu;
money=money+shu*2000;
printf("巨人晶石:%d\n",strongman_arm);
printf("金币:%d\n",money);
}
else
{
printf("晶石数不够,无法出售!\n");
break;
}
break;
}
if(pai==10)
{
break;
break;
default:
printf("没有该装备,无法出售!\n");
break;
}
}

break;
case 5:
int yewai;
while(1)
{
puts("=============================================================================");
printf("要去哪冒险呢?");
printf("\n\n 1,神秘沼泽 危险程度:★\n\n 2,星耀草原 危险程度:★\n\n 3,诡异森林 危险程度:★★★\n\n 4,荒漠矿场 危险程度:★★★\n\n 5,炽热炎洞 危险程度:★★★★\n\n 6,花朵宫殿 危险程度:★★★★★\n\n");
if(st==1)
printf(" 7,深渊大陆★★★★★~★★★★★★★\n\n");
printf("0,离开\n");
puts("=============================================================================");
scanf("%d",&yewai);
switch(yewai)
{
case 1:
place_sign=place.forest1;
s=SuiJi();
if(s<7)
{
battle=1;
guai=xiyi;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}

else
{
printf("这里安全\n\n\n");
//不用调用OAct函数,会自动执行OAct函数;
}
break;
case 3:
place_sign=place.forest2;
s=SuiJi();
if(s<7)
{
battle=1;
guai=witch;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<8)
{
battle=1;
guai=genie;
printf("%s用弓瞄准了你!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=strongman;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 5:
place_sign=place.forest3;
s=SuiJi();
if(s<7)
{
battle=1;
guai=strongman;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=big_strongman;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 2:
place_sign=place.grass1;
s=SuiJi();
if(s<7)
{
battle=1;
guai=bee;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 4:
place_sign=place.grass2;
s=SuiJi();
if(s<7)
{
battle=1;
guai=horse;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
guai=lion;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
}
break;
case 6:
place_sign=place.grass3;
s=SuiJi();
if(s<7)
{
battle=1;
guai=lion;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<9)
{
battle=1;
if(st==0)
{
if(strongman_arm)
{
printf("神秘老人:\n\n\n 哈哈,年轻人,做的不错,不过...嘿嘿,你上当啦!巨人晶石我要了,公主你也别想带走!\n\n\n");
guai=shitu;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else printf("神秘老人:\n\n\n 年轻人,你好啊.如果你有巨人晶石,我可以告诉你公主的下落哦~\n\n\n");
}
else
{
guai=lion;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
}
else
{
printf("这里安全\n\n\n");
}
break;
case 7:
if(st==0)
{
printf("击败使徒解锁通道\n\n");
break;
}
puts("=============================================================================");
printf("要去哪冒险呢?");
printf("\n\n 1,极霜之地 危险程度:★★★★★\n\n 2,蛟龙之海 危险程度:★★★★★\n\n");
printf("0,离开\n");
puts("=============================================================================");
int sy;
scanf("%d",&sy);
switch(sy)
{
case 1:
place_sign=place.forest1;
s=SuiJi100();
if(s<60)
{
battle=1;
guai=penguin;
printf("%s扑了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<85)
{
battle=1;
guai=polar_bear;
printf("%s漂了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<98)
{
battle=1;
guai=Frost_Elves;
printf("%s寒霜之力锁定了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<99)
{
battle=1;
guai=The_Frost_Dragon;
printf("你惊扰了此地领主的沉睡\n");
printf("作为代价,就留在这里吧\n");
printf("%s飞了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
//不用调用OAct函数,会自动执行OAct函数;
}
break;
case 2:
place_sign=place.forest1;
s=SuiJi100();
if(s<30)
{
battle=1;
guai=xiabing;
printf("%s蹬了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<60)
{
battle=1;
guai=xiejiang;
printf("%s横移了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<80)
{
battle=1;
guai=jujing;
printf("%s的阴影遮了过来!\n\n\n",guai.name);
BattleAct();
}
else if(s<99)
{
battle=1;
guai=kuangsha;
printf("%s用利牙对准了过来!\n\n\n",guai.name);
BattleAct();
}
else
{
printf("这里安全\n\n\n");
//不用调用OAct函数,会自动执行OAct函数;
}
break;
}
break;
if(yewai!=0)
{
printf("该区域为未知区域,无法进入。\n\n\n");
break;
}
}
if(yewai==0)
{
break;
printf("已离开荒野。");
}
}
}
break;

case 2:
ChooseWupin();
break; //显示道具,并可以使用.
case 3: //对话选项
if(place_sign==place.bar)
{
printf("要和谁说话?\n\n\n1,红发女郎 2,赏金猎人 3,酒吧老板 4,药品商人 5,铁匠大师 6,钓鱼大师\n\n\n"); //显示对话人物
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
printf("红发女郎:\n\n\n 吧台边那个Hunter好帅啊!(~脸红~)\n\n\n听说他经常外出打猎,外面的路他应该很熟悉的!\n\n\n");
break;
case 2:
if(fang1n<1&&gong1n<1)
{
printf("赏金猎人:\n\n\n 你要救公主啊!好胆量!\n\n\n 不过外面的世界很险恶,而且越深越危险,这是匕首和布衣,对你会有些帮助的,拿去吧!\n\n\n");
printf("%s心想:哇,这位大叔人真好啊!\n\n\n)",player.name);
gong1n++;
fang1n++;
}
else printf("赏金猎人:\n\n\n 加油吧,年轻人!\n\n\n 不要被外面世界所吓倒!\n\n\n");
break;
case 3:
printf("要喝点什么?\n\n\n 1,二锅头25金币 HP+20 2,XO酒80金币 HP+50 3,人头马面150金币 HP+100 0,返回\n\n\n");
choose_number=1;
while(choose_number)
{
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(money<25)
{
printf("钱不够!");
}
else
{
if(player.health+20<=player.max_health)
{
printf("HP+20.");
money-=25;
player.health+=20;
}
else
{
printf("HP满了");
player.health=player.max_health;
}
}
break;
case 2:
if(money<80)
{
printf("钱不够!");
}
else
{
if(player.health+50<=player.max_health)
{
printf("HP+50.");
money-=80;
player.health+=50;
}
else
{
printf("HP满了");
player.health=player.max_health;
}
}
break;
case 3:
if(money<150)
{
printf("钱不够!");
}
else
{
if(player.health+100<=player.max_health)
{
printf("HP+100.");
money-=150;
player.health+=100;
}
else
{
printf("HP满了");
player.health=player.max_health;
}
}
break;
case 0:
printf("下次再来!\n");
break;
default:
printf("输入错误\n\n\n");
break;
}
break;
}
break;
case 4:
printf("你要干什么?\n\n\n 1,买东西 2,聊天 \n\n\n");
int mai;
scanf("%d",&mai);
if(mai==1)
{
printf("买点什么呢?\n1,止血草¥100 HP+60\n2,急救包¥150 HP+80 \n3,云南白药¥250 HP+120\n4,超级云南白药¥400 HP+200 \n5,经验草¥150 经验+300 \n6,经验包¥600 经验+600\n7,经验石¥500 经验+1000 \n0,拜拜\n");
int dongxi;
scanf("%d",&dongxi);
switch(dongxi)
{
case 1:
if(money>=100&&cao<6)
{
cao++;
money=money-100;
printf ("止血草+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 2:
if(money>=150&&jijiubao<5)
{
jijiubao++;
money=money-150;
printf ("急救包+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 3:
if(money>=250&&baiyao<4)
{
baiyao++;
money=money-250;
printf ("云南白药+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 4:
if(money>=400&&superbaiyao<3)
{
superbaiyao++;
money=money-400;
printf ("超级云南白药+1\n");

}
else
{
printf("钱不够!\n");
}
break;
case 5:
if(money>=150)
{
jingyancao++;
money=money-150;
printf ("经验草+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 6:
if(money>=300)
{
jingyanbao++;
money=money-300;
printf ("经验包+1\n");
}
else
{
printf("钱不够!\n");
}
break;
case 7:
if(money>=500)
{
jingyanshi++;
money=money-500;
printf ("经验石+1\n");
}
else
{
printf("钱不够!\n");
}
break;
}
case 0:
printf("金币:%d\n",money);
printf("再见,欢迎下次再来!\n");
break;

}
if(mai==2)
{
printf("药品商人:去去去,老子没时间陪你聊。\n");
}
break;
case 5:
printf("你要干什么?\n\n\n 1,锻造 \n\n\n");
int x;
scanf("%d",&x);
if(x==1)
{
printf("1.冰霜龙剑(5份龙血)\n");
printf("2.冰霜龙甲(8份龙血)\n");
int y;
scanf("%d",&y);
if(y==1 && bingshuanglongxue>=5)
{
printf("锻造成功\n");
bingshuanglongxue-=5;
gong7n++;
}
else if(y==2 && bingshuanglongxue>=8)
{
printf("锻造成功\n");
bingshuanglongxue-=8;
fang7n++;
}
else printf("没有锻造\n");
}
else
{
printf("你离开了");
}
break;
case 6:
printf("龙虾:%d个\n",longxia);
printf("螃蟹:%d个\n",pangxie);
printf("鲸肉:%d个\n",jingrou);
printf("鱼翅:%d个\n",yuchi);
printf("你要干什么? \n1,烤鱼 \n\n\n");
x=0;
scanf("%d",&x);
if(x==1)
{
printf("1.麻辣龙虾(+2攻击)\n");
printf("2.清蒸螃蟹(+2防御)\n");
printf("3.鱼翅刺身(+20攻击)\n");
printf("4.鲸肉刺身(+20防御)\n");
int y;
scanf("%d",&y);
if(y==1 && longxia>=1)
{
printf("烹饪成功\n");
longxia-=1;
if(player.attack<=999)
player.attack+=2;
}
else if(y==2 && pangxie>=1)
{
printf("烹饪成功\n");
pangxie-=1;
if(player.defense<=999)
player.defense+=2;
}
else if(y==3 && yuchi>=1)
{
printf("烹饪成功\n");
yuchi-=1;
if(player.attack<=9999)
player.attack+=20;
}
else if(y==4 && pangxie>=1)
{
printf("烹饪成功\n");
jingrou-=1;
if(player.defense<=9999)
player.defense+=20;
}
else printf("没有烹饪\n");
}
else
{
printf("你离开了");
}
}
}
else if(place_sign==place.hotel)
printf("“老板娘!我...”\n\n\n“我忙着呢,没空理你~”\n\n\n");
else printf("这里好像没人可以聊天\n\n\n");
break;
case 4:
DisplayState();
break; //显示状态
case 5: //装备
printf("攻击装备: 1,匕首:%d个 2,长剑:%d个 3,碧血剑:%d个 4,绝世好剑:%d个 5,自然之弓:%d个\n\n\n",gong1n,gong2n,gong3n,gong4n,gong5n);
printf("防御装备: 6,布衣:%d个 7,铁甲:%d个 8,银甲:%d个 9,黄金圣衣:%d个\n\n\n",fang1n,fang2n,fang3n,fang4n);
printf("深渊装备: 10,冰熊巨甲:%d个 11,企鹅皮甲:%d个 12,寒霜之弓:%d个 13,冰霜龙剑:%d个 14,冰霜龙甲:%d个\t\t0,返回\n\n\n",fang5n,fang6n,gong6n,gong7n,fang7n);
printf("选择要装备的武器或防具:\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
if(gong1n>=1)
{
printf("拿起了匕首\n\n\n");
gong=gong1;
strcpy(gongname,"匕首");
}
else printf("你没有匕首可以装备\n\n\n");
break;
case 2:
if(gong2n>=1)
{
printf("拿起了长剑\n\n\n");
gong=gong2;
strcpy(gongname,"长剑");
}
else printf("你没有长剑可以装备\n\n\n");
break;
case 3:
if(gong3n>=1)
{
printf("拿起了碧血剑\n\n\n");
gong=gong3;
strcpy(gongname,"碧血剑");
}
else printf("你没有碧血剑可以装备\n\n\n");
break;
case 4:
if(gong4n>=1)
{
printf("拿起了绝世好剑\n\n\n");
gong=gong4;
strcpy(gongname,"绝世好剑");
}
else printf("你没有绝世好剑可以装备\n\n\n");
break;
case 5:
if(gong5n>=1)
{
printf("拿起了自然之弓\n\n\n");
gong=gong5;
strcpy(gongname,"自然之弓");
}
else printf("你没有布衣可以装备\n\n\n");
break;
case 6:
if(fang1n>=1)
{
printf("穿上了布衣\n\n\n");
fang=fang1;
strcpy(fangname,"布衣");
}
else printf("你没有布衣可以装备\n\n\n");
break;
case 7:
if(fang2>=1)
{
printf("穿上了铁甲\n\n\n");
fang=fang2;
strcpy(fangname,"铁甲");
}
else printf("你没有铁甲可以装备\n\n\n");
break;
case 8:
if(fang3n>=1)
{
printf("穿上了银甲\n\n\n");
fang=fang3;
strcpy(fangname,"银甲");
}
else printf("你没有银甲可以装备\n\n\n");
break;
case 9:
if(fang4n>=1)
{
printf("穿上了黄金圣衣\n\n\n");
fang=fang4;
strcpy(fangname,"黄金圣衣");
}
else printf("你没有黄金圣衣可以装备\n\n\n");
break;
case 0:
printf("未更换装备\n\n\n");
break;
default:
if(choose_number==10)
if(fang5n>=1)
{
printf("穿上了冰熊巨甲\n\n\n");
fang=fang5;
strcpy(fangname,"冰熊巨甲");
}
else printf("你没有冰熊巨甲可以装备\n\n\n");
if(choose_number==11)
if(fang6n>=1)
{
printf("穿上了企鹅皮甲\n\n\n");
fang=fang6;
strcpy(fangname,"企鹅皮甲");
}
else printf("你没有企鹅皮甲可以装备\n\n\n");
if(choose_number==12)
if(gong6n>=1)
{
printf("拿起了寒霜之弓\n\n\n");
gong=gong6;
strcpy(gongname,"寒霜之弓");
}
else printf("你没有寒霜之弓可以装备\n\n\n");
if(choose_number==13)
if(gong7n>=1)
{
printf("拿起了冰霜龙剑\n\n\n");
gong=gong7;
strcpy(gongname,"冰霜龙剑");
}
else printf("你没有冰霜龙剑可以装备\n\n\n");
if(choose_number==14)
if(fang7n>=1)
{
printf("拿起了冰霜龙甲\n\n\n");
fang=fang7;
strcpy(fangname,"冰霜龙甲");
}
else printf("你没有冰霜龙甲可以装备\n\n\n");
}
break;
case 6:
printf(" 您好,欢迎您玩苍穹世界。为了给您更好的游戏体验,本团队时不时会优化本游戏,优化后会尽快发布在网上。关于外挂方面,开启外挂的方式是设定勇者姓名时,输入“圣战斗士 ”(不包括双引号)。由于2.0版本的buy,我们在2.0的基础上进行修改,已修复该buy。并且新增了经验草等有助于升级的道具,希望大家喜欢。在这里要感谢离陌同学,他给了我们许多宝贵的建议,谢谢。\n");
break;
case 0:
printf("确定退出游戏?(Y/N)\n\n\n");
getchar();
proof=getchar();
if(proof=='y'||proof=='Y')
{
printf("数据存储中...");
//向文件中更新数据;
getchar();
printf("按回车退出");
getchar();
return;
}
else if(proof=='n'||proof=='N')printf("继续游戏!\n\n\n");
else printf("继续!\n\n\n");
break;
default:
printf("输入错误!\n\n\n");
}
}
}
void DisplayState()
{
printf("%s 攻击力:%d+%d=%d 防御力:%d+%d=%d HP:%d/%d \n\n\n",player.name,player.attack,gong,player.attack+gong,player.defense,fang,player.defense+fang,player.health,player.max_health);
printf("武器: %s 防具: %s \n\n\n",gongname,fangname);
printf("等级:%d 经验:%d/%d 还需要%d经验升级 金币:%d \n\n\n",player.level,player.exp,player.max_exp,player.max_exp-player.exp,money);
}
void BattleAct()
{
while(1)
{
puts("=============================================================================");
printf("要怎么办?\n\n\n 1,攻击 2,物品 3,查看状态 4,逃跑\n\n\n");
switch(scanf("%d",&choose_number),choose_number)
{
case 1:
s=SuiJi();
printf("%s攻击! %sHP减少%d\n\n\n",player.name,guai.name,player.attack+s+gong-guai.defense/3);
guai.health-=player.attack+s+gong-guai.defense/3;
if(AttackResult())return; //如果攻击有结果(敌人或玩家战死)退出函数
else continue;
case 2:
ChooseWupin();
break; //选择物品,可以使用,战斗中允许使用攻击性物品
case 3:
DisplayState();
break; //显示状态
case 4:
s=SuiJi();
if(s<4) //40%的概率可以逃跑
{
printf("%s逃跑了~\n\n\n",player.name);
battle=0;
return;
}
else printf("%s逃跑失败!\n\n\n",player.name);
break;
default:
printf("输入错误,重新输入!\n\n\n");
}
}
}
void printf(char *p)
{
while(1)
{
if(*p!=0)
printf("%c",*p++);
else
break;
Sleep(100);
}
}

扫雷

C
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <Windows.h>
using namespace std;

typedef pair<int, int> P;
const int M = 10;
const int N = 10;

void InitGame(int A[M][N]);//初始化游戏
void Map(int A[M][N], int Static[M][N]);//地图
void Result(int A[M][N]);//游戏结果
int IfSafety(int A[M][N],int x,int y);//周围是否有地雷
void Operate(int A[M][N],int Static[M][N], int x, int y); //操作产生的影响
void Welcome(); //欢迎界面
void GameOver(); //结束界面
void gotoxy(int x, int y);   //指针位置
void color(int c);  //改变颜色
//实现部分

//#include"Mine_Sweep.h"

void InitGame(int A[M][N])
{
 //从右开始顺时针->右(1,0)右上(1,1)上(0,1)左上(-1,1)左(-1,0)左下(-1,-1)下(0,-1)右下(1,-1)
 int Sign[8][2] = { {1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1} };
 int count = 0;//产生M个不同随机数
 int Random; //随机数1-100
 int x, y;  //横纵坐标
 srand(unsigned(time(NULL)));
 //清空
 for (int i = 0; i < M; i++)
 for (int j = 0; j < N; j++)
 A[i][j] = 0;
 //把M个雷安放好
 while (count < M)
 {
 Random = rand() % 100 + 1;
 x = Random / 10;  //转换为X
 y = Random - 10 * x; //转换为Y
 if (A[x][y] == 0)  //地雷设为-1,无地雷设为0,1,2...
 {
 A[x][y] = -1;
 count++;
 }
 }
 //构建一个虚拟的地图即增加外围[M][N]->[M+2][N+2]目的是为了让边界和内部的处理方式一样
 int Virtual[M + 2][N + 2] = { 0 };
 for (int i = 0; i < M; i++)
 {
 for (int j = 0; j < N; j++)
 {
 Virtual[i + 1][j + 1] = A[i][j];//所有元素向下向右移动1格
 }
 }
 //计算每个地方的地雷分布情况
 for (int i = 1; i <= M; i++)
 {
 for (int j = 1; j <= N; j++)
 {
 int flag = 0;
 //如果是地雷
 if (Virtual[i][j] == -1)
 continue;  //跳过
 for (int k = 0; k < 8; k++)
 {
 if (Virtual[i + Sign[k][0]][j + Sign[k][1]]==-1)
  flag++;
 }
 A[i-1][j-1] = flag;
 }
 }
}

void Map(int A[M][N],int Static[M][N])
{
 system("cls");
 Welcome();
 //地雷用※表示,数字用123...,未翻开用■ Static[M][N]用于储存状态0表示未翻开,1表示翻开
 for (int i = 0; i < M; i++)
 {
 cout << "ttttt"<<" ";
 for (int j = 0; j < N; j++)
 {
 if (Static[i][j] == 0)
 cout << "■";
 else
 {
 if (A[i][j] == -1)
 {
  cout << "※";

 }
 else
 {
  if (IfSafety(A, i, j))
  cout << "□";
  else
  cout <<" " <<A[i][j];
 }
 }
 }
 cout << endl;
 }
}

void Operate(int A[M][N], int Static[M][N],int x,int y)//贪心算法
{
 queue<P> que;//队列
 //从右开始顺时针->右(1,0)右上(1,1)上(0,1)左上(-1,1)左(-1,0)左下(-1,-1)下(0,-1)右下(1,-1)
 int Sign[8][2] = { {1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1} };
 if (A[x][y] == -1) //如果翻到地雷,游戏结束
 {
 Result(A); //显示结果
 GameOver();   //游戏结束
 exit(0);
 }
 Static[x][y] = 1;//翻开
 que.push(P(x, y));

 while (que.size()) {
 P p = que.front();
 que.pop();
 if(!IfSafety(A, p.first, p.second))
 continue; //如果周围有炸弹,继续遍历队列

 for (int i = 0; i < 8; i++) {
 int nx = p.first + Sign[i][0];
 int ny = p.second + Sign[i][1];
 if (0 <= nx && nx < M && 0 <= ny && ny < N && Static[nx][ny] == 0) {
 que.push(P(nx, ny));
 Static[nx][ny] = 1;//翻开
 }
 }
 }
}
void Result(int A[M][N])
{
 for (int i = 0; i < M; i++) {
 cout << "ttttt";
 for (int j = 0; j < N; j++)
 cout << A[i][j]<<" ";
 cout << endl;
 }

}

int IfSafety(int A[M][N],int x, int y)
{
 //从右开始顺时针->右(1,0)右上(1,1)上(0,1)左上(-1,1)左(-1,0)左下(-1,-1)下(0,-1)右下(1,-1)
 int Sign[8][2] = { {1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1} };
 int Virtual[M + 2][N + 2] = { 0 };
 x = x + 1;//虚拟坐标
 y = y + 1;
 for (int i = 0; i < M; i++)
 {
 for (int j = 0; j < N; j++)
 {
 Virtual[i + 1][j + 1] = A[i][j];//所有元素向下向右移动1格
 }
 }
 //计算每个地方的地雷分布情况
 for (int k = 0; k < 8; k++)
 {
 if (Virtual[x + Sign[k][0]][y + Sign[k][1]] == -1)
 return 0;
 }
 return 1;
}

void Welcome()
{
 cout << "tttttt扫雷游戏"<<endl<<endl;
 cout << "tttt===========================================" << endl << endl;
 gotoxy(40, 3);
 for (int i = 0; i < M; i++)
 {
 //画x轴坐标
 cout << " " << i + 1;
 }

 for (int j = 0; j < M; j++)
 {
 //画Y轴坐标
 gotoxy(38, 4+j);
 cout << j + 1<<endl;
 }
 gotoxy(0, 4);
}

void GameOver()
{
 cout << "tttt游戏结束,你输了" << endl;
 getchar();
 getchar();
}

void gotoxy(int x, int y)
{
 COORD pos;
 pos.X = x;
 pos.Y = y;
 SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}

void color(int c)
{
 SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),c);
}
//主函数

//#include"Mine_Sweep.h"

int main()
{
 int A[M][N], x, y, Static[M][N] = { 0 };
 color(13);
 InitGame(A);
 cout << "nnntt游戏说明:" << "你需要在不点错雷的情况下尽可能快的将所有的雷都标记出来n";
 cout << "tt你点出了一个数字,是1,就说明它周围的8的格子里有1个雷,是2就有两个雷,是3就有三个雷···" << endl;
 cout<< "tt但如果你标记错了雷,那就会boom!游戏结束。"<<endl;
 cout << "tt请先输入横坐标,再输入纵坐标 eg: 1 2" << endl;
 cout << "tt回车键开始,祝你好运!" << endl;
 getchar();
 color(15);
 while (1)
 {
 int flag = 1;
 Map(A, Static);
 cout << "tttt请输入要翻开的坐标:";
 cin >> x >> y;
 while (x <= 0 || x > M || y <= 0 || y > N)
 {
 cout << "tttt超出范围,请重新输入要翻开的坐标:" ;
 cin >> x >> y;
 }
 Operate(A, Static, x-1, y-1);
 }
 return 0;
}

愤怒地小鸟

C
#include <bits/stdc++.h>
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <time.h>
using namespace std;
const double pi = 3.1415926536;
int toint (float a) {
    return ((int) (a * 10 + 5)) / 10;
}
void Color (int a) {
    if (a == 0 || a == 14 || a == 20) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
    } else if (a == 1 || a == 12) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    } else if (a == 2) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_GREEN);
    } else if (a == 3) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    } else if (a == 4 || a == 11) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_RED);
    } else if (a == 5 || a == 13) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    } else if (a == 7) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_GREEN|FOREGROUND_BLUE);
    } else if (a == 15) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
    } else if (a == 16) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_GREEN);
    } else if (a == 17) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_RED);
    } else if (a == 8) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
    } else if (a == 6) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_BLUE);
    } else if (a == 9) {
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
        FOREGROUND_INTENSITY|FOREGROUND_RED|BACKGROUND_RED|BACKGROUND_GREEN);
    }
}
void SetPos (float x, float y) {
    int xx = toint (x), yy = toint (y);
    COORD pos;
    pos.X = yy * 2;
    pos.Y = xx;
    SetConsoleCursorPosition (GetStdHandle (STD_OUTPUT_HANDLE), pos);
}
struct node {
    int W, W2, S, mS;
    float X, Y;
    float vx, vy;
    float ax, ay;
    bool go, boom;
} blt[100001], pig[100001], boo[100001];
int T, yX, yY, Xy, put, K, K2, Sle, What;
int Bot, Pit, Blt, Pig, Sco, pigk, scok;
int m[41][41];
void Cout (int a, int x, int y) {
    if (a == 1) {
        SetPos (x, y);
        Color (5);
        cout << put << ' ';
    }
    if (y == 202) {
        SetPos (pig[a].X, pig[a].Y);
        cout << ". ";
        if ((pig[a].W == 2 || pig[a].W == 3) && pig[a].X >= 2) {
            SetPos (pig[a].X - 2, pig[a].Y);
            cout << ". ";
            SetPos (pig[a].X - 1, pig[a].Y);
            cout << ". ";
        } else if (pig[a].W == 4) {
            SetPos (pig[a].X, pig[a].Y - 1);
            cout << ". ";
        } else if(pig[a].W == 5) {
            SetPos (pig[a].X - 1, pig[a].Y);
            cout << ". ";
            SetPos (pig[a].X - 1, pig[a].Y - 1);
            cout << ". ";
        }
    }
    if (a == 2) {
        for (int i = 0; i <= 40; i++) {
            for (int j = 0; j <= 40; j++) {
                if (i <= 18 && m[i][j] == 1) {
                    SetPos (i, j);
                    Color (7);
                    cout << "■";
                }
                if (m[i][j] >= 2 && m[i][j] <= 19) {
                    SetPos (i, j);
                    Color (5);
                    cout << "█";
                    m[i][j]++;
                }
                if (m[i][j] > 19 && m[i][j] <= 29) {
                    SetPos (i, j);
                    Color (0);
                    cout << "█";
                    m[i][j]++;
                    if (m[i][j] == 30) {
                        SetPos (i, j);
                        Color (0);
                        cout << "  ";
                        m[i][j] = 0;
                    }
                    if (m[i][j] >= 31 && m[i][j] <= 49) {
                        SetPos (i, j);
                        Color (0);
                        cout << "■";
                        m[i][j]++;
                    }
                    if (m[i][j] == 50) {
                        SetPos (i, j);
                        Color (7);
                        cout << "■";
                        m[i][j] = 1;
                    }
                }
            }
        }
    }
    if (y == 666) {
        SetPos (blt[a].X, blt[a].Y);
        Color (10 + blt[a].W);
        cout<<"●";
    }
    Color (0);
}
void Go (int a) {
    SetPos (blt[a].X, blt[a].Y);
    cout << "..";
    blt[a].X += blt[a].vx / 2;
    blt[a].Y += blt[a].vy / 2;
    blt[a].vx += blt[a].ax / 2;
    blt[a].vy += blt[a].ay / 2;
    if (blt[a].X >= 20) {
        blt[a].X = 19;
    }
    if (blt[a].X > 20 || blt[a].Y > 38 || blt[a].X < 0 || blt[a].Y <= 0) {
        blt[a].go = 1;
    }
    if (blt[a].W2 == 1 && blt[a].Y >= Xy) {
        blt[a].go = 1;
        Sle = 0;//地跑鸟
    }
    if (blt[a].W2 == 0) {
        for (int i = 0; i <= blt[a].vx / 2 + 1; i++) {
            if (blt[a].vx > 0 && m[toint (blt[a].X) + i][toint (blt[a].Y)] == 1) {
                if (blt[a].W != 5) {
                    blt[a].boom = 1;
                }
                blt[a].X = toint (blt[a].X) + i - 1;
                blt[a].Y += blt[a].vy / 2;
                blt[a].vx = -blt[a].vx * 0.4;
                blt[a].vy = blt[a].vy * 0.8;
                if (blt[a].W == 3) {
                    blt[a].ax = 0.5;
                }
                if (blt[a].W == 7) {
                    blt[a].vx *= 2;
                }
                if (blt[a].W == 10) {
                    blt[a].go = 1;
                    Bot++;
                    boo[Bot].X = blt[a].X;
                    boo[Bot].Y = blt[a].Y;
                    boo[Bot].S = 1;
                    boo[Bot].mS = 4;
                }
            }
            if (blt[a].vx < 0 && m[toint (blt[a].X) - i][toint(blt[a].Y)] == 1) {
                if (blt[a].W != 5) {
                    blt[a].boom = 1;
                }
                blt[a].X = toint (blt[a].X) + i + 1;
                blt[a].Y += blt[a].vy / 2;
                blt[a].vx = -blt[a].vx;
                blt[a].vy=blt[a].vy * 0.8;
                if (blt[a].W == 3) {
                    blt[a].ax = 0.5;
                }
                if (blt[a].W == 7) {
                    blt[a].vx *= 2;
                }
                if (blt[a].W == 10) {
                    blt[a].go = 1;
                    Bot++;
                    boo[Bot].X = blt[a].X;
                    boo[Bot].Y = blt[a].Y;
                    boo[Bot].S = 1;
                    boo[Bot].mS = 4;
                }
            }
        }
        if (abs (blt[a].vx) <= 0.1 && abs (blt[a].vy) <= 0.1 && abs (blt[a].ay) <= 0.1) {
            blt[a].go = 1;
            if (blt[a].W == 5) {
                Bot++;
                boo[Bot].X = blt[a].X;
                boo[Bot].Y = blt[a].Y;
                boo[Bot].S = 1;
                boo[Bot].mS = 4;
                blt[a].go = 1;
            }
        }
    }
    if (blt[a].go == 0) {
        Cout (a, 0, 666);
    }
}
void Kill (int a) {
    if (pig[a].go == 0 && pig[a].W != 2 && pig[a].W != 3 && pig[a].Y < 16) {
        Cout (a, 202, 202);
        pig[a].Y = 16;
    }
    if (pig[a].go == 0 && pig[a].W == 4 && pig[a].Y < 20) {
        pig[a].W = 1;
    }
    int R = rand () % 50;
    Cout (a, 202, 202);
    //清除猪猪
    pig[a].X += pig[a].vx / 2;
    pig[a].Y += pig[a].vy / 2;
    pig[a].vx += pig[a].ax / 2;
    pig[a].vy += pig[a].ay / 2;
    for (int i = -2; i <= pig[a].vx / 2 + 1; i++) {
        if (m[toint (pig[a].X) + i][toint (pig[a].Y)] == 1) {
            pig[a].X = toint (pig[a].X) + i - 1;
            pig[a].Y += pig[a].vy / 2;
            pig[a].vx = -pig[a].vx * 0.5;
            pig[a].vy = pig[a].vy * 0.8;
        }
    }
    for (int i = Blt - 10; i <= Blt; i++) {
        if (pig[a].W == 5 && blt[i].go == 0 && abs (pig[a].X - blt[i].X) <= 1
        && abs (pig[a].Y - blt[i].Y) <= 1) {
            m[toint (pig[a].X) - 1][toint (pig[a].Y)] = 2;
            pig[a].W2++;
            Sco += 2;
            break;
        }
        if (pig[a].W == 5 && m[toint (pig[a].X)][toint (pig[a].Y)] >= 2 &&
        m[toint (pig[a].X)][toint (pig[a].Y)] < 30) {
            m[toint (pig[a].X) - 1][toint (pig[a].Y)] = 2;
            pig[a].W2++;
            Sco += 2;
            break;
        }
        if (blt[i].go == 0 && abs (pig[a].X - blt[i].X) <= 1 && abs (pig[a].Y - blt[i].Y) <= 1) {
            if (pig[a].W == 6) {
                Bot++;
                boo[Bot].X = pig[a].X;
                boo[Bot].Y = pig[a].Y;
                boo[Bot].S = 1;
                boo[Bot].mS = 4;
                blt[i].go = 1;
            }
            m[toint (pig[a].X)][toint (pig[a].Y)] = 2;
            pig[a].go = 1;
            Pig--;
            Sco+=10;
            break;
        }
        if (m[toint (pig[a].X)][toint (pig[a].Y)] >= 2 &&
        m[toint (pig[a].X)][toint (pig[a].Y)] < 30) {
            if (pig[a].W == 6) {
                Bot++;
                boo[Bot].X = pig[a].X;
                boo[Bot].Y = pig[a].Y;
                boo[Bot].S = 1;
                boo[Bot].mS = 4;
            }
            pig[a].go = 1;
            Pig--;
            Sco += 10;
            break;
        }
        if ((pig[a].W == 2 || pig[a].W == 3) && blt[i].go == 0 &&
        abs (pig[a].X - 2 - blt[i].X) <= 1 && abs (pig[a].Y - blt[i].Y) <= 1) {
            m[toint (pig[a].X)][toint (pig[a].Y)] = 2;
            pig[a].go = 1;
            Pig--;
            Sco += 10;
            break;
        }
        if ((pig[a].W == 2 || pig[a].W == 3) &&
        m[toint (pig[a].X - 2)][toint (pig[a].Y)] >= 2
        && m[toint (pig[a].X - 2)][toint (pig[a].Y)] < 30) {
            pig[a].go = 1;
            Pig--;
            Sco += 10;
            break;
        }
    }
    //弄死猪猪
    if (pig[a].go == 0) {
        if (pig[a].go == 0 && pig[a].W != 2 && pig[a].W != 3 && pig[a].Y < 16) {
            Cout (a, 202, 202);
            pig[a].Y = 16;
        }
        if (pig[a].go == 0 && pig[a].W == 4 &&pig[a].Y < 20) {
            pig[a].W = 1;
        }
        int Xx = toint (pig[a].X), Xy = toint (pig[a].Y);
        if (pig[a].W == 6) {
            SetPos (pig[a].X, pig[a].Y);
            Color (9);
            cout << "TN";
            Color (0);
        } else {
            SetPos (pig[a].X, pig[a].Y);
            Color (2);
            cout << "●";
            if ((pig[a].W == 2 || pig[a].W == 3) && pig[a].X >= 2) {
                SetPos (pig[a].X - 2, pig[a].Y);
                Color (0);
                cout << "○";
                SetPos (pig[a].X - 1, pig[a].Y);
                cout << "|";
            } else if (pig[a].W == 4) {
                SetPos (pig[a].X, pig[a].Y - 1);
                Color (2);
                cout << "﹃";
            } else if (pig[a].W == 5) {
                SetPos (pig[a].X - 1, pig[a].Y);
                Color (8);
                SetPos (pig[a].X - 1, pig[a].Y - 1);
                cout << "▁";
                if (pig[a].W2 == 0) {
                    cout << "▅";
                } else if (pig[a].W2 == 1) {
                    cout << "▃";
                } else if (pig[a].W2 == 2) {
                    cout << "▂";
                } else if (pig[a].W2 == 3) {
                    pig[a].W = 1;
                    pig[a].W2 = 0;
                    SetPos (pig[a].X - 1, pig[a].Y - 1);
                    cout << "  ";
                }
            }
        }
        //输出猪猪
        if (pig[a].W == 2 && pig[a].X > pig[a].S) {
            pig[a].W = 3;
            pig[a].ax = -0.4;
            pig[a].vx = 1.5;
        } else if (pig[a].W == 3 && pig[a].X <= pig[a].S) {
            pig[a].W = 2;
            pig[a].ax = 0.4;
            pig[a].vx = -1.5;
        }
        if ((pig[a].W == 2 || pig[a].W == 3) && (pig[a].Y <= 10 || pig[a].Y >= 38)) {
            pig[a].vy *= -1;
        }
        if (pig[a].W == 4 && R == 0 && pig[a].X == 20) {
            pig[a].vx = -((rand () % 40) / 10);
        }
        if(pig[a].W == 4) {
            int r = rand () % 20;
            for (int i = Blt - 10; i <= Blt; i++) {
                if (r <= 5 && blt[i].go == 0 && pig[a].Y - blt[i].Y <= 5 &&
                abs (blt[i].X - pig[a].X) <= 1.5 && r < 5) {
                    r = 0;
                    break;
                }
            }
            if (r == 0) {
                m[toint (pig[a].X)][toint (pig[a].Y) - 2] = 10;
                m[toint (pig[a].X)][toint (pig[a].Y) - 3] = 2;
                for (int j = toint (pig[a].Y) - 1; j >= toint (pig[a].Y) - 5; j--) {
                    for (int i = Blt - 10; i <= Blt; i++) {
                        if (blt[i].go == 0 && !(blt[i].W == 3 && blt[i].boom == 1)
                        && blt[i].W2 == 0 && toint (blt[i].Y) == j
                        && abs (blt[i].X - pig[a].X) <= 2) {
                            blt[i].vy = -2;
                        }
                    }
                    for (int i = Pit - 50; i <= Pit; i++) {
                        if (pig[i].go == 0 && toint (pig[i].Y) == j && abs (pig[i].X - pig[a].X) <= 2) {
                            pig[i].vy = -1;
                        }
                    }
                }
            }
        }
        //移动猪猪
        if (pig[a].go == 0 && pig[a].W != 2 && pig[a].W != 3 && pig[a].Y < 16) {
            Cout (a, 202, 202);
            pig[a].Y = 16;
        }
        if (pig[a].go == 0 && pig[a].W == 4 && pig[a].Y < 20) {
            pig[a].W = 1;
        }
        if (pig[a].X > 20 || pig[a].Y > 38 || pig[a].X < 0 || pig[a].Y <= 0) {
            pig[a].go = 1;
            Pig--;
            Cout (a, 202, 202);
        }
        //清除猪猪
    }
}
void Creat (int a, int p) {
    if (a == -1 && p == -1) {
        Blt++;
        blt[Blt].W = What;
        blt[Blt].W2 = 1;
        blt[Blt].vy = 1;
        blt[Blt].X = 19;
        blt[Blt].Y = 0;
        blt[Blt].boom = 1;
    } else if (a == 0 && p == -1) {
        int u = rand () % 7 + 1, U = rand() % 30;
        if (u >= 5) {
            Pit++;
            pig[Pit].Y = rand () % 15 + 20;
            pig[Pit].X = 2;
            pig[Pit].ax = 0.5;
            pig[Pit].W = 1;
        } else if (u == 1) {
            Pit++;
            pig[Pit].Y = rand () % 15 + 20;
            pig[Pit].X = 2;
            pig[Pit].vy = 0.5;
            pig[Pit].ax = 0.5;
            pig[Pit].S = rand () % 5 + 7;
            pig[Pit].W = 2;
        } else if (u == 2) {
            Pit++;
            pig[Pit].Y = rand () % 15 + 20;
            pig[Pit].X = 2;
            pig[Pit].ax = 0.5;
            pig[Pit].W = 4;
        } else if (u == 3) {
            Pit++;
            pig[Pit].Y = rand () % 15 + 20;
            pig[Pit].X = 2;
            pig[Pit].ax = 0.5;
            pig[Pit].W = 5;
        } else if (u == 4) {
            Pit++;
            pig[Pit].Y = rand () % 15 + 20;
            pig[Pit].X = 2;
            pig[Pit].ax = 0.5;
            pig[Pit].W = 6;
        }
        if (U == 1) {
            Bot++;
            boo[Bot].Y = rand () % 13 + 15;
            boo[Bot].X = (rand () % 4) * 3 + 8;
            boo[Bot].S = 0;
            boo[Bot].mS = rand () % 2 + 2;
            boo[Bot].W2 = 1;
        }
    } else {
        Blt++;
        blt[Blt].W = What;
        if (a == 1) {
            blt[Blt].X = yX;
            blt[Blt].Y = yY;
            blt[Blt].ax = 0.5; //抛物线
        }
        blt[Blt].vx = -3.5 * sin (p * pi / 180);
        blt[Blt].vy = 3 * cos (p * pi / 180);
        if (p <= 45) {
            blt[Blt].vy *= 1 + (0.33 - 0.01 * (45 - p));
        }
        if (p >= 45) {
            blt[Blt].vy *= 1 + (0.33 - 0.01 * (p - 45));
        }
        if (blt[Blt].W == 6) {
            blt[Blt].vy *= 1.2;
            blt[Blt].ax = 0.4;
        }
    }
}
void Boom (int a) {
    if (boo[a].W2 == 0) {
        int ms = boo[a].mS, s = boo[a].S, x = boo[a].X, y = boo[a].Y;
        if (s == ms) {
            return ;
        }
        for (int i = x - s; i <= x + s; i++) {
            for (int j = y - s; j <= y + s; j++) {
                float k = (i - x) * (i - x) + (j - y) * (j - y) - s * s;
                if (k <= s && k >= -s && i <= 20 && j <= 38 && i >= 0 && j > 0 && m[i][j] != 1) {
                    m[i][j] = 2;
                }
            }
        }
        boo[a].S++;
    }
    if (boo[a].W2 == 1) {
        int ms = boo[a].mS, s = boo[a].S, x = boo[a].X, y = boo[a].Y;
        if (s == ms) {
            return ;
        }
        if (y - s > 10) {
            m[x][y-s] = 31 - 31 * (boo[a].W2 - 1);
        }
        if (y + s < 40) {
            m[x][y+s] = 31 - 31 * (boo[a].W2 - 1);
        }
        boo[a].S++;
    }
}
void Move (int a) {
    Color (5);
    if (a == -2) {
        SetPos (17, Xy);
        cout << "        ";
        SetPos (18, Xy);
        cout << "        ";
        SetPos (19, Xy);
        cout << "        ";
        SetPos (20, Xy);
        cout << "       ";
    }
    if (a == -1) {
        SetPos (17, Xy);
        cout << "        ";
        SetPos (18, Xy);
        cout << "  ┃  ┃";
        SetPos (19, Xy);
        cout << "  ╰┳╯";
        SetPos (20, Xy);
        cout << "     ▏";
    }
    if (a == 0) {
        SetPos (18, Xy);
        cout << "  ┃";
        Color (What + 10);
        cout << "●";
        Color (5);
        cout << "┃";
        SetPos (19, Xy);
        cout << "  ╰┳╯";
        SetPos (20, Xy);
        cout << "     ▏";
    }
    if (a == 1) {
        SetPos (18, Xy);
        cout << "  ";
        Color (What + 10);
        cout << "●";
        Color (5);
        cout << "  ┃";
        SetPos (19, Xy);
        cout << "  ╰┳╯";
        SetPos (20, Xy);
        cout << "     ▏";
    }
    if (a == 2) {
        SetPos (18, Xy);
        Color (What + 10);
        cout << "●";
        Color (5);
        cout << "┃  ┃";
        SetPos (19, Xy);
        cout << "  ╰┳╯";
        SetPos (20, Xy);
        cout << "     ▏";
    }
    if (a == 3) {
        SetPos (18, Xy);
        cout << "  ┃  ┃";
        SetPos (19, Xy);
        Color (What + 10);
        cout << "●";
        Color (5);
        cout << "╰┳╯";
        SetPos (20, Xy);
        cout << "     ▏";
    }
    if (a == 4) {
        SetPos (18, Xy);
        cout << "  ┃  ┃";
        SetPos (19, Xy);
        cout << "  ╰┳╯";
        SetPos (20, Xy);
        Color (What + 10);
        cout << "●";
        Color (5);
        cout << "   ▏";
    }
    if (a == 5) {
        SetPos (18, Xy);
        cout << "  ┃  ┃";
        SetPos (19, Xy);
        cout << "  ╰┳╯";
        SetPos (20, Xy);
        cout << "  ";
        Color (What + 10);
        cout << "●";
        Color (5);
        cout << " ▏";
    }
    if (a == 6) {
        SetPos (18, Xy);
        cout << "  ┃  ┃";
        SetPos (19, Xy);
        cout << "  ╰┳╯";
        SetPos (20, Xy);
        cout << "    ";
        Color (What + 10);
        cout << "●";
        Color (5);
        cout << " ";
    }
    Color (0);
}
void Start () {
    char g;
    Color (5);
    system ("cls");
    SetPos (1, 1);
    cout << "------- 愤 怒 的 小 鸟 -------";
    Color (0);
    SetPos (3, 1);
    cout << "空格瞄准,按X触发小鸟技能,←→移动弹弓";
    SetPos (5, 1);
    cout << "猪猪技能自动触发,空中会有墙出现。";
    SetPos (7, 1);
    cout << "危险值由命中率,猪的存活时间计算!";
    SetPos (9, 1);
    cout << "危险值点满后失败!1500分通关!";
    SetPos (1, 20);
    cout << "-------- 小 鸟 技 能 --------";
    SetPos (3, 20);
    Color (11);
    cout << "●";
    Color (0);
    cout << ":无技能";
    SetPos (5, 20);
    Color (12);
    cout << "●";
    Color (0);
    cout << ":分身!不同分身初速度大小相同,";
    SetPos(6,20);cout<<"        方向不同。";
    SetPos (7, 20);
    Color (13);
    cout << "●";
    Color (0);
    cout << ":加速!以当前速度做匀速直线运动,";
    SetPos (8, 20);
    cout << "          且免疫狙击猪的冲击。";
    SetPos (9, 20);
    Color (14);
    cout << "●";
    Color (0);
    cout << ":投蛋!并获得向上速度做匀速直线";
    SetPos (10, 20);
    cout << "          运动,快达可以穿墙。";
    SetPos (11, 20);
    Color (15);
    cout << "●";
    Color (0);
    cout << ":爆炸!";
    SetPos (13, 20);
    Color (16);
    cout << "●";
    Color (0);
    cout << ":回旋!开始做向左加速运动!发射";
    SetPos (14, 20);
    cout << "          时获得双倍水平速度。";
    SetPos (15, 20);
    Color (17);
    cout << "●";
    Color (0);
    cout << ":[被动] 弹跳力为普通鸟三倍。发射";
    SetPos (16, 20);
    cout << "          时获得1.5倍水平、竖直速度。";
    SetPos (11, 1);
    cout << "-------- 猪 猪 技 能 --------";
    SetPos (13, 2);
    Color (2);
    cout << "●";
    Color (0);
    cout << ":无技能";
    SetPos (14, 1);
    Color (8);
    cout << "▁▅";
    SetPos (15, 2);
    Color (2);
    cout << "●";
    Color (0);
    cout << ":防御力为普通猪三倍";
    SetPos (16, 2);
    cout << "○";
    SetPos (17, 2);
    cout << "│:做空中简谐运动,受死范围";
    SetPos (18, 2);
    Color (2);
    cout << "●";
    Color (0);
    cout << "  为普通猪两倍。";
    SetPos (19, 2);
    cout << "    有几率跳起或发射冲击波,冲";
    SetPos (20, 1);
    Color (2);
    cout << "﹃●";
    Color (0);
    cout << ":开小鸟与同类,可以引爆TNT!";
    SetPos (18, 20);
    Color (5);
    cout << "按 y 开始游戏!";
A:
    if (kbhit ()) {
        g = _getch ();
    }
    if(g != 'y') {
        goto A;
    }
}
int main () {
    system ("mode con cols=79 lines=22");
    CONSOLE_CURSOR_INFO cursor_info = {1, 0};
    SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cursor_info);
    srand ((unsigned)time(NULL));
    St:Start ();
    system ("cls");
    memset (blt, 0, sizeof (blt));
    memset (pig, 0, sizeof (pig));
    memset (boo, 0, sizeof (boo));
    memset (m, 0, sizeof (m));
    T = put = K = K2 = Sle = What = Pig = Sco = 0;
    pigk = scok = -1;
    Xy = 4;
    yX = 18;
    yY = 6;
    Blt = 20;
    Bot = 20;
    Pit = 60;
    Color (7);
    SetPos (19, 14);
    cout << "■";
    SetPos (20, 13);
    cout << " █▍";
    m[19][14] = m[20][13] = m[20][14] = 1;
    SetPos (21, 0);
    for (int i = 0; i < 39; i++) {
        cout << "■";
        m[21][i] = 1;
    }
    Color (0);
    What = rand () % 5 + 1;
    while (1) {
        if (Sco >= 1500) {
            break;
        }
        T++;
        K = 0;
        Color (0);
        if (Sco != scok) {
            SetPos (1, 1);
            cout << "分数:" << Sco << ' ';
        }
        if (Pig != pigk) {
            SetPos (3, 1);
            cout << "危险值:";
            int aa = min (Sco / 100, 10);
            Pig += aa;
            SetPos (3, 5);
            if (Pig <= 2) {
                Color (2);
            } else if (Pig <= 4) {
                Color (16);
            } else if (Pig <= 6) {
                Color (7);
            } else if (Pig <= 9) {
                Color (6);
            } else if (Pig <= 12) {
                Color (3);
            } else if (Pig <= 15) {
                Color (17);
            } else {
                Color (11);
            }
            for (int i = 1; i <= Pig; i++) {
                cout << "■";
            }
            Color (0);
            cout << ' ' << Pig;
            for (int i = 1; i <= 5; i++) {
                cout << "  ";
            }
            if (Pig > 18) {
                break;
            }
            Pig -= aa;
        }
        scok = Sco;
        pigk = Pig;
        if (GetAsyncKeyState (VK_LEFT)&0x8000 && Xy > 0) {
            Move (-2);
            Xy--;
            K = 1;
        }
        if (GetAsyncKeyState (VK_RIGHT)&0x8000 && Xy < 10) {
            Move (-2);
            Xy++;
            K = 1;
        }
        if (K == 1) {
            if (put == 0 && Sle == 0) {
                Move (0);
            } else {
                Move (-1);
            }
        }
        if (kbhit ()) {
            char g = _getch ();
            if (g == 'x' || g == 'X') {
                for (int i = Blt - 10; i <= Blt; i++) {
                    if (blt[i].go == 0 && blt[i].boom == 0 && blt[i].W != 1 && blt[i].W != 7) {
                        blt[i].boom = 1;
                        if (blt[i].W == 2) {
                            Blt++;
                            blt[Blt].W = 2;
                            blt[Blt].vy = blt[i].vy * 1.2;
                            blt[Blt].vx = blt[i].vx + 1;
                            blt[Blt].ax = blt[i].ax;
                            blt[Blt].X = blt[i].X;
                            blt[Blt].Y = blt[i].Y;
                            blt[Blt].boom = 1;
                            Blt++;
                            blt[Blt].W = 2;
                            blt[Blt].vy = blt[i].vy * 0.7;
                            blt[Blt].vx = blt[i].vx - 1;
                            blt[Blt].ax = blt[i].ax;
                            blt[Blt].X = blt[i].X;
                            blt[Blt].Y = blt[i].Y;
                            blt[Blt].boom = 1;
                        }
                        if (blt[i].W == 3) {
                            blt[i].vy = fmax (blt[i].vy * 1.5, 2.5);
                            blt[Blt].vx++;
                            blt[i].ax = 0;
                        }
                        if (blt[i].W == 4) {
                            blt[i].vx = -3;
                            blt[i].ax = 0.1;
                            Blt++;
                            blt[Blt].boom = 1;
                            blt[Blt].W = 10;
                            blt[Blt].X = blt[i].X;
                            blt[Blt].Y = blt[i].Y;
                            blt[Blt].ax = blt[i].ax;
                            blt[Blt].vx = 1;
                        }
                        if (blt[i].W == 5) {
                            Bot++;
                            boo[Bot].X = blt[i].X;
                            boo[Bot].Y = blt[i].Y;
                            boo[Bot].S = 1;
                            boo[Bot].mS = 5;
                            blt[i].go = 1;
                        }
                        if (blt[i].W == 6) {
                            blt[i].ay = -1;
                            blt[i].ax = 0.3;
                            blt[i].vx = min (blt[i].vx / 2, (float)0);
                        }
                        break;
                    }
                }
            }
        }
        if (GetAsyncKeyState (' ')&0x8000 && K == 0 && Sle == 0) {
            if (put <= 5) {
                Move (1);
                yX = 18;
                yY = Xy + 1;
            } else if (put <= 20) {
                Move (2);
                yX = 18;
                yY = Xy;
            } else if (put <= 40) {
                Move (3);
                yX = 19;
                yY = Xy;
            } else if (put <= 60) {
                Move (4);
                yX = 20;
                yY = Xy;
            } else if (put <= 80) {
                Move (5);
                yX = 20;
                yY = Xy + 1;
            } else {
                Move (6);
                yX = 20;
                yY = Xy + 2;
            }
            if (put == 0) {
                K2 = 1;
            }
            if (put == 90) {
                K2 = -1;
            }
            if (K2 == 1) {
                put += min (rand () % 7 + 1, 90 - put);
            }
            if (K2 == -1) {
                put-=min(rand()%7+1,put);
            }
            Cout (1, 17, Xy + 2);
        }
        if ((!(GetAsyncKeyState (' ')&0x8000) && (put != 0)) || (put != 0 && K == 1)) {
            Move (-1);
            Creat (1, put);
            put = 0;
            yX = 18;
            yY = 5;
            Sle = 1;
            What = rand () % 7 + 1;
            Creat (-1, -1);
            Sco = max (Sco - 5, 0);
        }
        for (int i = Blt - 10; i <= Blt; i++) {
            if (blt[i].go == 0) {
                Go (i);
            }
        }
        for (int i = Bot - 10; i <= Bot; i++) {
            if (boo[i].go == 0) {
                Boom (i);
                Cout (2, 0, 0);
            }
        }
        for (int i = Pit - 50; i <= Pit; i++) {
            if (pig[i].go == 0) {
                Kill (i);
            }
        }
        if (Sle != 0) {
            Move (-1);
        } else if (put == 0) {
            Move (0);
        }
        if (T % 300 == 0) {
            system ("cls");
            pigk = scok = -1;
        }
        if (T % 100 == 0) {
            Color (7);
            for (int i = 0; i <= 18; i++) {
                for (int j = 0; j <= 40; j++) {
                    if (m[i][j] == 1 && T % 100 == 0) {
                        SetPos (i, j);
                        cout << "■";
                    }
                }
            }
            SetPos (19, 14);
            cout << "■";
            SetPos (20, 13);
            cout <<" █▍";
            SetPos (21, 0);
            for (int i = 0; i < 39; i++) {
                cout << "■";
                Color (0);
            }
        }
        if (T % min (50, (2000 - Sco) / 30) == 0) {
            Pig++;
            Creat (0, -1);
        }
        Sleep (15);
    }
    if (Sco < 500) {
        if (MessageBox (NULL, "很遗憾,您输了,您还想再来一次吗?", "温馨提示", MB_YESNO) == IDYES) {
            goto St;
        } else {
            return 0;
        }
    } else {
        if (MessageBox (NULL, "恭喜您赢了!您还想再来一次吗?", "温馨提示", MB_YESNO) == IDYES) {
            goto St;
        } else {
            return 0;
        }
    }
    return 0;
}

数字炸弹

C
#include<iostream>
#include<ctime>
#include<windows.h>
using namespace std;
int main()
{
int a=0,c,d=100,x=1,jb=100000000,n;
long long tsy=100000000,czzd=100000000,fh=100000000;
int b;
cout<<" 请输入密码(密码是 !@#$%^&*.,njn200134udbudsudsbfy3843uerueijshnsjs2i9x)"<<endl;
cin>>a;
if(a==200134)
{
cout<<" 游戏名:数字炸弹"<<endl;
cout<<" 游戏规则:随机生成两个炸弹,一个炸玩家,可以被透视眼侦察到,中了这个炸弹你就输了,一个炸电脑,不可被透视眼侦察到,但中了这个炸弹你就赢了,具体操作会有显示"<<endl;
cout<<" 输了也可以获得10金币"<<endl;
cout<<" 每赢一局就获得50金币,金币可以买道具哦"<<endl;
cout<<" 温馨提示:此游戏没有存档记录,关闭之后存档就会重置!"<<endl<<endl<<endl;
for(;;)
{
srand(time(0));
c=rand()%100;
cout<<" ----------------------*你需要做什么*-----------------------"<<endl;
cout<<" |输入1进入游戏,输入2查看账号,输入3进入商店,输入4退出游戏|"<<endl;
cout<<" -----------------------------------------------------------"<<endl;
cin>>n;
if(n==1)
{
cout<<"数字炸弹开始!!!"<<endl;b=1;
for(;;)
{
cout<<x<<'~'<<d<<endl;
cout<<"输入1输入数字,输入2使用道具"<<endl;
cin>>n;
if(n==1)
{
cout<<"请输入"<<x<<'~'<<d<<"的数 "<<endl;
cin>>b;
}
if(n==2)
{
cout<<"您有透视眼"<<tsy<<endl;
cout<<"您有重置炸弹"<<czzd<<endl;
cout<<"您有时空机"<<fh<<endl;
cout<<"输入1使用透视眼,输入2使用重置炸弹,输入0使用时空机,输入3退出"<<endl;
cin>>n;
if(n==1)
{
if(tsy>0)
{
cout<<"请输入要透视的数"<<endl;
cin>>n;
if(n==c)
{
cout<<n<<"是炸弹"<<endl;tsy--;
}
else
cout<<n<<"不是炸弹"<<endl;tsy--;
}
else
{
cout<<"您没有透视眼"<<endl;
}
}
if(n==2)
{
if(czzd>0)
{
srand(time(0));
c=rand()%100;
cout<<"炸弹已重置"<<endl;
czzd--;
x=1;d=100;
}
else
{
cout<<"您没有重置炸弹"<<endl;
}
}
if(n==0)
{
if(fh>0)
{
srand(time(0));
c=rand()%100;
cout<<"时空穿梭!"<<endl;
fh--;
srand(time(0));
x=c-rand()%10;d=c+rand()%10;
x--;d++;
}
else
cout<<"您没有时空机"<<endl;
}
}
if(n==1)
if(b==c)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你炸了!!!"<<endl;
jb+=10;
break;
}
if(b<=x||b>=d)
{
cout<<"请输入任意数字继续。"<<endl;
cin>>b;
}
if(b<d&&b>c)
{
d=b;
cout<<"请继续输入"<<endl;
}
if(b>x&&b<c)
{
x=b;
cout<<"请继续输入"<<endl;
}
if(x+1==c&&d-1==c)
{
cout<<"电脑炸了,你赢了!!! "<<endl;
jb+=50;
break;
}
}
}
if(n==2)
{
cout<<"您现在有"<<jb<<"金币"<<endl;
cout<<"您现在有"<<tsy<<"透视眼"<<endl;
cout<<"您现在有"<<czzd<<"重置炸弹"<<endl;
cout<<"您现在有"<<fh<<"时光机"<<endl;
}
if(n==3)
{
cout<<" 商店"<<endl;
cout<<" 您现在有"<<jb<<"金币 "<<endl;
cout<<" 输入1购买透视眼(100金币),输入2购买重置炸弹(150金币),输入0购买时空机(200金币),输入3退出"<<endl;
cout<<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~清仓大甩卖~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cin>>n;
if(n==1)
{
if(jb>=100)
{
tsy++;jb-=0;
cout<<"您购买了1透视眼,您现在有"<<tsy<<"个透视眼";
}
else
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币"<<endl;
}
if(n==2)
{
if(jb>=150)
{
czzd++;jb-=0;
cout<<"您购买了1重置炸弹,您现在有"<<czzd<<"个重置炸弹";
}
else
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币"<<endl;
}
if(n==0)
{
if(jb>=200)
{
fh++;jb-=0;
cout<<"您购买了1时光机,您现在有"<<fh<<"个时光机";
}
else
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币"<<endl;
}
}
if(n==4)
{
break;
}
cout<<"请问继续吗?(输入1继续,输入0退出)"<<endl;
cin>>b;
if(b==0)
{
break;
}
d=100;
x=1;
}
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"密码错误";
}
return 0;
}
C
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,m,k,x,y,s=0;
	int f[100000]={0},f1[100000]={0};
	cin>>n>>m>>k;
	for(int i=0;i<k;i++){
		cin>>x>>y;
		f[x]++;
		f1[y]++;
		if(f[x]==1&&f1[y]==1) s=s+n+m-1-i*2;
		else if(f[x]==1) s+=n-1;
		else if(f1[y]==1) s+=m-1;
	}
	cout<<s;
	return 0;
}

小游戏(网页)

MC(密码:pcl2)

植物大战僵尸

大战僵尸

贪吃蛇

僵尸拆迁队

坦克动荡2

MC(新,无密码)

以下是AC图

ac

原文