前言
if(有人点赞){
while(true){
蒟蒻开心!
}
}
累了,水一期~~。
代码
在篇3的基础上改了改,更加爽~
#include<bits/stdc++.h>
#include<conio.h>
#include<windows.h>
using namespace std;
int Chang[21][36],DSa,DSb,TU,Wina,Winb,Huihe;
double Jieshu;
struct ren{
int Xue,Gong,X,Y,Fang,Ji,Shang,Dan;//方向1←2→
double CD,Huan;
double Jin,Mu,Shui,Huo,Tu;
bool Tiao,Chong,Ju,San,Yuan,Hui;
}A,B;
struct Dan{
int X,Y,Fang,F;//方向1↖2←3↙4↗5→6↘
}a[114514],b[114514];
void S(int ForgC, int BackC) {
WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
}
void G(int x,int y){
COORD pos={x,y};
HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOut,pos);
return;
}
void HC(){
CONSOLE_CURSOR_INFO cur={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cur);
}
void SC(){
CONSOLE_CURSOR_INFO cur={1,1};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cur);
}
int find_Dana(int x,int y){
for(int i=1;i<=DSa;i++){
if(a[i].X==x&&a[i].Y==y)return a[i].Fang;
}
return 0;
}
int find_Dana2(int x,int y){
for(int i=1;i<=DSa;i++){
if(a[i].X==x&&a[i].Y==y)return i;
}
return 0;
}
int find_Danb(int x,int y){
for(int i=1;i<=DSb;i++)if(b[i].X==x&&b[i].Y==y)return b[i].Fang;
return 0;
}
int find_Danb2(int x,int y){
for(int i=1;i<=DSb;i++)if(b[i].X==x&&b[i].Y==y)return i;
return 0;
}
void kuang(int y,int x,int a,int b){
int X=x,Y=y;
if(a>b)a=b;
if(a<0)a=0;
if(b<0)b=0;
S(15,0);
G(x,y);
for(int i=1;i<=3;i++){
for(int j=1;j<=12;j++){
if(i==1&&j==1)cout<<"┍";
else if(i==1&&j==12)cout<<"┑";
else if(i==3&&j==1)cout<<"┕";
else if(i==3&&j==12)cout<<"┙";
else if(i==1||i==3)cout<<"┅";
else if(j==1||j==12)cout<<"┆";
else cout<<" ";
}
G(X,++Y);
}
G(x+1,y+1);
for(int i=1;i<=a/(b/10)+1;i++){
if(a/(b/10)<=3)S(12,0);
else S(11,0);
if(a/(b/10)+1==i){
if(a%(b/10)<=b/10/5)cout<<" ";
else if(a%(b/10)<=b/10/5*2)cout<<"▎";
else if(a%(b/10)<=b/10/5*3)cout<<"▍";
else cout<<"▋";
}else cout<<"▉";
S(15,0);
}
G(x,y+3);
if(a/(b/10)<=3)S(12,0);
else S(11,0);
cout<<a<<" "<<endl;
S(15,0);
}
void js(){
system("cls");
cout<<"手搓工坊";Sleep(500);S(12,0);cout<<"首款";Sleep(500);S(9,0);cout<<"1V1跳台射击小游戏\n";S(15,0);Sleep(500);
cout<<" --1.1正式版"<<endl;Sleep(1000);
cout<<" --更新日历"<<endl;
cout<<" --正式版上线"<<endl;
cout<<" --新增1个地图"<<endl;
cout<<" --不会再永久重复对局"<<endl;
cout<<" --调整射速、弹夹容量、装弹时间等属性,更加偏向弹幕游戏"<<endl;
cout<<" --修复一些小问题(如:御弹飞行)"<<endl;
cout<<" 操作方案:\n";Sleep(1500);
S(12,0);cout<<"玩家A:\n";
cout<<"W 跳 S跳下 A D 左右 \n[空格] 开火 X 换弹\n";
Sleep(1000);
S(9,0);cout<<"玩家B:\n";
cout<<"↑跳 ↓跳下←→左右 \n小键盘0 开火 小键盘1 换弹\n";
S(15,0);
cout<<" \n按空格返回";
Sleep(150);
while(!(GetAsyncKeyState(VK_SPACE)))continue;
}
int tu(){
int i=1;
system("cls");
S(15,0);
while(true){
G(0,0);
cout<<" 请选择地图"<<endl;
cout<<" 按回车确定"<<endl;
cout<<" ↑↓选择"<<endl;
if(i==1)S(10,0);
cout<<"┍1 ━━━━━┑"<<endl;
cout<<"┃ __ ┃"<<endl;
cout<<"┃ __ __ ┃"<<endl;
cout<<"┃ __ ┃"<<endl;
cout<<"┕━━━━━━┙"<<endl;
S(15,0);
if(i==2)S(10,0);
cout<<"┍2 ━━━━━┑"<<endl;
cout<<"┃ __ ┃"<<endl;
cout<<"┃ __________ ┃"<<endl;
cout<<"┃ __ __ ┃"<<endl;
cout<<"┕━━━━━━┙"<<endl;
S(15,0);
if(i==3)S(10,0);
cout<<"┍3 ━━━━━┑"<<endl;
cout<<"┃ __ ┃"<<endl;
cout<<"┃ __ ┃"<<endl;
cout<<"┃____________┃"<<endl;
cout<<"┕━━━━━━┙"<<endl;
S(15,0);
if(i==4)S(10,0);
cout<<"┍4 ━━━━━┑"<<endl;
cout<<"┃ ____ ┃"<<endl;
cout<<"┃__ |__| __┃"<<endl;
cout<<"┃____|__|____┃"<<endl;
cout<<"┕━━━━━━┙"<<endl;
S(15,0);
if(GetAsyncKeyState(VK_RETURN)){
return i;
}
if(GetAsyncKeyState(VK_UP)){
i--;
if(i<1)i=4;
}
if(GetAsyncKeyState(VK_DOWN)){
i++;
if(i>4)i=1;
}
Sleep(100);
}
}
int kt(){
system("cls");
S(11,0);
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n 洛谷手搓工坊欢迎您!");
printf("\n 作者:淦惪蒸蚌");
printf("\n 网址:luogu.com.cn/team/79951\n\n");
S(15,0);
printf("\n\n ┍┅┅┅┅┅┅┅┅┅┅┑\n");
printf(" ┆ 1 开始游戏 ┆\n");
printf(" ┆┅┅┅┅┅┅┅┅┅┅┆\n");
printf(" ┆ 2 游戏介绍 ┆\n");
printf(" ┆┅┅┅┅┅┅┅┅┅┅┆\n");
printf(" ┆ 3 退出游戏 ┆\n");
printf(" ┕┅┅┅┅┅┅┅┅┅┅┙\n ");
char ch;
ch=_getch();
if(ch=='1'){
system("cls");
cout<<"稍等...";
Sleep(1500);
return tu();
}else if(ch=='2'){
js();
return kt();
}else if(ch=='3'){
return 0;
}else{
cout<<"正确输入,快乐游玩";
Sleep(1500);
return kt();
}
}
void UP(){
while(A.Ji>=100){
system("cls");
cout<<endl<<endl;
if(A.Chong&&A.Ju&&A.San&&A.Yuan&&A.Hui){
S(12,0);
cout<<" 满级\n";
S(15,0);
Sleep(1000);
break;
}
S(12,0);
cout<<" !升级!\n";
S(15,0);
Sleep(1000);
while(true){
int shuxin=rand()%5+1;
if(shuxin==1){
if(A.Chong==false){
cout<<" ┍━━━━━┑\n";
cout<<" ┃ 速射 ┃\n";
cout<<" ┃ ^ ^ ^ ┃\n";
cout<<" ┃| || || | ┃\n";
cout<<" ┃|_||_||_| ┃\n";
cout<<" ┃ ┃\n";
cout<<" ┕━━━━━┙\n";
A.Ji-=100;
A.Chong=true;
Sleep(3000);
break;
}else continue;
}else if(shuxin==2){
if(A.Ju==false){
cout<<" ┍━━━━━┑\n";
cout<<" ┃ 伤害 ┃\n";
cout<<" ┃ ^ + ┃\n";
cout<<" ┃ | | ┃\n";
cout<<" ┃ |_| ┃\n";
cout<<" ┃ ┃\n";
cout<<" ┕━━━━━┙\n";
A.Ji-=100;
A.Ju=true;
Sleep(3000);
break;
}else continue;
}else if(shuxin==3){
if(A.San==false){
cout<<" ┍━━━━━┑\n";
cout<<" ┃ 散射 ┃\n";
cout<<" ┃ ^ ┃\n";
cout<<" ┃ ^ | ^ ┃\n";
cout<<" ┃ \\ / ┃\n";
cout<<" ┃ ┃\n";
cout<<" ┕━━━━━┙\n";
A.Ji-=100;
A.San=true;
Sleep(3000);
break;
}else continue;
}else if(shuxin==4){
if(A.Yuan==false){
cout<<" ┍━━━━━┑\n";
cout<<" ┃ 元素 ┃\n";
cout<<" ┃ * ┃\n";
cout<<" ┃ ---- * ┃\n";
cout<<" ┃ |?| ┃\n";
cout<<" ┃ * ---- ┃\n";
cout<<" ┕━━━━━┙\n";
A.Ji-=100;
A.Yuan=true;
Sleep(3000);
break;
}else continue;
}else if(shuxin==5){
if(A.Hui==false){
cout<<" ┍━━━━━┑\n";
cout<<" ┃ 攻击回复 ┃\n";
cout<<" ┃ ┃\n";
cout<<" ┃ | + ┃\n";
cout<<" ┃ + | | ┃\n";
cout<<" ┃ +| ┃\n";
cout<<" ┕━━━━━┙\n";
A.Ji-=100;
A.Hui=true;
Sleep(3000);
break;
}else continue;
}
}
}
while(B.Ji>=100){
system("cls");
cout<<endl<<endl;
if(B.Chong&&B.Ju&&B.San&&B.Yuan&&B.Hui){
S(9,0);
cout<<" 满级\n";
S(15,0);
Sleep(1000);
break;
}
S(9,0);
cout<<" !升级!\n";
S(15,0);
Sleep(1000);
while(true){
int shuxin=rand()%5+1;
if(shuxin==1){
if(B.Chong==false){
cout<<" ┍━━━━━┑\n";
cout<<" ┃ 速射 ┃\n";
cout<<" ┃ ^ ^ ^ ┃\n";
cout<<" ┃| || || | ┃\n";
cout<<" ┃|_||_||_| ┃\n";
cout<<" ┃ ┃\n";
cout<<" ┕━━━━━┙\n";
B.Ji-=100;
B.Chong=true;
Sleep(3000);
break;
}else continue;
}else if(shuxin==2){
if(B.Ju==false){
cout<<" ┍━━━━━┑\n";
cout<<" ┃ 伤害 ┃\n";
cout<<" ┃ ^ + ┃\n";
cout<<" ┃ | | ┃\n";
cout<<" ┃ |_| ┃\n";
cout<<" ┃ ┃\n";
cout<<" ┕━━━━━┙\n";
B.Ji-=100;
B.Ju=true;
Sleep(3000);
break;
}else continue;
}else if(shuxin==3){
if(B.San==false){
cout<<" ┍━━━━━┑\n";
cout<<" ┃ 散射 ┃\n";
cout<<" ┃ ^ ┃\n";
cout<<" ┃ ^ | ^ ┃\n";
cout<<" ┃ \\ / ┃\n";
cout<<" ┃ ┃\n";
cout<<" ┕━━━━━┙\n";
B.Ji-=100;
B.San=true;
Sleep(3000);
break;
}else continue;
}else if(shuxin==4){
if(B.Yuan==false){
cout<<" ┍━━━━━┑\n";
cout<<" ┃ 元素 ┃\n";
cout<<" ┃ * ┃\n";
cout<<" ┃ ---- * ┃\n";
cout<<" ┃ |?| ┃\n";
cout<<" ┃ * ---- ┃\n";
cout<<" ┕━━━━━┙\n";
B.Ji-=100;
B.Yuan=true;
Sleep(3000);
break;
}else continue;
}else if(shuxin==5){
if(B.Hui==false){
cout<<" ┍━━━━━┑\n";
cout<<" ┃ 攻击回复 ┃\n";
cout<<" ┃ ┃\n";
cout<<" ┃ | + ┃\n";
cout<<" ┃ + | | ┃\n";
cout<<" ┃ +| ┃\n";
cout<<" ┕━━━━━┙\n";
B.Ji-=100;
B.Hui=true;
Sleep(3000);
break;
}else continue;
}
}
}
}
int zc(){
system("cls");
Sleep(3000);
cout<<"\n\n\n\n\n 结束!\n";
if(A.Xue<=0&&B.Xue<=0){
S(10,0);
Sleep(1500);
cout<<" 平局\n";
Wina+=1;
Winb+=1;
A.Ji+=100;
B.Ji+=100;
S(15,0);
}else if(B.Xue<=0){
S(12,0);
Sleep(1500);
cout<<" A获胜!\n";
Wina+=2;
A.Ji+=125;
B.Ji+=75;
S(15,0);
}else if(A.Xue<=0){
S(9,0);
Sleep(1500);
cout<<" B获胜!\n";
Winb+=2;
A.Ji+=75;
B.Ji+=125;
S(15,0);
}
cout<<" ";
system("pause");
Sleep(500);
if(Wina>=15||Winb>=15){
system("cls");
S(14,0);
string str=" 最后的结果已经出现,结果是. . .\n";
for(int i=0;i<=str.size()-1;i++){
cout<<str[i];
Sleep(100);
}
S(15,0);
Sleep(2000);
if(Wina>=15&&Winb>=15){
S(10,0);
cout<<" !平局!\n";
S(15,0);
Sleep(3000);
cout<<" ";
system("pause");
system("cls");
return 1;
}else if(Wina>=15){
S(12,0);
cout<<" !A获胜!\n";
S(15,0);
Sleep(3000);
cout<<" ";
system("pause");
system("cls");
return 2;
}else if(Winb>=15){
S(14,0);
cout<<" !B获胜!\n";
S(15,0);
Sleep(3000);
cout<<" ";
system("pause");
system("cls");
return 3;
}
}
return 0;
}
int play(){
//所有属性全部初始化初始化初始化!
system("cls");
UP();
system("cls");
Jieshu=1;
A.Xue=300;A.Gong=10;A.Huan=0.0;
A.Huo=0.0;A.Jin=0.0;A.Mu=0.0;A.Shui=0.0;A.Tu=0.0;
A.CD=0;A.Tiao=false;
A.X=3;A.Y=2;A.Fang=2;
DSa=0;A.Shang=0;
A.Dan=15+(A.Chong&&!(A.Ju||A.San)?10:(A.Chong?5:0));
B.Xue=300;B.Gong=10;B.Huan=0.0;
B.Huo=0.0;B.Jin=0.0;B.Mu=0.0;B.Shui=0.0;B.Tu=0.0;
B.CD=0;B.Tiao=false;
B.X=3;B.Y=34;B.Fang=1;
DSb=0;B.Shang=0;
B.Dan=15+(B.Chong&&!(B.Ju||B.San)?10:(B.Chong?5:0));
DSa=0;DSb=0;
while((A.Xue>0&&B.Xue>0)||Jieshu>0){
if(A.Xue<=0)A.Xue=0;
if(B.Xue<=0)B.Xue=0;
if(TU==1){
for(int i=1;i<=20;i++){
for(int j=1;j<=35;j++){
if(i==A.X&&j==A.Y)Chang[i][j]=3;
else if(i==B.X&&j==B.Y)Chang[i][j]=4;
else if(i==1||i==20||j==1||j==35)Chang[i][j]=1;
else if((i==5&&j>=16&&j<=20)||(i==10&&j>=4&&j<=8)||(i==10&&j<=32&&j>=28)||(i==15&&j>=16&&j<=20))Chang[i][j]=2;
else if(find_Dana(i,j)!=0&&a[find_Dana2(i,j)].F==true)Chang[i][j]=4+find_Dana(i,j);
else if(find_Danb(i,j)!=0&&b[find_Danb2(i,j)].F==true)Chang[i][j]=10+find_Danb(i,j);
else Chang[i][j]=0;
}
}
}else if(TU==2){
for(int i=1;i<=20;i++){
for(int j=1;j<=35;j++){
if(i==A.X&&j==A.Y)Chang[i][j]=3;
else if(i==B.X&&j==B.Y)Chang[i][j]=4;
else if(i==1||i==20||j==1||j==35)Chang[i][j]=1;
else if((i==5&&j>=16&&j<=20)||(i==10&&j>=5&&j<=31)||(i==15&&j<=7&&j>=3)||(i==15&&j>=29&&j<=33))Chang[i][j]=2;
else if(find_Dana(i,j)!=0&&a[find_Dana2(i,j)].F==true)Chang[i][j]=4+find_Dana(i,j);
else if(find_Danb(i,j)!=0&&b[find_Danb2(i,j)].F==true)Chang[i][j]=10+find_Danb(i,j);
else Chang[i][j]=0;
}
}
}else if(TU==3){
for(int i=1;i<=20;i++){
for(int j=1;j<=35;j++){
if(i==A.X&&j==A.Y)Chang[i][j]=3;
else if(i==B.X&&j==B.Y)Chang[i][j]=4;
else if(i==1||i==20||j==1||j==35)Chang[i][j]=1;
else if((i==5&&j>=16&&j<=20)||(i==10&&j>=16&&j<=20)||(i==15&&j<=34&&j>=2))Chang[i][j]=2;
else if(find_Dana(i,j)!=0&&a[find_Dana2(i,j)].F==true)Chang[i][j]=4+find_Dana(i,j);
else if(find_Danb(i,j)!=0&&b[find_Danb2(i,j)].F==true)Chang[i][j]=10+find_Danb(i,j);
else Chang[i][j]=0;
}
}
}else if(TU==4){
for(int i=1;i<=20;i++){
for(int j=1;j<=35;j++){
if(i==A.X&&j==A.Y)Chang[i][j]=3;
else if(i==B.X&&j==B.Y)Chang[i][j]=4;
else if(i==1||i==20||j==1||j==35||((j==16||j==20)&&i>5))Chang[i][j]=1;
else if((i==5&&j>=16&&j<=20)||(i==10&&j>=4&&j<=8)||(i==10&&j<=20&&j>=16)||(i==10&&j<=32&&j>=28)||(i==15&&j>=2&&j<=34))Chang[i][j]=2;
else if(find_Dana(i,j)!=0&&a[find_Dana2(i,j)].F==true)Chang[i][j]=4+find_Dana(i,j);
else if(find_Danb(i,j)!=0&&b[find_Danb2(i,j)].F==true)Chang[i][j]=10+find_Danb(i,j);
else Chang[i][j]=0;
}
}
}
for(int i=1;i<=20;i++){
for(int j=1;j<=35;j++){
if(Chang[i][j]==0){S(15,0);cout<<" ";S(15,0);}
else if(Chang[i][j]==1){S(15,0);cout<<"#";S(15,0);}
else if(Chang[i][j]==2){S(15,0);cout<<"_";S(15,0);}
else if(Chang[i][j]==3){S(12,0);cout<<"A";S(15,0);}
else if(Chang[i][j]==4){S(9,0);cout<<"B";S(15,0);}
else if(Chang[i][j]==5){S(12,0);cout<<"*";S(15,0);}
else if(Chang[i][j]==6){S(12,0);cout<<"*";S(15,0);}
else if(Chang[i][j]==7){S(12,0);cout<<"*";S(15,0);}
else if(Chang[i][j]==8){S(12,0);cout<<"*";S(15,0);}
else if(Chang[i][j]==9){S(12,0);cout<<"*";S(15,0);}
else if(Chang[i][j]==10){S(12,0);cout<<"*";S(15,0);}
else if(Chang[i][j]==11){S(9,0);cout<<"*";S(15,0);}
else if(Chang[i][j]==12){S(9,0);cout<<"*";S(15,0);}
else if(Chang[i][j]==13){S(9,0);cout<<"*";S(15,0);}
else if(Chang[i][j]==14){S(9,0);cout<<"*";S(15,0);}
else if(Chang[i][j]==15){S(9,0);cout<<"*";S(15,0);}
else if(Chang[i][j]==16){S(9,0);cout<<"*";S(15,0);}
}
cout<<endl;
}
G(2,20);
if(A.Jin!=0){
S(14,0);
cout<<"金";
printf("%.1lf ",A.Jin);
S(15,0);
}
if(A.Mu!=0){
S(15,0);
cout<<"木";
printf("%.1lf ",A.Mu);
S(15,0);
}
if(A.Shui!=0){
S(9,0);
cout<<"水";
printf("%.1lf ",A.Shui);
S(15,0);
}
if(A.Huo!=0){
S(12,0);
cout<<"火";
printf("%.1lf ",A.Huo);
S(15,0);
}
if(A.Tu!=0){
S(15,0);
cout<<"土";
printf("%.1lf ",A.Tu);
S(15,0);
}
cout<<" ";
kuang(21,2,A.Xue,300);
S(12,0);cout<<" "<<(A.Dan<=0?0:A.Dan)<<"/"<<15+(A.Chong&&!(A.Ju||A.San)?10:(A.Chong?5:0))<<" ";if(A.Huan!=-1)printf("装弹 %.1lf ",A.Huan);if(A.Huan==-1)printf(" %.1lf ",A.CD);S(15,0);
G(2,26);
if(B.Jin!=0){
S(14,0);
cout<<"金";
printf("%.1lf ",B.Jin);
S(15,0);
}
if(B.Mu!=0){
S(15,0);
cout<<"木";
printf("%.1lf ",B.Mu);
S(15,0);
}
if(B.Shui!=0){
S(9,0);
cout<<"水";
printf("%.1lf ",B.Shui);
S(15,0);
}
if(B.Huo!=0){
S(12,0);
cout<<"火";
printf("%.1lf ",B.Huo);
S(15,0);
}
if(B.Tu!=0){
S(15,0);
cout<<"土";
printf("%.1lf ",B.Tu);
S(15,0);
}
cout<<" ";
kuang(27,2,B.Xue,300);
S(9,0);cout<<" "<<(B.Dan<=0?0:B.Dan)<<"/"<<15+(B.Chong&&!(B.Ju||B.San)?10:(B.Chong?5:0));if(B.Huan!=-1)printf("装弹 %.1lf ",B.Huan);if(B.Huan==-1)printf(" %.1lf ",B.CD);S(15,0);
if(GetAsyncKeyState('A')){
if(Chang[A.X][A.Y-1]==0||Chang[A.X][A.Y-1]==2)A.Y--;
if(A.Y<=1)A.Y=2;
A.Fang=1;
}
if(GetAsyncKeyState('D')){
if(Chang[A.X][A.Y+1]==0||Chang[A.X][A.Y+1]==2)A.Y++;
if(A.Y>=35)A.Y=34;
A.Fang=2;
}
if(GetAsyncKeyState('W')){
if(A.Tiao){
if(A.Shui==0)A.Shang=7;
else A.Shang=4;
A.Tiao=false;
}
}
if(GetAsyncKeyState('S')){
if(Chang[A.X+1][A.Y]==2)A.X++;
}
if(GetAsyncKeyState('X')&&A.Dan!=10&&A.Huan==-1){
A.Dan=0;
A.CD=0.0;
A.Huan=4.0+A.Chong*2-(A.Ju||A.San);
}
if(GetAsyncKeyState(VK_SPACE)&&A.CD==0&&A.Dan>0){
if(A.Fang==1&&A.Y>2){
DSa++;
a[DSa].X=A.X;a[DSa].Y=A.Y;a[DSa].Fang=2;a[DSa].F=true;
Chang[A.X][A.Y]=6;
if(A.San==true){
if(A.X>2){
DSa++;
a[DSa].X=A.X;a[DSa].Y=A.Y;a[DSa].Fang=1;a[DSa].F=true;
Chang[A.X][A.Y]=5;
}
if(A.X<19){
DSa++;
a[DSa].X=A.X;a[DSa].Y=A.Y;a[DSa].Fang=3;a[DSa].F=true;
Chang[A.X][A.Y]=7;
}
}
}else if(A.Fang==2&&A.Y<34){
DSa++;
a[DSa].X=A.X;a[DSa].Y=A.Y;a[DSa].Fang=5;a[DSa].F=true;
Chang[A.X][A.Y]=9;
if(A.San==true){
if(A.X>2){
DSa++;
a[DSa].X=A.X;a[DSa].Y=A.Y;a[DSa].Fang=4;a[DSa].F=true;
Chang[A.X][A.Y]=8;
}
if(A.X<19){
DSa++;
a[DSa].X=A.X;a[DSa].Y=A.Y;a[DSa].Fang=6;a[DSa].F=true;
Chang[A.X][A.Y]=10;
}
}
}
A.Dan--;
if(A.Chong==true&&(A.Ju==true||A.San==true))A.CD=0.3;
else if(A.Chong==true)A.CD=0.1;
else if(A.Ju==true||A.San==true)A.CD=0.6;
else A.CD=0.3;
if(A.Xue>0)A.Xue+=A.Hui;
}
if(GetAsyncKeyState(VK_LEFT)){
if(Chang[B.X][B.Y-1]==0||Chang[B.X][B.Y-1]==2)B.Y--;
if(B.Y<=1)B.Y=2;
B.Fang=1;
}
if(GetAsyncKeyState(VK_UP)){
if(B.Tiao){
if(B.Shui==0)B.Shang=7;
else B.Shang=4;
B.Tiao=false;
}
}
if(GetAsyncKeyState(VK_RIGHT)){
if(Chang[B.X][B.Y+1]==0||Chang[B.X][B.Y+1]==2)B.Y++;
if(B.Y>=35)B.Y=34;
B.Fang=2;
}
if(GetAsyncKeyState(VK_DOWN)){
if(Chang[B.X+1][B.Y]==2)B.X++;
}
if(GetAsyncKeyState(VK_NUMPAD1)&&B.Dan!=10&&B.Huan==-1){
B.Dan=0;
B.CD=0.0;
B.Huan=4.0+B.Chong*2-(B.Ju||B.San);
}
if(GetAsyncKeyState(VK_NUMPAD0)&&B.CD==0&&B.Dan>0){
if(B.Fang==1&&B.Y>2){
DSb++;
b[DSb].X=B.X;b[DSb].Y=B.Y;b[DSb].Fang=2;b[DSb].F=true;
Chang[B.X][B.Y]=12;
if(B.San==true){
if(B.X>2){
DSb++;
b[DSb].X=B.X;b[DSb].Y=B.Y;b[DSb].Fang=1;b[DSb].F=true;
Chang[B.X][B.Y]=11;
}
if(B.X<19){
DSb++;
b[DSb].X=B.X;b[DSb].Y=B.Y;b[DSb].Fang=3;b[DSb].F=true;
Chang[B.X][B.Y]=13;
}
}
}else if(B.Fang==2&&B.Y<34){
DSb++;
b[DSb].X=B.X;b[DSb].Y=B.Y;b[DSb].Fang=5;b[DSb].F=true;
Chang[B.X][B.Y]=15;
if(B.San==true){
if(B.X>2){
DSb++;
b[DSb].X=B.X;b[DSb].Y=B.Y;b[DSb].Fang=4;b[DSb].F=true;
Chang[B.X][B.Y]=14;
}
if(B.X<19){
DSb++;
b[DSb].X=B.X;b[DSb].Y=B.Y;b[DSb].Fang=6;b[DSb].F=true;
Chang[B.X][B.Y]=16;
}
}
}
B.Dan--;
if(B.Chong==true&&(B.Ju==true||B.San==true))B.CD=0.3;
else if(B.Chong==true)B.CD=0.1;
else if(B.Ju==true||B.San==true)B.CD=0.6;
else B.CD=0.3;
if(B.Xue>0)B.Xue+=B.Hui;
}
if(A.Shang!=0){
if(A.X>2){if(Chang[A.X-1][A.Y]==0||Chang[A.X-1][A.Y]==2||Chang[A.X-1][A.Y]>=5)A.X--;}
A.Shang--;
}else if(Chang[A.X+1][A.Y]==0||Chang[A.X-1][A.Y]>=5)A.X++;
if(Chang[A.X+1][A.Y]!=0&&A.Shang==0)A.Tiao=true;
if(A.Huan>=0)A.Huan-=0.06;
if(A.Huan<=0){
if(A.Huan!=-1){
A.CD=0;
A.Dan=15+(A.Chong&&!(A.Ju||A.San)?10:(A.Chong?5:0));
}
A.Huan=-1;
}
if(A.Dan==0){
A.Dan=-1;
A.CD=0.0;
A.Huan=4.0+A.Chong*2-(A.Ju||A.San);
}
if(A.CD!=0)A.CD-=0.06;
if(A.CD<=0)A.CD=0;
if(A.Jin!=0){
A.Xue-=1;
A.Jin-=0.06;
}
if(A.Jin<=0)A.Jin=0;
if(A.Mu!=0){
A.Xue-=1;
A.Mu-=0.06;
}
if(A.Mu<=0)A.Mu=0;
if(A.Shui!=0){
A.Shui-=0.06;
}
if(A.Shui<=0)A.Shui=0;
if(A.Huo!=0){
A.Xue-=1;
A.Huo-=0.06;
}
if(A.Huo<=0)A.Huo=0;
if(A.Tu!=0){
A.Xue-=1;
A.Tu-=0.06;
}
if(A.Tu<=0)A.Tu=0;
if(B.Shang!=0){
if(B.X>2){if(Chang[B.X-1][B.Y]==0||Chang[B.X-1][B.Y]==2||Chang[B.X-1][B.Y]>=5)B.X--;}
else B.X=2;
B.Shang--;
}else if(Chang[B.X+1][B.Y]==0||Chang[B.X-1][B.Y]>=5)B.X++;
if(Chang[B.X+1][B.Y]!=0&&B.Shang==0)B.Tiao=true;
if(B.Huan>=0)B.Huan-=0.06;
if(B.Huan<=0){
if(B.Huan!=-1){
B.CD=0;
B.Dan=15+(B.Chong&&!(B.Ju||B.San)?10:(B.Chong?5:0));
}
B.Huan=-1;
}
if(B.Dan==0){
B.Dan=-1;
B.CD=0.0;
B.Huan=4.0+B.Chong*2-(B.Ju||B.San);
}
if(B.CD!=0)B.CD-=0.06;
if(B.CD<=0)B.CD=0;
if(B.Jin!=0){
B.Xue-=1;
B.Jin-=0.06;
}
if(B.Jin<=0)B.Jin=0;
if(B.Mu!=0){
B.Xue-=1;
B.Mu-=0.06;
}
if(B.Mu<=0)B.Mu=0;
if(B.Shui!=0){
B.Shui-=0.06;
}
if(B.Shui<=0)B.Shui=0;
if(B.Huo!=0){
B.Xue-=1;
B.Huo-=0.06;
}
if(B.Huo<=0)B.Huo=0;
if(B.Tu!=0){
B.Xue-=1;
B.Tu-=0.06;
}
if(B.Tu<=0)B.Tu=0;
G(0,0);
for(int i=1;i<=20;i++){
for(int j=1;j<=35;j++){
if(find_Dana(i,j)==1){
int timp=find_Dana2(i,j);
a[timp].Y--;
a[timp].X--;
if(a[timp].X==B.X&&a[timp].Y==B.Y&&a[timp].F==true){
if(A.Xue>0)A.Xue+=A.Hui*10;
B.Xue-=(A.Ju&&(A.Chong||A.San)?25:(A.Ju?45:15));
if(A.Yuan){
int gailv=rand()%100+1;
if(gailv<=90){
int su=rand()%5+1;
if(su==1)B.Jin=2;
else if(su==2)B.Mu=2;
else if(su==3)B.Shui=5;
else if(su==4)B.Huo=2;
else if(su==5)B.Tu=2;
}
}
}
if((a[timp].Y<=1||a[timp].X<=1)||(a[timp].X==B.X&&a[timp].Y==B.Y))a[timp].F=false;
}
if(find_Dana(i,j)==2){
int timp=find_Dana2(i,j);
a[timp].Y--;
if(a[timp].X==B.X&&a[timp].Y==B.Y&&a[timp].F==true){
if(a[timp].X==B.X&&a[timp].Y==B.Y&&a[timp].F==true){
if(A.Xue>0)A.Xue+=A.Hui*10;
B.Xue-=(A.Ju&&(A.Chong||A.San)?25:(A.Ju?45:15));
if(A.Yuan){
int gailv=rand()%100+1;
if(gailv<=90){
int su=rand()%5+1;
if(su==1)B.Jin=2;
else if(su==2)B.Mu=2;
else if(su==3)B.Shui=5;
else if(su==4)B.Huo=2;
else if(su==5)B.Tu=2;
}
}
}
if((a[timp].Y<=1||a[timp].X<=1)||(a[timp].X==B.X&&a[timp].Y==B.Y))a[timp].F=false;
}
if(a[timp].Y<=1||(a[timp].X==B.X&&a[timp].Y==B.Y))a[timp].F=false;
}
if(find_Danb(i,j)==1){
int timp=find_Danb2(i,j);
b[timp].Y--;
b[timp].X--;
if(b[timp].X==A.X&&b[timp].Y==A.Y&&b[timp].F==true){
if(B.Xue>0)B.Xue+=B.Hui*10;
A.Xue-=(B.Ju&&(B.Chong||B.San)?25:(B.Ju?45:15));
if(B.Yuan){
int gailv=rand()%100+1;
if(gailv<=90){
int su=rand()%5+1;
if(su==1)A.Jin=2;
else if(su==2)A.Mu=2;
else if(su==3)A.Shui=5;
else if(su==4)A.Huo=2;
else if(su==5)A.Tu=2;
}
}
}
if((b[timp].Y<=1||b[timp].X<=1)||(b[timp].X==A.X&&b[timp].Y==A.Y))b[timp].F=false;
}
if(find_Danb(i,j)==2){
int timp=find_Danb2(i,j);
b[timp].Y--;
if(b[timp].X==A.X&&b[timp].Y==A.Y&&b[timp].F==true){
if(B.Xue>0)B.Xue+=B.Hui*10;
A.Xue-=(B.Ju&&(B.Chong||B.San)?25:(B.Ju?45:15));
if(B.Yuan){
int gailv=rand()%100+1;
if(gailv<=90){
int su=rand()%5+1;
if(su==1)A.Jin=2;
else if(su==2)A.Mu=2;
else if(su==3)A.Shui=5;
else if(su==4)A.Huo=2;
else if(su==5)A.Tu=2;
}
}
}
if(b[timp].Y<=1||(b[timp].X==A.X&&b[timp].Y==A.Y))b[timp].F=false;
}
}
}
for(int i=20;i>=1;i--){
for(int j=1;j<=35;j++){
if(find_Dana(i,j)==3){
int timp=find_Dana2(i,j);
a[timp].Y--;
a[timp].X++;
if(a[timp].X==B.X&&a[timp].Y==B.Y&&a[timp].F==true){
if(a[timp].X==B.X&&a[timp].Y==B.Y&&a[timp].F==true){
A.Xue+=A.Hui*5;
B.Xue-=(A.Ju&&(A.Chong||A.San)?25:(A.Ju?45:15));
if(A.Yuan){
int gailv=rand()%100+1;
if(gailv<=90){
int su=rand()%5+1;
if(su==1)B.Jin=2;
else if(su==2)B.Mu=2;
else if(su==3)B.Shui=5;
else if(su==4)B.Huo=2;
else if(su==5)B.Tu=2;
}
}
}
if((a[timp].Y<=1||a[timp].X<=1)||(a[timp].X==B.X&&a[timp].Y==B.Y))a[timp].F=false;
}
if((a[timp].Y<=1||a[timp].X>=20)||(a[timp].X==B.X&&a[timp].Y==B.Y))a[timp].F=false;
}
if(find_Danb(i,j)==3){
int timp=find_Danb2(i,j);
b[timp].Y--;
b[timp].X++;
if(b[timp].X==A.X&&b[timp].Y==A.Y&&b[timp].F==true){
int timp=find_Danb2(i,j);
b[timp].Y--;
if(b[timp].X==A.X&&b[timp].Y==A.Y&&b[timp].F==true){
B.Xue+=B.Hui*5;
A.Xue-=(B.Ju&&(B.Chong||B.San)?25:(B.Ju?45:15));
if(B.Yuan){
int gailv=rand()%100+1;
if(gailv<=90){
int su=rand()%5+1;
if(su==1)A.Jin=2;
else if(su==2)A.Mu=2;
else if(su==3)A.Shui=5;
else if(su==4)A.Huo=2;
else if(su==5)A.Tu=2;
}
}
}
if(b[timp].Y<=1||(b[timp].X==A.X&&b[timp].Y==A.Y))b[timp].F=false;
}
if((b[timp].Y<=1||b[timp].X>=20)||(b[timp].X==A.X&&b[timp].Y==A.Y))b[timp].F=false;
}
}
}
for(int i=1;i<=20;i++){
for(int j=35;j>=1;j--){
if(find_Dana(i,j)==4){
int timp=find_Dana2(i,j);
a[timp].Y++;
a[timp].X--;
if(a[timp].X==B.X&&a[timp].Y==B.Y&&a[timp].F==true){
if(a[timp].X==B.X&&a[timp].Y==B.Y&&a[timp].F==true){
if(A.Xue>0)A.Xue+=A.Hui*10;
B.Xue-=(A.Ju&&(A.Chong||A.San)?25:(A.Ju?45:15));
if(A.Yuan){
int gailv=rand()%100+1;
if(gailv<=90){
int su=rand()%5+1;
if(su==1)B.Jin=2;
else if(su==2)B.Mu=2;
else if(su==3)B.Shui=5;
else if(su==4)B.Huo=2;
else if(su==5)B.Tu=2;
}
}
}
if((a[timp].Y<=1||a[timp].X<=1)||(a[timp].X==B.X&&a[timp].Y==B.Y))a[timp].F=false;
}
if((a[timp].Y>=35||a[timp].X<=1)||(a[timp].X==B.X&&a[timp].Y==B.Y))a[timp].F=false;
}
if(find_Dana(i,j)==5){
int timp=find_Dana2(i,j);
a[timp].Y++;
if(a[timp].X==B.X&&a[timp].Y==B.Y&&a[timp].F==true){
if(a[timp].X==B.X&&a[timp].Y==B.Y&&a[timp].F==true){
if(A.Xue>0)A.Xue+=A.Hui*10;
B.Xue-=(A.Ju&&(A.Chong||A.San)?25:(A.Ju?45:15));
if(A.Yuan){
int gailv=rand()%100+1;
if(gailv<=90){
int su=rand()%5+1;
if(su==1)B.Jin=2;
else if(su==2)B.Mu=2;
else if(su==3)B.Shui=5;
else if(su==4)B.Huo=2;
else if(su==5)B.Tu=2;
}
}
}
if((a[timp].Y<=1||a[timp].X<=1)||(a[timp].X==B.X&&a[timp].Y==B.Y))a[timp].F=false;
}
if(a[timp].Y>=35||(a[timp].X==B.X&&a[timp].Y==B.Y))a[timp].F=false;
}
if(find_Danb(i,j)==4){
int timp=find_Danb2(i,j);
b[timp].Y++;
b[timp].X--;
if(b[timp].X==A.X&&b[timp].Y==A.Y&&b[timp].F==true){
if(B.Xue>0)B.Xue+=B.Hui*10;
A.Xue-=(B.Ju&&(B.Chong||B.San)?25:(B.Ju?45:15));
if(B.Yuan){
int gailv=rand()%100+1;
if(gailv<=90){
int su=rand()%5+1;
if(su==1)A.Jin=2;
else if(su==2)A.Mu=2;
else if(su==3)A.Shui=5;
else if(su==4)A.Huo=2;
else if(su==5)A.Tu=2;
}
}
}
if((b[timp].Y>=35||b[timp].X<=1)||(b[timp].X==A.X&&b[timp].Y==A.Y))b[timp].F=false;
}
if(find_Danb(i,j)==5){
int timp=find_Danb2(i,j);
b[timp].Y++;
if(b[timp].X==A.X&&b[timp].Y==A.Y&&b[timp].F==true){
if(B.Xue>0)B.Xue+=B.Hui*10;
A.Xue-=(B.Ju&&(B.Chong||B.San)?25:(B.Ju?45:15));
if(B.Yuan){
int gailv=rand()%100+1;
if(gailv<=90){
int su=rand()%5+1;
if(su==1)A.Jin=2;
else if(su==2)A.Mu=2;
else if(su==3)A.Shui=5;
else if(su==4)A.Huo=2;
else if(su==5)A.Tu=2;
}
}
}
if(b[timp].Y>=35||(b[timp].X==A.X&&b[timp].Y==A.Y))b[timp].F=false;
}
}
}
for(int i=20;i>=1;i--){
for(int j=35;j>=1;j--){
if(find_Dana(i,j)==6){
int timp=find_Dana2(i,j);
a[timp].Y++;
a[timp].X++;
if(a[timp].X==B.X&&a[timp].Y==B.Y&&a[timp].F==true){
if(a[timp].X==B.X&&a[timp].Y==B.Y&&a[timp].F==true){
if(A.Xue>0)A.Xue+=A.Hui*10;
B.Xue-=(A.Ju&&(A.Chong||A.San)?25:(A.Ju?45:15));
if(A.Yuan){
int gailv=rand()%100+1;
if(gailv<=90){
int su=rand()%5+1;
if(su==1)B.Jin=2;
else if(su==2)B.Mu=2;
else if(su==3)B.Shui=5;
else if(su==4)B.Huo=2;
else if(su==5)B.Tu=2;
}
}
}
if((a[timp].Y<=1||a[timp].X<=1)||(a[timp].X==B.X&&a[timp].Y==B.Y))a[timp].F=false;
}
if((a[timp].Y>=35||a[timp].X>=20)||(a[timp].X==B.X&&a[timp].Y==B.Y))a[timp].F=false;
}
if(find_Danb(i,j)==6){
int timp=find_Danb2(i,j);
b[timp].Y++;
b[timp].X++;
if(b[timp].X==A.X&&b[timp].Y==A.Y&&b[timp].F==true){
if(B.Xue>0)B.Xue+=B.Hui*10;
A.Xue-=(B.Ju&&(B.Chong||B.San)?25:(B.Ju?45:15));
if(B.Yuan){
int gailv=rand()%100+1;
if(gailv<=90){
int su=rand()%5+1;
if(su==1)A.Jin=2;
else if(su==2)A.Mu=2;
else if(su==3)A.Shui=5;
else if(su==4)A.Huo=2;
else if(su==5)A.Tu=2;
}
}
}
if((b[timp].Y>=35||b[timp].X>=20)||(b[timp].X==A.X&&b[timp].Y==A.Y))b[timp].F=false;
}
}
}
if(A.Xue<=0||B.Xue<=0)Jieshu-=0.06;
if(Jieshu<=0)Jieshu=0;
}
int timp=zc();
if(timp!=0)return timp;
return 0;
}
int main(){
HC();
srand(time(NULL));
system("mode con cols=170 lines=100");
while(true){
int timp=kt();
if(timp){
Wina=0;Winb=0;
A.Chong=false;A.Ju=false;A.San=false;A.Yuan=false;A.Hui=false;
B.Chong=false;B.Ju=false;B.San=false;B.Yuan=false;B.Hui=false;
A.Ji=100;B.Ji=100;
TU=timp;
Huihe=0;
while(true){
Huihe++;
if(play()!=0)break;
}
printf("你们打了%d个回合\n",Huihe);
Sleep(3000);
}else{
system("cls");
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n 给个好评 qwq 欢迎加团";
Sleep(3000);
return 0;
}
}
return 0;
}
点个关注吧。