#include<bits/stdc++.h>
#include<windows.h>
#include <conio.h>
using namespace std;
const int Frame_rate=30;
//====================功能函数区==============================//
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
POINT p;
HWND h=GetForegroundWindow();
void gotoxy(short x, short y) {
COORD pos = {x,y};
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOut, pos);
return ;
}
bool checkmouse(int x1,int y1,int x2,int y2) {
if(KEY_DOWN(VK_LBUTTON)) {
POINT p;
GetCursorPos(&p);
ScreenToClient(h,&p);
// cout << p.x << ' ' << p.y << " ";
if(p.x>=x1 && p.x<=x2 && p.y>=y1 && p.y<=y2)
return true;
}
return false;
}
void hidecursor() {
CONSOLE_CURSOR_INFO cursor;
cursor.bVisible = 0;
cursor.dwSize = 1;
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorInfo(hOut, &cursor);
}
//=============================================================//
struct Node {
string name,skill_1st_name,skill_1st_describe,skill_2nd_name,skill_2nd_describe,skill_big_name,skill_big_describe;
int HP;
}Player[50];
void init() {
Player[1].name="张欣";
Player[1].skill_1st_name="尥尥蹶子";
Player[1].skill_1st_describe="有点缺钙,尥一尥蹶子——下一回合对方任一角色受到的伤害翻倍";
Player[1].skill_2nd_name="保持安静";
Player[1].skill_2nd_describe="嘘……——下一回合对方随机角色无法使用技能";
Player[1].skill_big_name="上台讲题";
Player[1].skill_big_describe="王甲鱼,上!——下一回合对方全体角色无法使用技能";
Player[2].name="赵华";
Player[2].skill_1st_name="破脊";
Player[2].skill_1st_describe="破脊者——对方任一角色受到己方所有角色总HP的20%";
Player[2].skill_2nd_name="每日寄语";
Player[2].skill_2nd_describe="今天的每日寄语是……——己方所有角色获得鼓舞,攻击力+20%";
Player[2].skill_big_name="步许趣盐穴";
Player[2].skill_big_describe="不许去研学!——全体角色攻击力-30%(持续两个回合)";
Player[3].name="徐忠成";
Player[3].skill_1st_name="恶臭代码";
Player[3].skill_1st_describe="恶臭!!——对方任意角色有30%的概率眩晕一回合";
Player[3].skill_2nd_name="多做点题(被动)";
Player[3].skill_2nd_describe="获得Dev-C++护身——受到的伤害减免25%";
Player[3].skill_big_name="你不会在玩手 机吧?";
Player[3].skill_big_describe="突击抽查手机——没收对方任一角色手机,则对方本回合内无法回血";
Player[4].name="黄晓宇";
Player[4].skill_1st_name="xxxx";
Player[4].skill_1st_describe="xxxxxxxx";
Player[4].skill_2nd_name="xxxx";
Player[4].skill_2nd_describe="xxxxxxxx";
Player[4].skill_big_name="xxxx";
Player[4].skill_big_describe="xxxxxxxx";
}
void Warning(string s) {
gotoxy(22,9); cout << "+------------Warning-----------+";
gotoxy(22,10); cout << "| |";
gotoxy(22,11); cout << "| |";
gotoxy(22,12); cout << "| |";
gotoxy(22,13); cout << "+------------------------------+";
gotoxy(22+(30-s.size())/2,11); cout << s;
Sleep(1000);
system("cls");
}
void choose() {
system("cls");
int cnt=1,sum=0; bool choice[50]; memset(choice,false,sizeof(choice));
while(true) {
gotoxy(73,4); cout << "+--+";
gotoxy(73,5); cout << "|"; if(choice[cnt]) cout << "√"; else cout << " "; cout << "|";
gotoxy(73,6); cout << "+--+";
gotoxy(0,0);
cout << endl << " 请选择你的角色 开始游戏" << endl << endl << "--------------------------------------------------------------------------------";
cout << endl;
cout << " " << cnt << "." << Player[cnt].name; cout << endl << endl;
cout << " 一技能 : " << Player[cnt].skill_1st_name << endl << endl;
cout << " 技能描述 : " << Player[cnt].skill_1st_describe << endl << endl;
cout << endl;
cout << " 二技能 : " << Player[cnt].skill_2nd_name << endl << endl;
cout << " 技能描述 : " << Player[cnt].skill_2nd_describe << endl << endl;
cout << endl;
cout << " 大招 : " << Player[cnt].skill_big_name << endl << endl;
cout << " 技能描述 : " << Player[cnt].skill_big_describe << endl << endl;
cout << endl;
if(cnt!=1) cout << " <<<上一页";
else cout << " ";
cout << " ";
if(cnt!=4) cout << "下一页>>>";
else cout << " ";
if(checkmouse(25,355,91,366) && cnt!=1) {cnt--; Sleep(200); system("cls");}
if(checkmouse(545,355,614,366) && cnt!=4) {cnt++; Sleep(200); system("cls");}
if(checkmouse(588,69,612,102)) {if(choice[cnt]) sum--,choice[cnt]=!choice[cnt]; else {if(sum!=3) sum++,choice[cnt]=!choice[cnt]; else Warning("最多可选三位角色");} Sleep(100);}
Sleep(1000/Frame_rate);
}
}
void Home() {
cout << endl << " 十二叫尸 V1.01 wsy出品,必是精品" << endl << endl << "--------------------------------------------------------------------------------";
cout << endl << endl;
cout << " --------------" << endl;
cout << " | |" << endl;
cout << " | 人机对战 |" << endl;
cout << " | |" << endl;
cout << " --------------" << endl;
cout << endl << endl << endl;
cout << " --------------" << endl;
cout << " | |" << endl;
cout << " | 真人对战 |" << endl;
cout << " | (未完成) |" << endl;
cout << " --------------" << endl;
}
void PVC() {
choose();
}
int main() {
system("mode con cols=80 lines=24");
system("title 十二叫尸 V1.01");
hidecursor();
init();
while(true) {
gotoxy(0,0);
Home();
Sleep(1000/Frame_rate);
if(checkmouse(51,106,156,166)) {
PVC();
}
}
return 0;
}
帮我完善真人对战,人机对战不要了
最新发布