1.抽卡
#include <iostream>
#include <stdlib.h>
#include <unistd.h>
#include <bits/stdc++.h>
using namespace std;
void cc(const string a)
{
size_t len = a.size();
for(int i = 0; i < a.size(); i++)
{
cout << a[i];
usleep(32000);
}
cout<<"\n";
}
//抄袭可耻,创意最珍!
const int chao_xi_zhe = 250;
const int AAA = 37,BBB = 29;
int ja = 15,jb=2,jc=27;
int lck[99] = {-1,2,4,-1,5,-2,6,2,8,-3,6,2,7,-3,8,2,4,5,7,9,3,5,-2};
int main()
{
cc("抄袭可耻,创意最珍!");
cc("抄袭可耻,创意最珍!");
cc("抄袭可耻,创意最珍!");
cc("抄袭可耻,创意最珍!");
cc("抄袭可耻,创意最珍!");
cc("抄袭可耻,创意最珍!");
cc("抄袭可耻,创意最珍!");
cc("抄袭可耻,创意最珍!");
cc("抄袭可耻,创意最珍!");
cc("抄袭可耻,创意最珍!");
cc("抄袭可耻,创意最珍!");
system("cls");
usleep(10000);
int z;
cout<<"是否查看规则&剧情?"<<endl;
cout<<"是选1,不是选2"<<endl;
cin >>z;
if(z == 1)
{
system("cls");
cout<<"欢迎来到 抽卡人生"<<endl;
sleep(1);
cout<<"2109年,迷##执掌大权"<<endl;
sleep(1);
cout<<"同时制定了一系列不公的政策"<<endl;
sleep(1);
cout<<"你干什么都要抽卡,吃饭,喝水。。。"<<endl;
sleep(1);
cout<<"你是一位打击迷##的正(造)义(反)人(分)士(子)"<<endl;
sleep(1);
cout<<"被抓进了监狱"<<endl;
sleep(1);
cout<<"必须逃出去!"<<endl;
sleep(1);
cout<<"下面为规则"<<endl;
sleep(1);
cout<<"你一天能干五件事"<<endl;
sleep(1);
cout<<"吃饭和喝水都需要卡"<<endl;
sleep(1);
cout<<"卡包里装你拥有的卡"<<endl;
sleep(1);
cout<<"在商店里,你可以买卖卡片(除了RRPG卡)"<<endl;
sleep(1);
cout<<"你每抽一次卡都要花金币"<<endl;
sleep(1);
cout<<"睡觉可以让你更快乐,同时进入下一天"<<endl;
sleep(1);
cout<<"当你的饥饿(干渴值)为零时"<<endl;
sleep(1);
cout<<"或是快乐值小于30时"<<endl;
sleep(1);
cout<<"你的生命值就会下降"<<endl;
sleep(1);
cout<<"降到0就死了"<<endl;
sleep(1);
cout<<"哦对了,你需要抽到10张RPG卡才能出狱"<<endl;
sleep(1);
cout<<"生存下去吧!"<<endl;
sleep(1);
system("cls");
}
system("cls");
cout<<"是否有存档?"<<endl<<"1、有 2、没有";
int table;
cin >> table;
int tme = 1;
srand(time(0));
int life,gold,hungry,sirsty,happy,time;
int cardA,cardB,cardC,cardRPG,cardfood,cardwater;
int A,B,C,food,water,RPG;
int a,b,c,d,e,f;
if(z != 3)
{
life = 100;
gold = 100;
hungry = 100;
sirsty = 100;
happy = 100;
cardA = 0;
cardB = 0;
cardC = 0;
cardfood = 0;
cardwater = 0;
cardRPG = 0;
}
else
{
cout<<"你好,帅气的作者"<<endl;
cout<<"欢迎测试游戏"<<endl;
life = 100;
gold = 999999999;
hungry = 100;
sirsty = 100;
happy = 100;
cardA = 99999;
cardB = 99999;
cardC = 99999;
cardfood = 99999;
cardwater = 99999;
cardRPG = 0;
}
if(table == 1)
{
cout<<"请输入存档号(不要瞎输哦,后果很严重):";
int jym,myj;
cin>>jym>>life>>gold>>hungry>>sirsty>>happy>>tme>>cardA>>cardB>>cardC>>cardRPG>>cardfood>>cardwater>>myj;
life/= lck[2];
gold/= lck[3];
hungry/= lck[4];
sirsty/= lck[5];
happy/= lck[6];
tme/= lck[7];
cardA/= lck[8];
cardB/= lck[9];
cardC/= lck[10];
cardRPG/= lck[11];
cardfood/= lck[12];
cardwater/= lck[13];
if(! ( (jym * AAA + BBB == myj) && (jym - (tme - ja) - (jb*gold) == jc)))
{
cout<<"你输错了,拜拜";
return 0;
}
cout<<"正";
usleep(40000);
cout<<"在";
usleep(40000);
cout<<"打";
usleep(40000);
cout<<"开";
usleep(40000);
cout<<"存";
usleep(40000);
cout<<"档";
usleep(40000);
cout<<"。";
usleep(40000);
cout<<"。";
usleep(40000);
cout<<"。";
usleep(40000);
cout<<endl;
sleep(2);
}
while(1)
{
//
A = (rand()%11)+10;
B = (rand()%6)+5;
C = (rand()%9)+2;
food = (rand()%16)+15;
water = (rand()%16)+15;
cout<<"第"<<tme<<"天"<<endl;
sleep(3);
for(int i=1; i<= 5; i++)
{
if(gold < 10&&cardA == 0&&cardB == 0&&cardC == 0&&cardfood == 0&&cardwater == 0)
{
cout<<"你现在陷入了困境"<<endl;
cout<<"你既没有钱,有没有卡"<<endl;
cout<<"于是仁慈的作者决定帮你一把"<<endl;
gold+=100;
}
if(cardRPG == 10)
{
cout<<"你集齐了10张RPG卡!"<<endl;
cout<<"你赢了!"<<endl;
return 0;
}
if(hungry < 10)
{
life-=5;
}
if(sirsty < 10)
{
life-=5;
}
if(sirsty < 30)
{
life-=10;
}
if(life <= 0)
{
cout<<"你死了。。。。。。。。。"<<endl;
return 0;
}
if(happy > 100)
{
happy = 100;
}
if(hungry > 100)
{
hungry = 100;
}
if(hungry < 0)
{
hungry = 0;
}
if(sirsty > 100)
{
sirsty = 100;
}
if(sirsty < 0)
{
sirsty = 0;
}
system("cls");
cout<<"生命:"<<life<<endl;
cout<<"金钱:"<<gold<<endl;
cout<<"饥饿:"<<hungry<<endl;
cout<<"干渴:"<<sirsty<<endl;
cout<<"快乐:"<<happy<<endl;
cout<<"1、吃饭 2、喝水 3、抽卡(10金币) 4、卡包 5、商店 6、睡觉 7、存档"<<endl;
if(z != 3)
{
cin>>a;
}
if(z == 3)
{
life = 100;
gold = 999999999;
cardA = 99999;
cardB = 99999;
cardC = 99999;
cardfood = 99999;
cardwater = 99999;
cardRPG = 0;
a = 3;
}
if(a == 1)
{
if(cardfood > 0&&hungry < 100)
{
cardfood -= 1;
hungry += 10;
cout<<"嗝。。。"<<endl;
sleep(1);
}
else if(hungry == 100||hungry > 90)
{
cout<<"你都饱了还吃个啥?"<<endl;
sleep(1);
}
else
{
cout<<"你没有食物卡"<<endl;
sleep(1);
}
}
if(a == 2)
{
if(cardwater > 0&&sirsty <= 100)
{
cardwater -= 1;
sirsty += 10;
cout<<"咕咚,咕咚。。。"<<endl;
sleep(1);
}
else if(sirsty == 100)
{
cout<<"你都不渴还喝个啥?"<<endl;
sleep(1);
}
else
{
cout<<"你没有水卡"<<endl;
sleep(1);
}
}
if(a == 3)
{
if(gold >= 10)
{
gold -= 10;
b = rand()%100;
if(b <= 30)
{
cout<<"你获得一张A卡"<<endl;
cardA++;
}
if(b <= 55&&b > 30)
{
cout<<"你获得一张B卡"<<endl;
cardB++;
happy -= 2;
}
if(b <= 70&&b > 55)
{
cout<<"你获得一张C卡"<<endl;
cardC++;
happy -= 5;
}
if(b <= 71&&b > 70)
{
cout<<"你获得一张RPG卡!!!!!"<<endl;
cardRPG++;
happy += 5;
}
if(b <= 76&&b > 71)
{
cout<<"你啥都没获得"<<endl;
happy -= 10;
}
if(b <= 88&&b > 76)
{
cout<<"你获得一张!食物!卡"<<endl;
cardfood++;
happy += 2;
}
if(b <= 99&&b > 88)
{
cout<<"你获得一张!水!卡"<<endl;
cardwater++;
happy += 2;
}
sleep(2);
}
else
{
cout<<"你没钱了。。。"<<endl;
sleep(1);
}
}
if(a == 4)
{
cout<<"A卡"<<cardA<<endl;
cout<<"B卡"<<cardB<<endl;
cout<<"C卡"<<cardC<<endl;
cout<<"水卡"<<cardwater<<endl;
cout<<"食物卡"<<cardfood<<endl;
cout<<"RPG卡"<<cardRPG<<endl;
sleep(3);
}
if(a == 5)
{
system("cls");
while(1)
{
system("cls");
cout<<"1、买卡 2、卖卡 3、退出"<<endl;
cin>> c;
if(c == 3)
{
break;
}
if(c == 1)
{
system("cls");
cout<<"你有"<<gold<<"金币"<<endl;
cout<<"1、A卡:"<<A<<"金币"<<endl;
cout<<"2、B卡:"<<B<<"金币"<<endl;
cout<<"3、C卡:"<<C<<"金币"<<endl;
cout<<"4、食物卡:"<<food<<"金币"<<endl;
cout<<"5、水卡:"<<water<<"金币"<<endl;
cin >> d;
cout<<"数量:";
int many;
cin >> many;
switch(d)
{
case 1:
if(gold >= A*many)
{
cout<<"购买成功!"<<endl;
cardA += many;
gold -= A*many;
}
else
{
cout<<"你钱不够"<<endl;
}
break;
case 2:
if(gold >= B*many)
{
cout<<"购买成功!"<<endl;
cardB += many;
gold -= B*many;
}
else
{
cout<<"你钱不够"<<endl;
}
break;
case 3:
if(gold >= C*many)
{
cout<<"购买成功!"<<endl;
cardC += many;
gold -= C*many;
}
else
{
cout<<"你钱不够"<<endl;
}
break;
case 4:
if(gold >= food*many)
{
cout<<"购买成功!"<<endl;
cardfood += many;
gold -= food*many;
}
else
{
cout<<"你钱不够"<<endl;
}
break;
case 5:
if(gold >= water*many)
{
cout<<"购买成功!"<<endl;
cardwater += many;
gold -= water*many;
}
else
{
cout<<"你钱不够"<<endl;
}
break;
}
}
if(c == 2)
{
cout<<"你有:"<<endl;
cout<<"A卡*"<<cardA<<endl;
cout<<"B卡*"<<cardB<<endl;
cout<<"C卡*"<<cardC<<endl;
cout<<"水卡*"<<cardwater<<endl;
cout<<"食物卡*"<<cardfood<<endl;
cout<<endl<<endl<<endl;
cout<<"1、A卡:"<<A<<"金币"<<endl;
cout<<"2、B卡:"<<B<<"金币"<<endl;
cout<<"3、C卡:"<<C<<"金币"<<endl;
cout<<"4、食物卡:"<<food<<"金币"<<endl;
cout<<"5、水卡:"<<water<<"金币"<<endl;
cin>> d;
int much;
cout<<"出售数量:";
cin >> much;
switch(d)
{
case 1:
if(cardA*much >= 1)
{
cout<<"出售成功!"<<endl;
sleep(1);
cardA-=much;
gold+=A*much;
}
else
{
cout<<"你没那个卡"<<endl;
sleep(1);
}
break;
case 2:
if(cardB*much >= 1)
{
cout<<"出售成功!"<<endl;
sleep(1);
cardB-=much;
gold+=B*much;
}
else
{
cout<<"你没那个卡"<<endl;
sleep(1);
}
break;
case 3:
if(cardC*much >= 1)
{
cout<<"出售成功!"<<endl;
sleep(1);
cardC-=much;
gold+=C*much;
}
else
{
cout<<"你没那个卡"<<endl;
sleep(1);
}
break;
case 4:
if(cardfood*much >= 1)
{
cout<<"出售成功!"<<endl;
sleep(1);
cardfood-=much;
gold+=food*much;
}
else
{
cout<<"你没那个卡"<<endl;
sleep(1);
}
break;
case 5:
if(cardwater*much >= 1)
{
cout<<"出售成功!"<<endl;
sleep(1);
cardwater-=much;
gold+=water*much;
}
else
{
cout<<"你没那个卡"<<endl;
sleep(1);
}
break;
}
}
}
}
if(a == 6)
{
cout<<"呼噜,呼噜......"<<endl;
sleep(1);
happy += 5;
if(happy > 100)
{
happy = 100;
}
hungry-=10;
sirsty-= 10;
system("cls");
break;
}
if(a == 7)
{
int yuo = 27;
yuo += 2*gold;
yuo += tme - 15;
int ouy = yuo * AAA + BBB;
cout<<"友情提示,请将终端拉至最大,否则会出BUG"<<endl;
sleep(3);
cout<<"存档号:"
<<yuo<<" "
<<lck[2] * life<<" "
<<lck[3] * gold<<" "
<<lck[4] * hungry<<" "
<<lck[5] * sirsty<<" "
<<lck[6] * happy<<" "
<<lck[7] * tme<<" "
<<lck[8] * cardA<<" "
<<lck[9] * cardB<<" "
<<lck[10] * cardC<<" "
<<lck[11] * cardRPG<<" "
<<lck[12] * cardfood<<" "
<<lck[13] * cardwater<<" "
<<ouy;
return 0;
}
if(i == 3)
{
hungry-=10;
}
if(i % 2==0)
{
sirsty-=10;
}
}
tme++;
}
}
2.躺平发育
#include<bits/stdc++.h>
#include<windows.h>
#include<unistd.h>
using namespace std;
void rules();
int main(void) {
int c=1;
int m=1;
long long m_x=1000;
long long m_xl=1000;
int g_a=250;
int g_d=200;
int coins=50;
int p_n=1;
int n=0;
int win=100;
int buy;
int d_n=0;
int p_a=75;
int p_na, jj_a, jj_d;
system("cls");
cout<<"请选择难度:"<<endl;
cout<<endl;
cout<<endl;
cout<<"A.初级难度"<<endl;
cout<<endl;
cout<<"B.中级难度"<<endl;
cout<<endl;
cout<<"C.地狱难度"<<endl;
cout<<"请输入:";
char x;
cin>>x;
if(x=='A'){
jj_a=100;
jj_d=60;
p_na=50;
}
else if(x=='B'){
jj_a=125;
jj_d=75;
p_na=55;
}
else if(x=='C'){
jj_a=175;
jj_d=125;
p_na=45;
}
while(win>=0) {
if(n<0){
n=0;
}
if(win<=0){
break;
}
m_xl-=n*g_a;
if(m_xl<=0) {
system("cls");
cout<<"您的门已经被噬梦者攻破,G A M E O V E R!"<<endl;
return 0;
}
system("cls");
cout<<"金币:"<<coins<<" 电力:"<<d_n<<" 炮台:"<<p_n<<"个 "<<"门的血量:"<<m_xl<<endl;
cout<<endl;
cout<<" 墙墙墙墙 墙墙墙墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙 墙 墙 墙"<<endl;
cout<<" 墙 墙 怪 墙 墙"<<endl;
cout<<" 墙 墙 "<<n<<" 墙 墙"<<endl;
cout<<"墙墙墙墙 墙 门 墙 墙墙墙墙"<<endl;
cout<<"墙 ◎ ◎ ◎ 墙"<<endl;
cout<<"墙 ◎ 床 ◎ ☆☆☆墙"<<endl;
cout<<"墙 ☆★★墙"<<endl;
cout<<"墙 ☆★★墙"<<endl;
cout<<"墙墙墙墙墙墙墙墙墙墙墙墙墙墙墙墙"<<endl;
cout<<endl;
cout<<"您正在床上发育……"<<endl;
cout<<"有"<<n<<"只噬梦者在挠你的门!"<<endl;
cout<<"输入1以建造炮台:25金币"<<endl;
cout<<"输入2以升级门: 50金币"<<endl;
cout<<"输入3以升级床: 35金币"<<endl;
cout<<"输入4以放弃此次建造机会"<<endl;
cout<<"输入5以拆除1个炮台:获得15金币"<<endl;
cout<<"输入6以让门回血"<<endl;
cout<<"您的门的级位是"<<m<<"级"<<endl;
cout<<"您的床是"<<c<<"级"<<endl;
cout<<"◎:炮台"<<endl;
cout<<"☆:维修台"<<endl;
cout<<"★:发电机"<<endl;
n-=p_n*p_a/g_d;
win-=p_n*p_a/g_d;
cin>>buy;
switch(buy) {
case 1:
if(coins<25) {
cout<<"您的钱不够"<<endl;
break;
}
if(p_n==17){
cout<<"最大上限为17个炮台!"<<endl;
break;
}
coins-=25;
p_n++;
break;
case 2:
if(coins<50) {
cout<<"您的钱不够"<<endl;
break;
}
if(m==19){
cout<<"您的门已达到黄金门,不能够再次升级了!"<<endl;
system("pause");
break;
}
coins-=50;
m++;
m_x*=7;
m_xl=m_x;
break;
case 3:
if(coins<35) {
cout<<"您的钱不够"<<endl;
break;
}
coins-=35;
c++;
break;
case 4:
break;
case 5:
coins+=15;
p_n--;
case 6:
m_xl=m_x;
break;
default:
cout<<"没有此选项"<<endl;
break;
}
if(m_xl==0) {
system("cls");
cout<<"您的门已经被噬梦者攻破,G A M E O V E R!"<<endl;
return 0;
}
if(n==31) {
n--;
}
coins+=c*15;
sleep(2);
n++;
if(n==31) {
n--;
}
d_n+=4*10000;
}
cout<<"恭喜您打败了所有噬梦者,获得了胜利!"<<endl;
}
void rules() {
string o="您在野外建造了一间房屋,现在是晚上,有噬梦者来攻击您。如果您能打败所有(100个)噬梦者,您就胜利了!如果门被挠破,则输!";
for(int i=0; i<o.size(); i++) {
cout<<o[i];
Sleep(100);
}
cout<<endl;
cout<<endl;
system("pause");
}
3.游戏盒子
#include<bits/stdc++.h>
#include <windows.h>
#include <stdio.h>
#include<conio.h>
#include<time.h>
using namespace std;
int x = 0;
int* X = &x;
char Void[10000] = "\0";
int Key = 0;
int KeyOut = 0;
int User;
int User2;
int* Q1;
int* Q2;
int* Q3;
int score; //游戏得分
const int nn = 809;
struct Point { int x, y; };
int dali;
int fx[4] = { -1,27,1,-27 };
int fxfx[4][2] = { {0,-1},{1,0},{0,1},{-1,0} };
int dis[1000][1000];
int changdi[30][27] = {
{0,0,0,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,0,1,1,1,1,1,1,1,1,1,1,1,1,0},
{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,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,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0},
{0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,0},
{0,0,0,0,0,0,1,0,0,0,0,0,2,0,2,0,0,0,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,0,0,0,2,0,2,0,0,0,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,2,2,2,2,2,2,2,2,2,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,2,0,0,0,3,0,0,0,2,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,2,0,3,3,3,3,3,0,2,0,0,1,0,0,0,0,0,0},
{2,2,2,2,2,2,1,2,2,2,0,3,3,3,3,3,0,2,2,2,1,2,2,2,2,2,2},
{0,0,0,0,0,0,1,0,0,2,0,3,3,3,3,3,0,2,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,2,2,2,2,2,2,2,2,2,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
{0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
{0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0},
{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
{0,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0},
{0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0},
{0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0},
{0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,0},
{0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0},
{0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,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}
};
int xx, xx1, xx2, xx3, xx4, yy, yy5, yy2, yy3, yy4;
int now, now1, now2, now3, now4;
int gg1, gg2, gg3, gg4;
int fangx, nextfx, last1, last2, last3, last4;
int fenshu, guozi, guaitimer;
int T1, T2, t1, t2, stopped; //T:计时 t1:玩家速度 t2:怪物速度
int ff = 0; //f:{0:继续 1:被吃 2:赢了 3:输了}
int beichi;
#define high 20 //定义地图的高度
#define width 30 //定义地图的宽度
#define snake_maxlength 200 //蛇长最大值
int snake_x[snake_maxlength], snake_y[snake_maxlength]; //蛇的坐标
int snake_length; //蛇现在的长度
int Map[high][width] = { 0 }; //初始化地图,0表示空格,1表示蛇身,2表示食物,3表示墙,4表示蛇头,现在地图中什么也没有
int food_x, food_y; //食物的坐标
int SCORE; //本局分数
char input;
char primeinput = '.';
int op = 100;
int Death = 0;
int Guesstimes;
struct account{
char user[1000]; //用户名
char password[1000]; //密码
int coin = 0; //硬币
int number; //编号
int award = 0; //奖励次数,主要用于恋爱测试器奖励次数的限定
};
struct account peo[100]; //初设100人,可更改
void HideCursor()
{
CONSOLE_CURSOR_INFO cursor_info = { 1, 0 };
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
float Check(int a)
{
if (a == 0) //针对字符和字符串
{
float m;
if (cin >> m)
{
return m;
}
else
{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
while (!(cin >> m))
{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
}
return m;
}
}
else if (a == 1){
float m;
float c;
if (cin >> m){
while (1){
if (m == 1 || m == 2 || m == 0){
return m;
break;
}
else{
cout << "输入错误,请重新输入:";
c = Check(1); //递归调用,重新检测输入
return c;
break;
}
}
}
else{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
while (!(cin >> m)){
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
}
while (1){
if (m == 1 || m == 2 || m == 0){
return m;
break;
}
else{
cout << "输入错误,请重新输入:";
c = Check(1);
return c;
break;
}
}
}
}
else if (a == 2) //针对字符和字符串以及特定的数字(1、2)
{
float m;
float c;
if (cin >> m)
{
while (1)
{
if (m == 1 || m == 2)
{
return m;
break;
}
else
{
cout << "输入错误,请重新输入:";
c = Check(2);
return c;
break;
}
}
}
else
{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync();//清理缓冲区内容
cin.get();
while (!(cin >> m))
{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
}
while (1)
{
if (m == 1 || m == 2)
{
return m;
break;
}
else
{
cout << "输入错误,请重新输入:";
a = Check(2);
return a;
break;
}
}
}
}
else if (a == 3) //针对字符和字符串以及特定的数字(1、2、3)
{
float m;
float c;
if (cin >> m)
{
while (1)
{
if (m == 1 || m == 2 || m == 3)
{
return m;
break;
}
else
{
cout << "输入错误,请重新输入:";
c = Check(3);
return c;
break;
}
}
}
else
{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
while (!(cin >> m))
{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
}
while (1){
if (m == 1 || m == 2 || m == 3){
return m;
break;
}
else{
cout << "输入错误,请重新输入:";
a = Check(3);
return a;
break;
}
}
}
}
else if (a == 4) { //针对字符和字符串以及特定的数字(1、0)
float m;
float c;
if (cin >> m){
while (1){
if (m == 1 || m == 0){
return m;
break;
}
else{
cout << "输入错误,请重新输入:";
c = Check(4);
return c;
break;
}
}
}
else{
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
while (!(cin >> m)){
cout << "输入错误,请重新输入:";
cin.clear(); //清除这个错误状态
cin.sync(); //清理缓冲区内容
cin.get();
}
while (1){
if (m == 1 || m == 0){
return m;
break;
}
else
{
cout << "输入错误,请重新输入:";
a = Check(4);
return a;
break;
}
}
}
}
}
void Progress(){
int c = 1, d = 0;
for (int i = 0; i < 50; i++)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t+-------------------------------------------------+" << endl;
cout << "\t\t\t\t|";
for (int a = 0; a < i; a++) //打印▋
{
cout << "▋";
}
for (int b = 49 - i; b > 0; b--) //打印空格
{
cout << " ";
}
d += 2; //进度数
cout << "| " << d << "%" << endl;
cout << "\t\t\t\t+-------------------------------------------------+" << endl;
cout << "\t\t\t\t 正在加载中,请稍后.";
for (int j = 0; j < c % 6; j++)
{
cout << ".";
}
c++;
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
Sleep(150); //进度条读取速度
if (i != 49)
{
system("cls"); //清屏
}
}
Sleep(3000);
system("cls");
}
int NormalizeName(char name[1000], int n)
{
int a = 0; //计数器
if (n <= 15)
{
for (int i = 0; i < n; i++)
{
if (name[i] <= 32 || name[i] == 127) //为空格或其他特殊情况
{
break;
}
else
{
a++;
}
}
if (a == n)
{
return 1;
}
else
{
return 0;
}
}
else
{
return 0;
}
}
//--------------------------------------------------------------------------------------------------------------
// 用户名查重系统
int CheckName(char name[1000])
{
int a = 0; //计数器
if (x == 0) //第一个注册的人无重复
{
return 1;
}
else
{
for (int i = 0; i < x; i++)
{
if (strcmp(name, peo[i].user) == 0)
{
break;
}
else
{
a++;
}
}
if (a == x) //用户名无重复
{
return 1;
}
else
{
return 0;
}
}
}
//--------------------------------------------------------------------------------------------------------------
// 密码规范系统
int NormalizePassword(char password[1000], int n)
{
int a = 0; //计数器
if (n >= 6 && n <= 15)
{
for (int i = 0; i < n; i++)
{
if ((password[i] >= 48 && password[i] <= 57) || (password[i] >= 65 && password[i] <= 90) || (password[i] >= 97 && password[i] <= 122)) //为字母或数字
{
a++;
}
else
{
break;
}
}
if (a == n)
{
return 1;
}
else
{
return 0;
}
}
else
{
return 0;
}
}
//--------------------------------------------------------------------------------------------------------------
// 密码找回系统
int RefoundPassword()
{
while (1)
{
char Name2[1000];
int Key1 = 0;
cout << "请输入用户名:";
cin >> Name2;
for (int i = 0; i < *X; i++) //逐个人员遍历
{
if (strcmp(Name2, peo[i].user) == 0) //判断输入的用户名有无注册或是否正确
{
Key1 = 1;
User2 = i;
}
}
system("cls"); //清屏
if (Key1 == 0) //钥匙解锁失败
{
cout << "您的用户名未注册或输入错误!!!" << endl << endl;
cout << "1.继续找回密码" << endl;
cout << "2.退出系统" << endl;
cout << "请输入数字实现对应功能:";
int m2 = Check(2); //只返回1、2
cout << endl;
if (m2 == 1)
{
system("cls"); //清屏
continue;
}
else if (m2 == 2)
{
system("cls"); //清屏
return 0;
}
}
else if (Key1 == 1) //钥匙解锁成功
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 您的密码为:" << peo[User2].password << endl;
Sleep(2000);
system("pause");
system("cls"); //清屏
return 1;
}
}
}
//--------------------------------------------------------------------------------------------------------------
// 账号注册系统:
int Register()
{
int key1 = 0; //注册成功的钥匙
int key2 = 0; //用户名设置成功的钥匙
int key3 = 0; //密码设置成功钥匙
int key4 = 0; //退出程序的钥匙
int h = 0; //轮转片
char recheck[100];
peo[x].number = x + 1; //标号
while (1) //创建用户名
{
cout << "请设置用户名(不超过15个字符,空格与汉字为非法字符):";
cin.get(); //cin.getline前要吸收回车键
cin.getline(peo[x].user, 1000);
int n1 = strlen(peo[x].user);
int p1 = NormalizeName(peo[x].user, n1); //返回1用户名通过,返回0则不通过
int p2 = CheckName(peo[x].user); //返回1用户名通过,返回0则不通过
if (p1 == 1 && p2 == 1)
{
key2 = 1; //钥匙开锁,用户名设置成功
break;
}
else
{
cout << endl << endl;
cout << "用户名重复或非法!!!" << endl;
cout << "1.重新设置用户名" << endl;
cout << "2.退出注册" << endl;
cout << "请输入数字实现对应功能:";
int q = Check(2); //只返回1、2
cout << endl;
if (q == 1) //重新设置用户名
{
strcpy(peo[x].user, Void); //清空输入的用户名
system("cls"); //清屏
continue;
}
else if (q == 2) //退出注册
{
system("cls"); //清屏
break;
}
}
}
cout << endl << endl;
if (key2 == 1)
{
while (1) //设置密码
{
system("cls"); //清屏
cout << "请设置密码(只能为字母和数字,长度不小于6,不超过15):";
if (h != 0)
{
cin.get(); //cin.getline前要吸收回车键
}
cin.getline(peo[x].password, 1000);
//cout << peo[x].password << endl;
int n2 = strlen(peo[x].password);
int p3 = NormalizePassword(peo[x].password, n2); //返回1密码通过,返回0则不通过
if (p3 == 1)
{
key3 = 1; //钥匙开锁,密码设置成功
}
else
{
cout << endl << endl;
cout << "密码非法!!!" << endl;
cout << "1.重新设置密码" << endl;
cout << "2.退出注册" << endl;
cout << "请输入数字实现对应功能:";
int q = Check(2); //只返回1、2
cout << endl;
if (q == 1) //重新设置密码
{
strcpy(peo[x].password, Void); //清空输入的密码
cout << endl << endl;
h++;
continue;
}
else if (q == 2) //退出注册
{
system("cls"); //清屏
break;
}
}
if (key3 == 1)
{
system("cls"); //清屏
while (1)
{
cout << "请再次输入密码:";
cin >> recheck;
//cout << recheck << endl;
if (strcmp(recheck, peo[x].password) == 0)
{
cout << endl;
cout << "注册成功!!!" << endl << endl;
(*X)++;
key1 = 1; //钥匙开锁,注册成功
key4 = 1; //钥匙开锁,退出设置用户名和密码的程序
break;
}
else
{
cout << endl;
cout << "两次密码不一致!!!" << endl;
cout << "1.重新设置密码" << endl;
cout << "2.退出注册" << endl;
cout << "请输入数字实现对应功能:";
int z = Check(2); //只返回1、2
cout << endl;
if (z == 1)
{
strcpy(recheck, Void); //清空输入的密码
strcpy(peo[x].password, Void); //清空输入的密码
key3 = 0; //关锁
h++;
break;
}
else if (z == 2)
{
system("cls"); //清屏
key4 = 1; //钥匙开锁,退出设置用户名和密码的程序
break;
}
}
}
}
if (key4 == 1)
{
break;
}
}
}
if (key1 == 1)
{
cout << "是否直接进入程序?" << endl;
cout << "1.是" << endl;
cout << "2.否" << endl;
cout << "请输入数字实现对应功能:";
int m = Check(2); //只返回1、2
cout << endl;
if (m == 1)
{
User = x - 1;
return m;
}
else if (m == 2)
{
return m;
}
}
}
//--------------------------------------------------------------------------------------------------------------
// 账号登录系统
int SignIn()
{
char Name[1000], Password[1000];
int Key1 = 0; //判断用户名正误的钥匙
int Key2 = 0; //判断密码正误的钥匙
while (1)
{
cout << "请输入用户名:"; //有BUG
cin >> Name;
for (int i = 0; i < *X; i++) //逐个人员遍历
{
if (strcmp(Name, peo[i].user) == 0) //判断输入的用户名有无注册或是否正确
{
Key1 = 1;
User = i;
}
}
if (Key1 == 0) //钥匙解锁失败
{
cout << "您的用户名未注册或输入错误!!!" << endl << endl;
cout << "1.继续登录" << endl;
cout << "2.退出登录" << endl;
cout << "请输入数字实现对应功能:";
int m1 = Check(2); //只返回1、2
cout << endl;
if (m1 == 1)
{
system("cls"); //清屏
continue;
}
else if (m1 == 2)
{
system("cls"); //清屏
return 0;
}
}
else if (Key1 == 1) //钥匙解锁成功
{
cout << "请输入密码:";
cin >> Password;
if (strcmp(Password, peo[User].password) == 0) //判断输入的密码是否正确
{
Key2 = 1; //钥匙开锁,成功登陆
}
if (Key2 == 0) //密码错误
{
cout << endl << "您输入的密码有误" << endl;
cout << "1.重新登录" << endl;
cout << "2.找回密码" << endl;
cout << "3.退出登录" << endl;
cout << "请输入数字实现对应功能:";
int m2 = Check(3); //只返回1、2、3
cout << endl;
if (m2 == 1)
{
Key1 = 0; //重新登陆关锁
system("cls"); //清屏
continue;
}
else if (m2 == 2)
{
Key1 = 0; //重新登陆关锁
system("cls"); //清屏
int r = RefoundPassword();
if (r == 1)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 密码找回成功!!!" << endl;
Sleep(2000);
system("cls"); //清屏
continue;
}
else if (r == 0)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 密码找回失败!!!" << endl;
Sleep(2000);
system("cls"); //清屏
continue;
}
}
else if (m2 == 3)
{
system("cls"); //清屏
return 0;
}
}
else if (Key2 == 1) //密码正确
{
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 登录成功!!!" << endl;
Sleep(2000); //延时2秒
return 1;
}
}
}
}
//--------------------------------------------------------------------------------------------------------------
// 游戏部分
//1.雷霆战机
/*=============== all the structures ===============*/
typedef struct Frame
{
COORD position[2];
int flag;
}Frame;
/*=============== all the functions ===============*/
void SetPos(COORD a)// set cursor
{
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(out, a);
}
void SetPos(int i, int j)// set cursor
{
COORD pos = { i, j };
SetPos(pos);
}
//把第y行,[x1, x2) 之间的坐标填充为 ch
void drawRow(int y, int x1, int x2, char ch)
{
SetPos(x1, y);
for (int i = 0; i <= (x2 - x1); i++)
cout << ch;
}
//在a, b 纵坐标相同的前提下,把坐标 [a, b] 之间填充为 ch
void drawRow(COORD a, COORD b, char ch)
{
if (a.Y == b.Y)
drawRow(a.Y, a.X, b.X, ch);
else
{
SetPos(0, 25);
cout << "error code 01:无法填充行,因为两个坐标的纵坐标(x)不相等";
system("pause");
}
}
//把第x列,[y1, y2] 之间的坐标填充为 ch
void drawCol(int x, int y1, int y2, char ch)
{
int y = y1;
while (y != y2 + 1)
{
SetPos(x, y);
cout << ch;
y++;
}
}
//在a, b 横坐标相同的前提下,把坐标 [a, b] 之间填充为 ch
void drawCol(COORD a, COORD b, char ch)
{
if (a.X == b.X)
drawCol(a.X, a.Y, b.Y, ch);
else
{
SetPos(0, 25);
cout << "error code 02:无法填充列,因为两个坐标的横坐标(y)不相等";
system("pause");
}
}
//左上角坐标、右下角坐标、用row填充行、用col填充列
void drawFrame(COORD a, COORD b, char row, char col)
{
drawRow(a.Y, a.X + 1, b.X - 1, row);
drawRow(b.Y, a.X + 1, b.X - 1, row);
drawCol(a.X, a.Y + 1, b.Y - 1, col);
drawCol(b.X, a.Y + 1, b.Y - 1, col);
}
void drawFrame(int x1, int y1, int x2, int y2, char row, char col)
{
COORD a = { x1, y1 };
COORD b = { x2, y2 };
drawFrame(a, b, row, col);
}
void drawFrame(Frame frame, char row, char col)
{
COORD a = frame.position[0];
COORD b = frame.position[1];
drawFrame(a, b, row, col);
}
void drawPlaying()
{
drawFrame(0, 0, 48, 24, '=', '|');// draw Map frame;
drawFrame(49, 0, 79, 4, '-', '|');// draw output frame
drawFrame(49, 4, 79, 9, '-', '|');// draw score frame
drawFrame(49, 9, 79, 20, '-', '|');// draw operate frame
drawFrame(49, 20, 79, 24, '-', '|');// draw other message frame
SetPos(52, 6);
cout << "得分:";
SetPos(52, 7);
cout << "称号:";
SetPos(52, 10);
cout << "操作方式:";
SetPos(52, 12);
cout << " a,s,d,w 控制移动,j开炮";
SetPos(52, 14);
cout << " p 暂停游戏";
SetPos(52, 16);
cout << " e 退出游戏";
}
//在[a, b)之间产生一个随机整数
int random(int a, int b)
{
int c = (rand() % (a - b)) + a;
return c;
}
//在两个坐标包括的矩形框内随机产生一个坐标
COORD random(COORD a, COORD b)
{
int x = random(a.X, b.X);
int y = random(a.Y, b.Y);
COORD c = { x, y };
return c;
}
bool judgeCoordInFrame(Frame frame, COORD spot)
{
if (spot.X >= frame.position[0].X)
if (spot.X <= frame.position[1].X)
if (spot.Y >= frame.position[0].Y)
if (spot.Y <= frame.position[0].Y)
return true;
return false;
}
void printCoord(COORD a)
{
cout << "( " << a.X << " , " << a.Y << " )";
}
void printFrameCoord(Frame a)
{
printCoord(a.position[0]);
cout << " - ";
printCoord(a.position[1]);
}
int drawMenu()
{
SetPos(30, 1);
cout << "P l a n e W a r";
drawRow(3, 0, 79, '-');
drawRow(5, 0, 79, '-');
SetPos(28, 4);
cout << "w 和 s 选择, j 确定";
SetPos(15, 11);
cout << "1. 简单的敌人";
SetPos(15, 13);
cout << "2. 冷酷的敌人";
drawRow(20, 0, 79, '-');
drawRow(22, 0, 79, '-');
SetPos(47, 11);
cout << "简单的敌人:";
SetPos(51, 13);
cout << "简单敌人有着较慢的移动速度。";
SetPos(24, 21);
cout << "说明:得分超过200即为胜利";
int j = 11;
SetPos(12, j);
cout << ">>";
while (1)
{
if (_kbhit())
{
char x = _getch();
switch (x)
{
case 'w':
{
if (j == 13)
{
SetPos(12, j);
cout << " ";
j = 11;
SetPos(12, j);
cout << ">>";
SetPos(51, 13);
cout << " ";
SetPos(47, 11);
cout << "简单的敌人:";
SetPos(51, 13);
cout << "简单敌人有较慢的移动速度,比较容易对付";
}
break;
}
case 's':
{
if (j == 11)
{
SetPos(12, j);
cout << " ";
j = 13;
SetPos(12, j);
cout << ">>";
SetPos(51, 13);
cout << " ";
SetPos(47, 11);
cout << "冷酷的敌人:";
SetPos(51, 13);
cout << "冷酷的敌人移动速度较快,不是很好对付哟。";
}
break;
}
case 'j':
{
if (j == 8) return 1;
else return 2;
}
}
}
}
}
/*================== the Game Class ==================*/
class Game
{
public:
COORD position[10];
COORD bullet[10];
Frame enemy[8];
int rank;
int rankf;
string title;
int flag_rank;
Game();
//初始化所有
void initPlane();
void initBullet();
void initEnemy();
//初始化其中一个
//void initThisBullet( COORD );
//void initThisEnemy( Frame );
void planeMove(char);
void bulletMove();
void enemyMove();
void drawPlane();
void drawPlaneToNull();
void drawBullet();
void drawBulletToNull();
void drawEnemy();
void drawEnemyToNull();
void drawThisBulletToNull(COORD);
void drawThisEnemyToNull(Frame);
void Pause();
void Playing();
int judgePlane();
void judgeEnemy();
void Shoot();
void GameOver();
void printScore();
};
Game::Game()
{
initPlane();
initBullet();
initEnemy();
score = 0;
rank = 25;
rankf = 0;
flag_rank = 0;
}
void Game::initPlane()
{
COORD centren = { 39, 22 };
position[0].X = position[5].X = position[7].X = position[9].X = centren.X;
position[1].X = centren.X - 2;
position[2].X = position[6].X = centren.X - 1;
position[3].X = position[8].X = centren.X + 1;
position[4].X = centren.X + 2;
for (int i = 0; i <= 4; i++)
position[i].Y = centren.Y;
for (int i = 6; i <= 8; i++)
position[i].Y = centren.Y + 1;
position[5].Y = centren.Y - 1;
position[9].Y = centren.Y - 2;
}
void Game::drawPlane()
{
for (int i = 0; i < 9; i++)
{
SetPos(position[i]);
if (i != 5)
cout << "O";
else if (i == 5)
cout << "|";
}
}
void Game::drawPlaneToNull()
{
for (int i = 0; i < 9; i++)
{
SetPos(position[i]);
cout << " ";
}
}
void Game::initBullet()
{
for (int i = 0; i < 10; i++)
bullet[i].Y = 30;
}
void Game::drawBullet()
{
for (int i = 0; i < 10; i++)
{
if (bullet[i].Y != 30)
{
SetPos(bullet[i]);
cout << "^";
}
}
}
void Game::drawBulletToNull()
{
for (int i = 0; i < 10; i++)
if (bullet[i].Y != 30)
{
COORD pos = { bullet[i].X, bullet[i].Y + 1 };
SetPos(pos);
cout << " ";
}
}
void Game::initEnemy()
{
COORD a = { 1, 1 };
COORD b = { 45, 15 };
for (int i = 0; i < 8; i++)
{
enemy[i].position[0] = random(a, b);
enemy[i].position[1].X = enemy[i].position[0].X + 3;
enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
}
}
void Game::drawEnemy()
{
for (int i = 0; i < 8; i++)
drawFrame(enemy[i].position[0], enemy[i].position[1], '-', '|');
}
void Game::drawEnemyToNull()
{
for (int i = 0; i < 8; i++)
{
drawFrame(enemy[i].position[0], enemy[i].position[1], ' ', ' ');
}
}
void Game::Pause()
{
SetPos(61, 2);
cout << " ";
SetPos(61, 2);
cout << "暂停中...";
char c = _getch();
while (c != 'p')
c = _getch();
SetPos(61, 2);
cout << " ";
}
void Game::planeMove(char x)
{
if (x == 'a')
if (position[1].X != 1)
for (int i = 0; i <= 9; i++)
position[i].X -= 2;
if (x == 's')
if (position[7].Y != 23)
for (int i = 0; i <= 9; i++)
position[i].Y += 1;
if (x == 'd')
if (position[4].X != 47)
for (int i = 0; i <= 9; i++)
position[i].X += 2;
if (x == 'w')
if (position[5].Y != 3)
for (int i = 0; i <= 9; i++)
position[i].Y -= 1;
}
void Game::bulletMove()
{
for (int i = 0; i < 10; i++)
{
if (bullet[i].Y != 30)
{
bullet[i].Y -= 1;
if (bullet[i].Y == 1)
{
COORD pos = { bullet[i].X, bullet[i].Y + 1 };
drawThisBulletToNull(pos);
bullet[i].Y = 30;
}
}
}
}
void Game::enemyMove()
{
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 2; j++)
enemy[i].position[j].Y++;
if (24 == enemy[i].position[1].Y)
{
COORD a = { 1, 1 };
COORD b = { 45, 3 };
enemy[i].position[0] = random(a, b);
enemy[i].position[1].X = enemy[i].position[0].X + 3;
enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
}
}
}
int Game::judgePlane()
{
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 9; j++)
{
if (judgeCoordInFrame(enemy[i], position[j]))
{
SetPos(62, 1);
cout << "坠毁";
drawFrame(enemy[i], '+', '+');
Sleep(1000);
GameOver();
return 1;
}
}
}
}
void Game::drawThisBulletToNull(COORD c)
{
SetPos(c);
cout << " ";
}
void Game::drawThisEnemyToNull(Frame f)
{
drawFrame(f, ' ', ' ');
}
void Game::judgeEnemy()
{
for (int i = 0; i < 8; i++)
for (int j = 0; j < 10; j++)
if (judgeCoordInFrame(enemy[i], bullet[j]))
{
score += 5;
drawThisEnemyToNull(enemy[i]);
COORD a = { 1, 1 };
COORD b = { 45, 3 };
enemy[i].position[0] = random(a, b);
enemy[i].position[1].X = enemy[i].position[0].X + 3;
enemy[i].position[1].Y = enemy[i].position[0].Y + 2;
drawThisBulletToNull(bullet[j]);
bullet[j].Y = 30;
}
}
void Game::Shoot()
{
for (int i = 0; i < 10; i++)
if (bullet[i].Y == 30)
{
bullet[i].X = position[5].X;
bullet[i].Y = position[5].Y - 1;
break;
}
}
void Game::printScore()
{
if (score == 30 && flag_rank == 0)
{
rank -= 3;
flag_rank = 1;
}
else if (score == 70 && flag_rank == 1)
{
rank -= 5;
flag_rank = 2;
}
else if (score == 110 && flag_rank == 2)
{
rank -= 5;
flag_rank = 3;
}
int x = rank / 5;
SetPos(60, 6);
cout << score;
if (rank != rankf)
{
SetPos(60, 7);
if (x == 5)
title = "初级飞行员";
else if (x == 4)
title = "中级飞行员";
else if (x == 3)
title = "高级飞行员";
else if (x == 2)
title = "王牌飞行员";
cout << title;
}
rankf = rank;
}
void Game::Playing(){
drawEnemy();
drawPlane();
int flag_bullet = 0;
int flag_enemy = 0;
while (1)
{
Sleep(8);
if (_kbhit()){
char x = _getch();
if ('a' == x || 's' == x || 'd' == x || 'w' == x){
drawPlaneToNull();
planeMove(x);
drawPlane();
int ggg = judgePlane();
if (ggg == 1) return;
}
else if ('p' == x) //暂停
Pause();
else if ('j' == x) //开炮
Shoot();
else if ('e' == x)
{
break;
}
}
if (0 == flag_bullet)
{
bulletMove();
drawBulletToNull();
drawBullet();
judgeEnemy();
}
flag_bullet++;
if (5 == flag_bullet)
flag_bullet = 0;
if (0 == flag_enemy)
{
drawEnemyToNull();
enemyMove();
drawEnemy();
int gggg = judgePlane();
if (gggg == 1)
{
return;
}
}
flag_enemy++;
if (flag_enemy >= rank)
flag_enemy = 0;
printScore();
}
return;
}
void Game::GameOver()
{
system("cls");
COORD p1 = { 28,9 };
COORD p2 = { 53,15 };
drawFrame(p1, p2, '=', '|');
SetPos(36, 12);
string str = "Game Over!";
for (int i = 0; i < str.size(); i++)
{
Sleep(80);
cout << str[i];
}
Sleep(1000);
system("cls");
drawFrame(p1, p2, '=', '|');
SetPos(31, 11);
cout << "击落敌机:" << score / 5 << " 架";
SetPos(31, 12);
cout << "得 分:" << score;
SetPos(31, 13);
cout << "获得称号:" << title;
Sleep(3000);
return;
}
void PlaneWar()
{
cout << "*********************************************** 雷 霆 战 机 *************************************************" << endl;
cout << " 游戏说明:" << endl;
cout << " ① 玩家通过按键w、s、a、d进行战机的移动,a为向左移动,s为向下移动,d为向右移动,w为向上移动,通过按键j进行开炮操作;" << endl;
cout << " ② 玩家需要躲避敌方战机,若有碰撞,则您的战机坠毁,游戏结束;" << endl;
cout << " ③ 玩家通过开炮可击落敌方战机,每击落一架战机,可获得5分;" << endl;
cout << " ④ 游戏得分超过200分即为游戏胜利,将获得30枚硬币的奖励,否则即为失败。" << endl << endl << endl;
Sleep(3000);
system("pause");
system("cls");
srand((int)time(0)); //随机种子
Game game;
int a = drawMenu();
if (a == 2)
game.rank = 20;
system("cls");
drawPlaying();
game.Playing(); //开始游戏
Q1 = &score;
return;
}
void color(int a)//颜色函数
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), a);
}
void gotoxy(int x, int y)//位置函数(行为x 列为y)
{
COORD pos;
pos.X = 2 * y;
pos.Y = x;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
void begin() {
system("cls");
color(11); cout << " ★";
color(10); cout << "吃豆人";
color(11); cout << "★\n\n";
color(7);
cout << " 请将窗口开至";
color(11); cout << "全屏" << endl;
color(7); cout << " 正在初始化,请耐心等待";
for (int i = 0; i <= nn; i++)
for (int j = 1; j <= nn; j++)
dis[i][j] = 900;
for (int i = 0; i <= nn; i++) {
for (int j = 0; j <= 3; j++) {
if (i + fx[j] >= 0 && i + fx[j] <= nn) {
int k = i + fx[j], xx = k / 27, yy = k % 27, kk;
if (changdi[i / 27][i % 27] && changdi[xx][yy]) dis[i][k] = kk = 1;
}
}
}
for (int k = 0; k <= nn; k++)if (changdi[k]) {
for (int i = 0; i <= nn; i++)if (changdi[i])
for (int j = 0; j <= nn; j++)if (changdi[j])
if (dis[i][j] > dis[i][k] + dis[k][j])
dis[i][j] = dis[i][k] + dis[k][j];
if (k % 80 == 0) { color(13); gotoxy(3, 12); cout << "│"; }
if (k % 80 == 20) { color(13); gotoxy(3, 12); cout << "╱"; }
if (k % 80 == 40) { color(13); gotoxy(3, 12); cout << "─"; }
if (k % 80 == 60) { color(13); gotoxy(3, 12); cout << "╲"; }
if (k % 60 == 0) { color(11); gotoxy(5, k / 60); cout << "●"; }
}
cout << "游戏操作如下:";
}
void shuru() {
char ch;
cout << "请在输入完成后点击回车";
cin >> ch;
if ((ch == '1') | (ch == 'j'))
if ((changdi[xx + fxfx[0][0]][yy + fxfx[0][1]] == 1) | (changdi[xx + fxfx[0][0]][yy + fxfx[0][1]] == 2)) fangx = nextfx = 0;
else nextfx = 0;
else if ((ch == '2') | (ch == 'k'))
if ((changdi[xx + fxfx[1][0]][yy + fxfx[1][1]] == 1) | (changdi[xx + fxfx[1][0]][yy + fxfx[1][1]] == 2)) fangx = nextfx = 1;
else nextfx = 1;
else if ((ch == '3') | (ch == 'l'))
if ((changdi[xx + fxfx[2][0]][yy + fxfx[2][1]] == 1) | (changdi[xx + fxfx[2][0]][yy + fxfx[2][1]] == 2)) fangx = nextfx = 2;
else nextfx = 2;
else if ((ch == '5') | (ch == 'i'))
if ((changdi[xx + fxfx[3][0]][yy + fxfx[3][1]] == 1) | (changdi[xx + fxfx[3][0]][yy + fxfx[3][1]] == 2)) fangx = nextfx = 3;
else nextfx = 3;
else if ((ch == '0') | (ch == 's')) stopped = (stopped + 1) % 2;
else if ((ch == '4') | (ch == 'a')) t1++;
else if ((ch == '7') | (ch == 'q')) t2++;
else if (((ch == '6') | (ch == 'd')) && t1 - 1 > 0) t1--;
else if (((ch == '9') | (ch == 'e')) && t2 - 1 > 0) t2--;
else if (ch == 'g') dali = (dali + 1) % 2;
}
void reset() {
system("cls"); color(7);
gotoxy(2, 30); cout << "控制方向:I/J/K/L";
gotoxy(4, 30); cout << "你的速度:4/6";
gotoxy(6, 30); cout << "怪物速度:7/9";
xx = 22; yy = 13;
xx1 = xx2 = xx3 = xx4 = 14;
yy5 = 11; yy2 = 12; yy3 = 14; yy4 = 15;
now = 607; now1 = 389; now2 = 390; now3 = 392; now4 = 393;
for (int k = 0; k <= nn; k++) {
int i = k / 27, j = k % 27;
gotoxy(i, j);
if (changdi[i][j] == 1) { color(7); cout << "·"; }
else if (!changdi[i][j]) { color(1); cout << "■"; }
if (j == 26) { gotoxy(i, 27); color(7); cout << i; }
}
gotoxy(0, 0);
gotoxy(xx, yy); color(14); cout << "●";
gotoxy(xx1, yy5); color(4); cout << "◆";
gotoxy(xx2, yy2); color(5); cout << "◆";
gotoxy(xx3, yy3); color(3); cout << "◆";
gotoxy(xx4, yy4); color(2); cout << "◆";
fangx = 0; T1 = T2 = guaitimer = 0; t1 = 75; t2 = 100;
stopped = 0; fenshu = 0; guozi = 237;
gg1 = gg2 = gg3 = gg4 = 0; dali = 0;
gotoxy(14, 30);
cout << " ";
}
void move1() {
int xxx, yyy;
xxx = xx + fxfx[nextfx][0]; yyy = yy + fxfx[nextfx][1];
if (changdi[xxx][yyy]) {
if (changdi[xxx][yyy] == 1) { fenshu += 1; changdi[xxx][yyy] = 2; }
color(14);
gotoxy(xx, yy); printf(" ");
gotoxy(xxx, yyy); if (!dali) printf("◎"); else printf("☆");
now = xx * 27 + yy; xx = xxx; yy = yyy;
fangx = nextfx;
}
else {
if (xx == 13 && yy == 0 && fangx == 0) { xxx = xx; yyy = 26; }
else if (xx == 13 && yy == 26 && fangx == 2) { xxx = xx; yyy = 0; }
else { xxx = xx + fxfx[fangx][0]; yyy = yy + fxfx[fangx][1]; }
if (changdi[xxx][yyy]) {
if (changdi[xxx][yyy] == 1) { fenshu += 1; changdi[xxx][yyy] = 2; }
color(14);
gotoxy(xx, yy); cout << " ";
gotoxy(xxx, yyy);
if (!dali) cout << "◎";
else cout << "☆";
now = xx * 27 + yy; xx = xxx; yy = yyy;
}
}
color(7);
}
void move2() {
int haha, minhaha, xxx, yyy, chi = 0;
if (gg1) {
minhaha = 2147483647;
if ((now1 % 27 == 0) | (now1 % 27 == 26)) haha = last1;
else if (!dali) {
for (int i = 0; i <= 3; i++)
if (changdi[(now1 + fx[i]) / 27][(now1 + fx[i]) % 27] && i != last1 && minhaha > dis[now1 + fx[i]][now])
{
minhaha = dis[now1 + fx[i]][now]; haha = i;
}
}
else {
minhaha = -minhaha;
for (int i = 0; i <= 3; i++)
if (changdi[(now1 + fx[i]) / 27][(now1 + fx[i]) % 27] && i != last1 && minhaha < dis[now1 + fx[i]][now])
{
minhaha = dis[now1 + fx[i]][now]; haha = i;
}
}
xxx = now1 / 27; yyy = now1 % 27; gotoxy(xxx, yyy);
if (changdi[xxx][yyy] == 1) cout << "·";
else cout << " ";
now1 += fx[haha]; last1 = (haha + 2) % 4;
xxx = now1 / 27; yyy = now1 % 27; gotoxy(xxx, yyy);
color(4); cout << "◆";
color(7);
if (xxx == xx && yyy == yy) {
if (!dali) chi += 1;
else {
guozi += 50;
fenshu += 50;
last1 = 0;
gotoxy(now1 / 27, now1 % 27);
if (changdi[now1 / 27][now1 % 27] == 1) printf("·"); else printf(" ");
now1 = 389;
}
}
}
if (gg2) {
int k;
minhaha = 2147483647;
if ((fangx == 0) | (fangx == 2)) {
k = yy + (fxfx[fangx][1]) * 3;
while ((k > 25) | !changdi[xx][k]) k--;
while ((k < 1) | !changdi[xx][k]) k++;
}
else {
k = xx + (fxfx[fangx][0]) * 3;
while ((k > 28) | !changdi[k][yy]) k--;
while ((k < 1) | !changdi[k][yy]) k++;
}
if ((fangx == 0) | (fangx == 2)) k = xx * 27 + k; else k = k * 27 + yy;
if ((now2 % 27 == 0) | (now2 % 27 == 26)) haha = last2;
else if (!dali)
for (int i = 0; i <= 3; i++) {
if (changdi[(now2 + fx[i]) / 27][(now2 + fx[i]) % 27] && i != last2 && minhaha > dis[now2 + fx[i]][k])
{
minhaha = dis[now2 + fx[i]][k]; haha = i;
}
}
else {
minhaha = -minhaha;
for (int i = 0; i <= 3; i++) {
if (changdi[(now2 + fx[i]) / 27][(now2 + fx[i]) % 27] && i != last2 && minhaha < dis[now2 + fx[i]][k])
{
minhaha = dis[now2 + fx[i]][k]; haha = i;
}
}
}
xxx = now2 / 27; yyy = now2 % 27; gotoxy(xxx, yyy);
if (changdi[xxx][yyy] == 1) cout << "·";
else cout << " ";
now2 += fx[haha]; last2 = (haha + 2) % 4; gotoxy(18, 30);
xxx = now2 / 27; yyy = now2 % 27; gotoxy(xxx, yyy); color(5); cout << "◆";
color(7);
if (xxx == xx && yyy == yy) {
if (!dali) chi += 1;
else {
guozi += 50;
fenshu += 50;
last2 = 0;
gotoxy(now2 / 27, now2 % 27);
if (changdi[now2 / 27][now2 % 27] == 1) cout << "·"; else cout << " ";
now2 = 390;
}
}
}
if (gg3) {
int k;
minhaha = 2147483647;
if ((fangx == 0) | (fangx == 2)) {
k = yy + (fxfx[(fangx + 1) % 4][1]) * 3;
while ((k > 25) | !changdi[xx][k]) k--;
while ((k < 1) | !changdi[xx][k]) k++;
}
else {
k = xx + (fxfx[(fangx + 1) % 4][0]) * 3;
while ((k > 28) | !changdi[k][yy]) k--;
while ((k < 1) | !changdi[k][yy]) k++;
}
if ((fangx == 0) | (fangx == 2)) k = xx * 27 + k; else k = k * 27 + yy;
if ((now3 % 27 == 0) | (now3 % 27 == 26)) haha = last3;
else if (!dali)
for (int i = 0; i <= 3; i++) {
if (changdi[(now3 + fx[i]) / 27][(now3 + fx[i]) % 27] && i != last3 && minhaha > dis[now3 + fx[i]][k])
{
minhaha = dis[now3 + fx[i]][k]; haha = i;
}
}
else {
minhaha = -minhaha;
for (int i = 0; i <= 3; i++) {
if (changdi[(now3 + fx[i]) / 27][(now3 + fx[i]) % 27] && i != last3 && minhaha < dis[now3 + fx[i]][k])
{
minhaha = dis[now3 + fx[i]][k]; haha = i;
}
}
}
xxx = now3 / 27; yyy = now3 % 27; gotoxy(xxx, yyy);
if (changdi[xxx][yyy] == 1) cout << "·"; else cout << " ";
now3 += fx[haha]; last3 = (haha + 2) % 4; gotoxy(18, 30);
xxx = now3 / 27; yyy = now3 % 27;
gotoxy(xxx, yyy); color(3); cout << "◆";
color(7);
if (xxx == xx && yyy == yy) {
if (!dali) chi += 1;
else {
guozi += 50;
fenshu += 50;
last3 = 0;
gotoxy(now3 / 27, now3 % 27);
if (changdi[now3 / 27][now3 % 27] == 1) printf("·"); else printf(" ");
now3 = 341;
}
}
}
if (chi) beichi++;
}
void ChiDouRen()
{
Q2 = &beichi;
system("color 07"); //设置背景色为黑色,字体颜色为黑色
cout << "*********************************************** 吃 豆 人 **************************************************" << endl;
cout << " 游戏说明:" << endl;
cout << " ① 玩家通过按键I、J、K、L配合回车键进行移动,J为向左移动,K为向下移动,L为向右移动,I为向上移动;" << endl;
cout << " ② 游戏胜利条件为不被怪物吃掉并且吃满35个豆子;" << endl;
cout << " ③ 被怪物吃掉后游戏不会终止,但是将失去游戏奖励,判定为游戏失败。" << endl << endl << endl;
Sleep(3000);
system("pause");
system("cls");
begin();
int jixu = 1;
reset();
string bb[4] = { "●","①","②","③" }; color(7);
gotoxy(12, 12); cout << "进入倒计时开始!";
color(12);
for (int i = 3; i >= 0; i--) { if (i == 0) color(11); gotoxy(13, 13); cout << bb[i]; Sleep(1000); }
gotoxy(12, 12); cout << " ";
gotoxy(13, 13); cout << " ";
color(7);
while (!ff) {
Sleep(1);
gotoxy(10, 30); cout << "你最后的得分是:" << fenshu;//gotoxy(行,列)坐标
gotoxy(8, 30); cout << "怪物速度: " << 300 - t2;
gotoxy(9, 30); cout << "你的速度: " << 300 - t1;
gotoxy(15, 30); cout << "被吃次数:" << beichi;
if (_kbhit()) shuru();//这个这个
if (stopped) continue;
T1 = (T1 + 1) % t1; T2 = (T2 + 1) % t2;
if ((T1 % t1 == 0 && now + fx[fangx] > 0) && (now + fx[fangx] < nn)) move1();
if (T2 % t2 == 0) {
if (guaitimer <= 8) {
if (guaitimer == 0) gg1 = 1;
if (guaitimer == 8) gg2 = 1;
guaitimer++;
}
if (!gg3 && fenshu >= 30) gg3 = 1;
move2();
}
if (fenshu == guozi || fenshu == 35)ff = 2;
}
if (ff == 2) {
Sleep(2000);
system("cls");
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 恭喜您吃完了35个豆子!!!" << endl;
Sleep(2000);
cout << "\t\t\t\t\t\t 您一共被怪物吃掉了" << beichi << " 次";
Sleep(2000);
}
}
void setdata() //数据的初始化函数
{
snake_x[0] = high / 2; snake_y[0] = width / 3; //初始化蛇头,在地图内的位置随意
snake_x[1] = high / 2; snake_y[1] = width / 3 + 1; //初始化蛇身
snake_length = 2; //蛇的原始尺寸(一格头一格身子)
food_x = high / 3, food_y = width / 3; //初始化食物的位置,在地图内位置随意
SCORE = 0;
int i, j;
Map[snake_x[0]][snake_y[0]] = 4; //蛇头
Map[snake_x[1]][snake_y[1]] = 1; //蛇身
Map[food_x][food_y] = 2; //食物
for (i = 0; i < high; i++) //墙
for (j = 0; j < width; j++)
if (i == 0 || j == 0 || i == high - 1 || j == width - 1)
Map[i][j] = 3;
}
void Gotoxy(int x, int y) //画面打印
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(handle, pos);
}
void show()
{
Gotoxy(0, 0);
int i, j;
for (i = 0; i < high; i++)
{
for (j = 0; j < width; j++)
{
if (Map[i][j] == 0)
cout << " ";
else if (Map[i][j] == 1)
cout << "+";
else if (Map[i][j] == 2)
cout << "@";
else if (Map[i][j] == 3)
cout << "*";
else if (Map[i][j] == 4)
cout << "0";
}
printf("\n");
}
printf("得分:%d", SCORE);
}
int updatewithoutinput() //与输入无关的更新
{
int i;
if (snake_x[0] == food_x && snake_y[0] == food_y)
{
SCORE++;
srand((unsigned)time(NULL)); //srand和rand函数连用产生随机数,一般以时间作为产生随机数的种子
food_x = rand() % (high - 3) + 1;
food_y = rand() % (width - 3) + 1;
Map[food_x][food_y] = 2;
snake_length++;
}
if (snake_x[0] == 0 || snake_x[0] == high - 1 || snake_y[0] == 0 || snake_y[0] == width - 1) //碰墙了
{
cout << "游戏结束!" << endl;
Sleep(2000);
return 1;
}
for (i = 1; i < snake_length; i++) //碰到自己了 ,遍历蛇身找是否和蛇头重复
if (snake_x[0] == snake_x[i] && snake_y[0] == snake_y[i])
{
cout << "游戏结束" << endl;
Sleep(2000);
return 1;
}
}
int updatewithinput()
{
int i = 1;
if (kbhit())
input = getch();
if (input != '\0') //input!='\0'(空)表示当有输入的时候开始更新画面,这是游戏开始的条件
{
if (input == 'w' || input == 'a' || input == 's' || input == 'd')
{
if (primeinput == 'w' && input == 's' || primeinput == 's' && input == 'w' || primeinput == 'a' && input == 'd' || primeinput == 'd' && input == 'a')
{
system("cls");
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 世上没有回头路!!!" << endl;
Sleep(2000);
Death++;
return 1;
}
else
primeinput = input;
}
else if (primeinput == '.')
primeinput = 'w';
else if (input == 'p')
{
while (1)
{
char op;
op = getch();
if (op == 'p')
{
input = '.';
break;
}
}
}
else if (input == '+')
{
if (op >= 50) //表示最快速度为25 ms刷新一次
op = op / 2;
}
else if (input == '-')
{
if (op <= 1000) //表示最慢速度为 2000 ms刷新一次
op = op * 2;
}
Map[snake_x[snake_length - 1]][snake_y[snake_length - 1]] = 0;//蛇走过一格,蛇尾处变为空格
for (i = snake_length - 1; i > 0; i--)
{
snake_x[i] = snake_x[i - 1]; //走过一格后蛇身的坐标覆盖前面的坐标 (从后往前覆盖,蛇头也会被蛇身覆盖)
snake_y[i] = snake_y[i - 1];
Map[snake_x[i]][snake_y[i]] = 1;
}
}
if (primeinput == 'w')
snake_x[0]--;
else if (primeinput == 's')
snake_x[0]++;
else if (primeinput == 'a')
snake_y[0]--;
else if (primeinput == 'd')
snake_y[0]++;
Map[snake_x[0]][snake_y[0]] = 4; //蛇头的坐标覆盖前面的坐标
}
void tanchishe() //起始函数
{
cout << "************************************************ 贪 吃 蛇 **************************************************" << endl;
cout << " 游戏说明:" << endl;
cout << " ① 玩家通过按键w、a、s、d控制蛇的移动,w为向上移动,s为向下移动,a为向左移动,d为向右移动;" << endl;
cout << " ② 每吃到一次果实,蛇身长度+1,得分+1;" << endl;
cout << " ③ 撞到墙壁,即蛇死亡,来到结算界面;" << endl;
cout << " ④ 单局得分超过15分,则为游戏胜利,可获得20枚硬币奖励!" << endl;
cout << " 警告:请勿自噬(蛇头反向蛇身移动,撞向蛇身不算),自噬则蛇永久死亡,无法再次游玩游戏!!!" << endl << endl << endl;
Sleep(3000);
system("pause");
system("cls");
setdata();//数据初始化
Q3 = &SCORE;
while (1)
{
show(); //画面打印
Sleep(op);
int a = updatewithoutinput(); //与输入无关的更新
int b = updatewithinput(); //与输入有关的更新
if (a == 1 || b == 1)
{
break;
}
}
return;
}
void caishuzi()
{
cout << "*********************************************** 猜 数 字 *************************************************" << endl;
cout << " 游戏说明:" << endl;
cout << " ① 游戏会出现一个1~100的随机隐藏整数,玩家需要根据技巧猜测数字;" << endl;
cout << " ② 游戏很简单,但是如果加上猜测的次数限定呢?" << endl;
cout << " ③ 若猜测次数不超过8次,则游戏胜利,玩家可获得20硬币的奖励,否则即为失败;" << endl;
cout << " ④ 若玩家运气好到爆炸,一次就猜中,则视为中了彩票,将获得200硬币的奖励!!!" << endl;
cout << " 注:若一直猜不正确,可按888退出游戏" << endl << endl << endl;
Sleep(3000);
system("pause");
system("cls"); //清屏
Guesstimes = 0; //记录猜测次数,方便程序判定游戏是否胜利
srand((unsigned)time(NULL)); //依据时间的变化产生不同的随机数种子
int NUM = rand() % 100 + 1; //随机数发生器,随机生成1~100的整型数字
while (1) //永真循环
{
cout << "*********************************************** 猜 数 字 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t请输入您猜测的数字(整数):";
int Value = Check(0); //规范用户的输入,保证输入的为数字
if (Value == 888)
{
system("cls");
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 您已强制退出!!!" << endl;
Sleep(1000);
system("cls");
Guesstimes = 999;
break;
}
if (Value > NUM)
{
system("cls");
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 猜测过大!!!" << endl;
Sleep(1000);
system("cls");
Guesstimes++;
continue;
}
else if (Value < NUM)
{
system("cls");
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 猜测过小!!!" << endl;
Sleep(1000);
system("cls");
Guesstimes++;
continue;
}
else if (Value == NUM)
{
system("cls");
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 恭喜您,猜对啦!!!" << endl;
Sleep(2000);
system("cls");
Guesstimes++;
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 您猜测的次数为:" << Guesstimes << endl;
Sleep(2000);
system("cls");
break;
}
}
return;
}
int LianAiCeShi()
{
int N, SUMS = 0;
cout << "***************************************** 恋 爱 指 数 测 试 器 *****************************************" << endl;
cout << " 测试说明:" << endl;
cout << " ① 您需要对接下来的问题进行如实回答,你的心越纯,测试的结果越正确;" << endl;
cout << " ② 下列问题如果是则输入2,如果不是则输入1,一点也没感觉则输入0;" << endl;
cout << " ③ 加油,面对你自己!*-o-*" << endl;
cout << " 注:测试共包括10道题,一旦进入测试不可退出" << endl << endl << endl;
Sleep(3000);
system("pause");
system("cls");
cout << "进入测试请按3,退出测试请按4。" << endl;
Enter:
cout << "请给出你的选择:";
int choose = Check(0);
if (choose == 3) {
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 开始测试!!!" << endl;
Sleep(2000);
system("cls");
}
else if (choose == 4) {
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 您已退出测试!!!" << endl;
Sleep(2000);
system("cls");
return 0;
}
else {
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t无效输入,请重新选择!!!" << endl;
Sleep(2000);
system("cls");
goto Enter;
}
cout << "question one:" << "你是否面对异性时会心跳加速?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question two:" << "你是否看到异性被欺负时会很愤怒?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question three:" << "你是否惧怕见到异性的家长?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question four:" << "你是否经常刷一位异性的社交平台?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question five:" << "想不想和Ta用情侣头像?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question six:" << "去过Ta家超过4小时过吗?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question seven:" << "吃过同一个饭碗里的东西吗?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question eight:" << "有过在梦里与Ta相遇吗?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question nine:" << "有为了等Ta一个人站在风雨中吗?" << endl;
N = Check(1);
SUMS += N;
cout << endl;
cout << "question ten:" << "想摸Ta的头发,牵TA的手吗?" << endl;
N = Check(1);
SUMS += N;
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 正在测评中,请稍等......" << endl;
Sleep(3000);
system("cls");
if (SUMS >= 16 && SUMS <= 20)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t你的恋爱指数为:A。你是一个深深爱着Ta的人,你往往会守着这份爱走下去^-^。" << endl;
Sleep(5000);
system("cls");
}
if (SUMS <= 15 && SUMS >= 12)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t你的恋爱指数为:B。你是一个矛盾却又不失爱意的人,你的爱往往一波三折!-!。" << endl;
Sleep(5000);
system("cls");
}
if (SUMS <= 11 && SUMS >= 7)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t 你的恋爱指数为:C。你是一个有点心思的人,你想表白,却又惧怕现实,你仍须努力o-o。" << endl;
Sleep(5000);
system("cls");
}
if (SUMS <= 6 && SUMS >= 0)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t你的恋爱指数为:D。你是一个无暇无垢,不食人间烟火的人,想一路踏歌,但道路上仍需佳人陪伴+-+。" << endl;
Sleep(5000);
system("cls");
}
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t 人生在世,恍如昨世,孤独的身影终难走远,你的那个Ta就在不远方,就如漫天繁星,总有一颗属于你!" << endl;
Sleep(2000);
cout << "\t\t\t\t\t 快抓紧你身边的那个Ta ^-^oooooo" << endl << endl << endl;
Sleep(3000);
system("pause");
peo[User].award++;
return 1;
}
void Gambler()
{
int GameCount = 0;//游戏次数
int dice1, dice2, dice3, sum;
int key1 = 0; //进入赌局的钥匙
srand((unsigned int)time(NULL)); //依据时间生成随机数的种子
cout << "*********************************************** 我 是 赌 神 *************************************************" << endl;
cout << " 赌场规则:" << endl;
cout << " ① 玩家必须缴纳5枚硬币来获取赌场通行证,并确保自己仍有剩余的硬币参与下注;" << endl;
cout << " ② 进入赌场后,玩家用硬币下注,随后会掷出三枚骰子,玩家需猜测三枚骰子之和为单数还是双数;" << endl;
cout << " ③ 猜中即可获得双倍奖励,否则将扣除双倍的硬币;" << endl;
cout << " ④ 若三枚骰子大小相同,则为大满贯,即无论您下的注是否猜中,您都将获得三倍奖励。" << endl;
cout << " 警告:进入赌场的玩家至少需进行5轮赌注,若强制退出,则视为违约,将扣除您硬币总数的一半" << endl << endl << endl;
Sleep(3000);
system("pause");//暂停游戏并熄屏
system("cls");
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t +--------------------------+" << endl;
cout << "\t\t\t\t\t | 是否进入赌场? |" << endl;
cout << "\t\t\t\t\t | 1.进入(需缴纳5枚硬币) | " << endl;
cout << "\t\t\t\t\t | 2.退出赌场 |" << endl;
cout << "\t\t\t\t\t +--------------------------+" << endl;
cout << "请输入数字实现对应的功能:";
int k = Check(2); //只返回1、2(是否进入赌场)
system("cls"); //清屏
if (k == 1 && peo[User].coin > 5)
{
peo[User].coin -= 5; //扣除5枚硬币作为入场券的费用
key1 = 1; //赌场开门
}
else if (k == 2)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 退出成功!!!" << endl;
Sleep(3000); //延时3秒
return;
}
else if (peo[User].coin <= 5)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t您的硬币不足,已强制退出" << endl;
Sleep(3000); //延时3秒
return;
}
if (key1 == 1)
{
while (1)
{
if (peo[User].coin <= 0) //判断硬币数量是否还能继续游戏
{
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 您倾家荡产,已强制退出" << endl;
Sleep(3000); //延时3秒
return;
}
int judge = 0;
cout << "*********************************************** 我 是 赌 神 *************************************************" << endl << endl;
cout << "\t\t您的硬币数量:" << peo[User].coin << "\t\t\t\t\t\t 当前下注次数:" << GameCount << endl << endl;
cout << "1.开始" << endl;
cout << "2.退出(下注未满5次会扣除您硬币总数的一半)" << endl;
cout << "请选择:";
int Choice = Check(2); //只返回1、2(是否开始游戏)
if (Choice == 1)
{
as: cout << "请输入您要压入硬币的数量(整数):";
int cn = Check(0); //规范输入 防止系统崩溃
cout << endl;
if (cn > peo[User].coin) //下注数大于硬币所有数
{
cout << "您的硬币不足!!!" << endl;
goto as;
}
cout << endl;
cout << "1.单数" << endl;
cout << "0.双数" << endl;
cout << "请下注:";
int Bat = Check(4); //只返回1、0(选择压单或双数)
system("cls");
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 赌局开始!!!" << endl;
Sleep(2000);
system("cls");
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 第" << ++GameCount << "轮骰子开始掷!" << endl;
Sleep(2000);
system("cls");
dice1 = 1 + rand() % 6;
dice2 = 1 + rand() % 6;
dice3 = 1 + rand() % 6; //随机扔三个骰子
sum = dice1 + dice2 + dice3;
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t " << dice1;
Sleep(1000);
system("cls");
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t " << dice1 << " " << dice2;
Sleep(1000);
system("cls");
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t " << dice1 << " " << dice2 << " " << dice3;
Sleep(2000);
system("cls");
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 骰子大小之和为: " << sum << endl;
Sleep(2000);
system("cls");
if (dice1 == dice2 && dice2 == dice3) //判断是否三个骰子数都相同 (即大满贯)
{
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t大满贯,获得3倍奖励!!!" << endl;
peo[User].coin += 3 * cn;
judge = 1;
Sleep(3000);
system("cls");
continue;
}
if (sum % 2 == Bat)
{
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 猜测正确,双倍奖励!!!" << endl;
peo[User].coin += 2 * cn;
Sleep(3000);
system("cls");
continue;
}
else if (sum % 2 != Bat)
{
cout << "*********************************************** 我 是 赌 神 *************************************************";
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 猜测错误,硬币扣除" << endl;
peo[User].coin -= 2 * cn;
Sleep(3000);
system("cls"); //清屏
continue;
}
} //押单则bat=1,押双数则bat=0
else if (Choice == 2) //选择退出游戏
{
if (GameCount < 5)
{
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t 警告:您游戏未满5次,已扣除硬币总数的一半!!!" << endl;
Sleep(3000); //延时3秒
peo[User].coin /= 2; //硬币扣除硬币总数一半
return;
}
else
{
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 您全身而退!!!" << endl;
Sleep(3000); //延时3秒
return;
}
}
}
}
}
int main()
{
system("color F0"); //设置背景色为白色,字体颜色为黑色
HideCursor(); //影藏光标
cout << "+------------------+" << endl;
cout << "| 满级人类 |" << endl;
cout << "| 牢大:谢牢大 |" << endl;
cout << "| 牢哥:smart_boy |" << endl;
cout << "| lsq6300 |" << endl;
cout << "| 杰哥 |" << endl;
cout << "| 李麻花 |" << endl;
cout << "| 长臂猿 |" << endl;
cout << "| 飞猪 |" << endl;
cout << "+------------------+" << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 欢迎游玩2172游戏盒!!!" << endl;
Sleep(3000); //延时3秒
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t 抵 制 不 良 游 戏 , 拒 绝 盗 版 游 戏 。" << endl;
cout << "\t\t\t\t\t 注 意 自 我 保 护 , 谨 防 受 骗 上 当 。" << endl;
cout << "\t\t\t\t\t 适 度 游 戏 益 脑 , 沉 迷 游 戏 伤 身 。" << endl;
cout << "\t\t\t\t\t 合 理 安 排 时 间 , 享 受 健 康 生 活 。" << endl;
Sleep(6000); //延时6秒
system("cls"); //清屏
while (1)
{
while (1)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t +--------------------+" << endl;
cout << "\t\t\t\t\t\t | 是否已有账号? |" << endl;
cout << "\t\t\t\t\t\t | 1.有,直接登录 | " << endl;
cout << "\t\t\t\t\t\t | 2.没有,申请注册 |" << endl;
cout << "\t\t\t\t\t\t | 0.退出程序 |" << endl;
cout << "\t\t\t\t\t\t +--------------------+" << endl;
cout << "请输入数字实现对应的功能:";
float k = Check(1); //只返回1、2、0
if (k == 1) //登录
{
system("cls"); //清屏
int a = SignIn();
if (a == 1) //选择直接进入程序
{
Key = 1; //钥匙开锁,可进入主程序
system("cls"); //清屏
break;
}
else
{
continue;
}
}
else if (k == 2) //注册
{
system("cls"); //清屏
int b = Register();
if (b == 1) //选择直接进入程序
{
Key = 1; //钥匙开锁,可进入主程序
system("cls"); //清屏
break;
}
else if (b == 2) //选择不直接进入程序
{
system("cls"); //清屏
continue;
}
}
else if (k == 0) //退出程序
{
cout << "\n你真的要退出了吗?" << endl;
cout << "1.强忍离去" << endl;
cout << "2.继续使用" << endl;
float a = Check(2);
cout << endl << endl;
if (a == 1)
{
break;
}
else if (a == 2)
{
system("cls"); //清屏
continue;
}
}
}
if (Key == 1)
{
Progress(); //进度条
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 你好," << peo[User].user << endl;
cout << "\t\t\t\t\t\t 欢迎进入游戏世界!!!" << endl;
Sleep(3000); //延时3秒
system("cls"); //清屏
while (1)
{
system("color F0"); //设置背景色为白色,字体颜色为黑色
cout << "***************************************************** 2172游戏盒 *****************************************************" << endl;
cout << "\t\t\t\t\t\t Version 8.9.11" << endl;
cout << " 玩家:" << peo[User].user << setw(15) << "硬币:" << peo[User].coin << endl;
cout << "+------------------+" << endl;
cout << "| 1.雷霆战机 |" << endl;
cout << "| 2.吃豆人 |" << endl;
cout << "| 3.贪吃蛇 |" << endl;
cout << "| 4.猜数字 |" << endl;
cout << "| 5.恋爱测试 |" << endl;
cout << "| 6.我是赌神 |" << endl;
cout << "| |" << endl;
cout << "| |" << endl;
cout << "| 9.退出登录 |" << endl;
cout << "| 0.退出程序 |" << endl;
cout << "+------------------+" << endl;
cout << "请输入您要游玩的游戏编号:";
double n = Check(0);
cout << endl << endl;
if (n == 1)
{
system("cls"); //清屏
PlaneWar();
system("cls"); //清屏
if (*Q1 > 200)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏胜利,硬币+30" << endl;
Sleep(3000);
system("cls"); //清屏
peo[User].coin += 30;
continue;
}
else
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏失败,继续加油" << endl;
Sleep(3000);
system("cls"); //清屏
continue;
}
}
else if (n == 2)
{
system("cls"); //清屏
ChiDouRen();
system("cls"); //清屏
if (*Q2 == 0)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏胜利,硬币+10" << endl;
Sleep(3000);
system("cls"); //清屏
peo[User].coin += 10;
continue;
}
else
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏失败,继续加油" << endl;
Sleep(3000);
system("cls"); //清屏
continue;
}
}
else if (n == 3)
{
system("cls"); //清屏
if (Death == 1)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 蛇已死,自噬无法复活!!!" << endl;
Sleep(3000);
system("cls"); //清屏
}
else if (Death == 0)
{
tanchishe();
system("cls"); //清屏
if (*Q3 > 15)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏胜利,硬币+20" << endl;
Sleep(3000);
system("cls"); //清屏
peo[User].coin += 10;
continue;
}
else
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏失败,继续加油" << endl;
Sleep(3000);
system("cls"); //清屏
continue;
}
}
}
else if (n == 4)
{
system("cls"); //清屏
caishuzi();
system("cls"); //清屏
if (Guesstimes == 1)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 您运气爆棚,硬币+200" << endl;
Sleep(3000);
system("cls"); //清屏
peo[User].coin += 200;
continue;
}
else if (Guesstimes <= 8)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏胜利,硬币+20" << endl;
Sleep(3000);
system("cls"); //清屏
peo[User].coin += 20;
continue;
}
else
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 游戏失败,继续加油" << endl;
Sleep(3000);
system("cls"); //清屏
continue;
}
}
else if (n == 5)
{
system("cls"); //清屏
int GETG = LianAiCeShi();
system("cls"); //清屏
if (GETG == 1 && peo[User].award == 1)
{
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 恋爱测试结束!!!" << endl;
Sleep(2000);
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t 赠送您50硬币,祝您早日找到那个TA!!!" << endl;
Sleep(2000);
peo[User].coin += 50;
system("cls"); //清屏
}
continue;
}
else if (n == 6)
{
system("cls"); //清屏
Gambler();
if (peo[User].coin < 0)
{
peo[User].coin = 0; //硬币下限为0
}
system("cls"); //清屏
continue;
}
else if (n == 9)
{
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 存档中......" << endl;
Sleep(2000); //延时2秒
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 账号已退出!!!" << endl;
Sleep(2000); //延时2秒
system("cls"); //清屏
Key = 0; //程序关锁
KeyOut = 1; //钥匙开锁,退出登录
break;
}
else if (n == 0)
{
cout << "你真的要退出了吗?" << endl;
cout << "1.强忍离去" << endl;
cout << "2.继续使用" << endl;
float a = Check(2);
cout << endl << endl;
if (a == 1)
{
break;
}
else if (a == 2)
{
system("cls"); //清屏
continue;
}
}
else if (n == 12321) //查看所有玩家的信息
{
system("cls"); //清屏
cout << setw(10) << "序号" << setw(16) << "用户名" << setw(16) << "密码" << setw(10) << "硬币" << endl;
for (int i = 0; i < x; i++)
{
cout << setw(10) << peo[i].number << setw(16) << peo[i].user << setw(16) << peo[i].password << setw(10) << peo[i].coin << endl;
}
system("pause");
system("cls"); //清屏
}
else if (n == 12345)
{
system("cls"); //清屏
cout << setw(10) << "编号" << setw(16) << "用户名" << setw(16) << "密码" << setw(10) << "硬币" << endl;
for (int i = 0; i < x; i++)
{
cout << setw(10) << peo[i].number << setw(16) << peo[i].user << setw(16) << peo[i].password << setw(10) << peo[i].coin << endl;
}
cout << endl << endl << "请输入要修改信息的玩家编号:";
int fo = Check(0) - 1;
cout << endl;
cout << "请输入要修改的信息:" << endl;
cout << "1.用户名" << endl;
cout << "2.密码" << endl;
cout << "3.硬币" << endl;
int ko = Check(3);
if (ko == 1)
{
cout << endl << "用户名修改为:";
char us1[1000];
cin.get();
cin.getline(us1, 1000);
strcpy(peo[fo].user, us1);
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 正在处理,请稍等......" << endl;
Sleep(2000); //等待2秒
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 修改成功!!!" << endl;
}
else if (ko == 2)
{
cout << endl << "密码修改为:";
char us2[1000];
cin.get();
cin.getline(us2, 1000);
strcpy(peo[fo].password, us2);
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 正在处理,请稍等......" << endl;
Sleep(2000); //等待2秒
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 修改成功!!!" << endl;
}
else if (ko == 3)
{
cout << endl << "硬币数量修改为:";
long long us3 = Check(0);
peo[fo].coin = us3;
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 正在处理,请稍等......" << endl;
Sleep(2000); //等待2秒
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t\t 修改成功!!!" << endl;
}
Sleep(2000);
system("cls"); //清屏
}
else
{
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
cout << "\t\t\t\t\t 您输入的数字不在菜单中,请重新输入!!!" << endl;
Sleep(2000);
system("cls"); //清屏
}
}
}
if (KeyOut == 1)
{
KeyOut = 0; //钥匙使用过后关锁,以便后续使用
continue;
}
else if (KeyOut == 0)
{
system("cls"); //清屏
cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << "\t\t\t\t\t\t 期待您的下次游玩!" << endl;
Sleep(3000); //延时3秒
break;
}
}
return 0;
}
4.恶魔轮盘
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#define random(a,b) (rand()%(b-a+1)+a)
using namespace std ;
int a1[100],a2[100];
void daoju(int n,int i) {
//1 啤酒 2 刀 3 手铐 4 放大镜 5 华子
int a;
a= random(1,5);
if(n==1) {
if(a==1 ) {
cout<<"啤酒";
a1[1]++;
} else if(a==2) {
a1[2]++;
cout<<"刀";
} else if(a==3) {
cout<<"手铐";
a1[3]++;
} else if(a==5) {
a1[5]++;
cout<<"华子";
} else if(a==4) {
a1[4]++;
cout<<"放大镜";
}
} else {
if(a==1 ) {
cout<<"啤酒";
a2[1]++;
} else if(a==2) {
a2[2]++;
cout<<"刀";
} else if(a==3) {
a2[3]++;
cout<<"手铐";
} else if(a==5) {
a2[5]++;
cout<<"华子";
} else if(a==4) {
a2[4]++;
cout<<"放大镜";
}
}
}
void printsetence(string &text, int interval) {
int n = text.length();
for (int i=0; i<n; i++) {
cout<<text[i];
Sleep(interval);
}
return;
}
int main() {
ch1:
string n,m,duzhu;
system("color 87") ;
system("pause") ;
system("cls");
string text = "开始游戏";
printsetence(text,25);
cout<<endl;
system("pause");
system("cls");
system("color 87") ;
text = "欢迎来到恶魔轮盘赌,请双方玩家签名";
printsetence(text,25);
cout<<endl;
cout<<"p1:";
cin>>n;
cout<<endl;
cout<<"p2:";
cin>>m;
system("pause");
system("cls");
system("color 87") ;
text = "赌注: ";
printsetence(text,25);
cin>>duzhu;
system("pause");
system("cls");
system("color 87") ;
text = "正在随机分配谁先";
printsetence(text,25);
system("pause");
system("cls");
system("color 87") ;
cout<<"p";
int p;
srand((unsigned)time(NULL));
p=random(1,2);
cout<<p;
cout<<"先"<<endl;
system("pause");
system("cls");
system("color 87") ;
text = "正在随机分配道具";
printsetence(text,25);
cout<<"p1:";
for(int i=0; i<4; i++) {
daoju(1,i);
cout<<" ";
}
cout<<endl;
text = "正在随机分配道具";
printsetence(text,25);
cout<<"p2:";
for(int i=0; i<4; i++) {
daoju(2,i);
cout<<" ";
}
cout<<endl;
int a;
int x1=5,x2=5;
int bj=0;
int sk1=0,sk2=0;
if(p==1) {
while(x1>0 && x2>0) {
int zd[6],kong=0,shi=0;
for(int i=0; i<6; i++) {
zd[i]=random(1,2);
if(zd[i]==1) {
shi++;
} else {
kong++;
}
}
system("pause");
system("cls");
system("color 87") ;
cout<<shi<<"发实弹,"<<kong<<"发空弹"<<endl;
system("pause");
system("cls");
system("color 87");
int i=5;
while(i+1!=0) {
if(sk1!=1) {
cout<<"p1,你要(1 啤酒 2 刀 3 手铐 4 放大镜 5 华子 6 开枪 7 自杀):"<<endl;
cin>>a;
if(a<6) {
if(a==1) {
i--;
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else if(a==3) {
sk2=1;
} else if(a==5) {
x1++;
} else if(a==2) {
if(zd[i]==1) {
x2-=2;
i--;
cout<<"双倍快乐,p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else {
cout<<"下一发是";
if(zd[i]==1) {
cout<<"实弹"<<endl;
} else {
cout<<"空弹"<<endl;
}
int xz;
system("pause");
system("cls");
system("color 87") ;
text = "你要_____(1 开枪 2 自杀)";
printsetence(text,25);
if(xz==1) {
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else {
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
}
}
} else if(a==6) {
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else {
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
}
} else {
sk1=0;
}
if(x1<=0) {
cout<<"p1你死了";
system("pause");
system("cls");
system("color F4") ;
text = "请输的那方完成赌注";
printsetence(text,25);
return 1;
} else if(x2<=0) {
cout<<"p2你死了";
system("pause");
system("cls");
system("color F4") ;
text = "请输的那方完成赌注";
printsetence(text,25);
return 1;
}
system("pause");
system("cls");
system("color 87") ;
if(sk2!=1) {
cout<<"p2,你要(1 啤酒 2 刀 3 手铐 4 放大镜 5 华子 6 开枪 7 自杀):"<<endl;
cin>>a;
if(a<6) {
if(a==1) {
i--;
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else if(a==3) {
sk1=1;
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else if(a==5) {
x2++;
} else if(a==2) {
if(zd[i]==1) {
x1-=2;
i--;
cout<<"双倍快乐,p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
}else {
cout<<"下一发是";
if(zd[i]==1) {
cout<<"实弹"<<endl;
} else {
cout<<"空弹"<<endl;
}
int xz;
system("pause");
system("cls");
system("color 87") ;
text = "你要_____(1 开枪 2 自杀)";
printsetence(text,25);
if(xz==1) {
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else {
if(zd[i]==2) {
x1--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
}
}
} else if(a==6) {
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else {
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
}
system("pause");
system("cls");
system("color 87") ;
} else {
sk2=0;
}
}
if(x1<=0) {
system("pause");
system("cls");
system("color F4") ;
text = "请输的那方完成赌注";
printsetence(text,25);
cout<<"p1你死了";
} else if(x2<=0) {
system("pause");
system("cls");
system("color F4") ;
text = "请输的那方完成赌注";
printsetence(text,25);
cout<<"p2你死了";
}
}
} else {
while(x1>0 && x2>0) {
int zd[6],kong=0,shi=0;
for(int i=0; i<6; i++) {
zd[i]=random(1,2);
if(zd[i]==1) {
shi++;
} else {
kong++;
}
}
system("pause");
system("cls");
system("color 87") ;
cout<<shi<<"发实弹,"<<kong<<"发空弹"<<endl;
system("pause");
system("cls");
system("color 87");
int zds=6,i=5;
while(zds--) {
if(sk2!=1) {
cout<<"p2,你要(1 啤酒 2 刀 3 手铐 4 放大镜 5 华子 6 开枪 7 自杀):"<<endl;
cin>>a;
if(a<6) {
if(a==1) {
i--;
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else if(a==3) {
sk1=1;
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else if(a==5) {
x2++;
} else if(a==2) {
if(zd[i]==1) {
x1-=2;
i--;
cout<<"双倍快乐,p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
}else {
cout<<"下一发是";
if(zd[i]==1) {
cout<<"实弹"<<endl;
} else {
cout<<"空弹"<<endl;
}
int xz;
system("pause");
system("cls");
system("color 87") ;
text = "你要_____(1 开枪 2 自杀)";
printsetence(text,25);
if(xz==1) {
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else {
if(zd[i]==2) {
x1--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
}
}
} else if(a==6) {
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹";
}
} else {
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹";
}
}
if(x1<=0) {
cout<<"p1你死了";
system("pause");
system("cls");
system("color F4") ;
text = "请输的那方完成赌注";
printsetence(text,25);
return 1;
} else if(x2<=0) {
cout<<"p2你死了";
system("pause");
system("cls");
system("color F4") ;
text = "请输的那方完成赌注";
printsetence(text,25);
return 1;
}
} else {
sk2=0;
}
system("pause");
system("cls");
system("color 87") ;
if(sk1!=1) {
cout<<"p1,你要(1 啤酒 2 刀 3 手铐 4 放大镜 5 华子 6 开枪 7 自杀):"<<endl;
cin>>a;
if(a<6) {
if(a==1) {
i--;
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else if(a==3) {
sk2=1;
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else if(a==5) {
x1++;
} else if(a==2) {
if(zd[i]==1) {
x2-=2;
i--;
cout<<"双倍快乐,p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
}else {
cout<<"下一发是";
if(zd[i]==1) {
cout<<"实弹"<<endl;
} else {
cout<<"空弹"<<endl;
}
int xz;
system("pause");
system("cls");
system("color 87") ;
text = "你要_____(1 开枪 2 自杀)";
printsetence(text,25);
if(xz==1) {
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else {
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
}
}
} else if(a==6) {
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹";
}
} else {
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹";
}
}
} else {
sk1=0;
}
}
system("pause");
system("cls");
system("color 87") ;
if(x1<=0) {
cout<<"p1你死了";
system("pause");
system("cls");
system("color F4") ;
text = "请输的那方完成赌注";
printsetence(text,25);
return 1;
} else if(x2<=0) {
cout<<"p2你死了";
system("pause");
system("cls");
system("color F4") ;
text = "请输的那方完成赌注";
printsetence(text,25);
return 1;
}
}
}
return 1;
}
//做完日期2024.2.21——作者 20:29 1.0.0版
// 做完日期2024.2.21——作者 20:45 1.0.1版
//不能用道具
//开始做能用道具-日期2024.2.21 作者 20:46
//可用道具“啤酒”
//代码:
/*
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#define random(a,b) (rand()%(b-a+1)+a)
using namespace std ;
int a1[100],a2[100];
void daoju(int n,int i) {
//1 啤酒 2 刀 3 手铐 4 放大镜 5 华子
int a;
a= random(1,5);
if(n==1) {
if(a==1 ) {
cout<<"啤酒";
a1[i]=1;
} else if(a==2) {
a1[i]=2;
cout<<"刀";
} else if(a==3) {
cout<<"手铐";
a1[i]=3;
} else if(a==5) {
a1[i]=5;
cout<<"华子";
} else if(a==4) {
a1[i]=4;
cout<<"放大镜";
}
} else {
if(a==1 ) {
cout<<"啤酒";
a2[i]=1;
} else if(a==2) {
a2[i]=2;
cout<<"刀";
} else if(a==3) {
a2[i]=3;
cout<<"手铐";
} else if(a==5) {
a2[i]=5;
cout<<"华子";
} else if(a==4) {
a2[i]=4;
cout<<"放大镜";
}
}
}
void printsetence(string &text, int interval) {
int n = text.length();
for (int i=0; i<n; i++) {
cout<<text[i];
Sleep(interval);
}
return;
}
int main() {
ch1:
string n,m,duzhu;
system("color 87") ;
system("pause") ;
system("cls");
string text = "开始游戏";
printsetence(text,25);
cout<<endl;
system("pause");
system("cls");
system("color 87") ;
text = "欢迎来到恶魔轮盘赌,请双方玩家签名";
printsetence(text,25);
cout<<endl;
cout<<"p1:";
cin>>n;
cout<<endl;
cout<<"p2:";
cin>>m;
system("pause");
system("cls");
system("color 87") ;
text = "赌注: ";
printsetence(text,25);
cin>>duzhu;
system("pause");
system("cls");
system("color 87") ;
text = "正在随机分配谁先";
printsetence(text,25);
system("pause");
system("cls");
system("color 87") ;
cout<<"p";
int p;
srand((unsigned)time(NULL));
p=random(1,2);
cout<<p;
cout<<"先"<<endl;
system("pause");
system("cls");
system("color 87") ;
text = "正在随机分配道具";
printsetence(text,25);
cout<<"p1:";
for(int i=0; i<4; i++) {
daoju(1,i);
cout<<" ";
}
cout<<endl;
text = "正在随机分配道具";
printsetence(text,25);
cout<<"p2:";
for(int i=0; i<4; i++) {
daoju(2,i);
cout<<" ";
}
cout<<endl;
int a;
int x1=5,x2=5;
int bj=0;
if(p==1) {
while(x1>0 && x2>0) {
int zd[6],kong=0,shi=0;
for(int i=0; i<6; i++) {
zd[i]=random(1,2);
if(zd[i]==1) {
shi++;
} else {
kong++;
}
}
system("pause");
system("cls");
system("color 87") ;
cout<<shi<<"发实弹,"<<kong<<"发空弹"<<endl;
system("pause");
system("cls");
system("color 87");
int i=5;
while(i+1!=0) {
cout<<"p1,你要(1 啤酒 2 刀 3 手铐 4 放大镜 5 华子 6 开枪 7 自杀):"<<endl;
cin>>a;
if(a<6) {
i--;
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else if(a==6) {
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else {
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
}
if(x1==0) {
cout<<"p1你死了";
return 1;
} else if(x2==0) {
cout<<"p2你死了";
return 1;
}
system("pause");
system("cls");
system("color 87") ;
cout<<"p2,你要(1 啤酒 2 刀 3 手铐 4 放大镜 5 华子 6 开枪 7 自杀):"<<endl;
cin>>a;
if(a<6) {
i--;
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else if(a==6) {
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else {
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
}
system("pause");
system("cls");
system("color 87") ;
}
if(x1==0) {
cout<<"p1你死了";
} else if(x2==0) {
cout<<"p2你死了";
}
}
} else {
while(x1>0 && x2>0) {
int zd[6],kong=0,shi=0;
for(int i=0; i<6; i++) {
zd[i]=random(1,2);
if(zd[i]==1) {
shi++;
} else {
kong++;
}
}
system("pause");
system("cls");
system("color 87") ;
cout<<shi<<"发实弹,"<<kong<<"发空弹"<<endl;
system("pause");
system("cls");
system("color 87");
int zds=6,i=5;
while(zds--) {
cout<<"p2,你要(1 啤酒 2 刀 3 手铐 4 放大镜 5 华子 6 开枪 7 自杀):"<<endl;
cin>>a;
if(a<6) {
i--;
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else if(a==6) {
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹";
}
} else {
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹";
}
}
if(x1==0) {
cout<<"p1你死了";
return 1;
} else if(x2==0) {
cout<<"p2你死了";
return 1;
}
system("pause");
system("cls");
system("color 87") ;
cout<<"p1,你要(1 啤酒 2 刀 3 手铐 4 放大镜 5 华子 6 开枪 7 自杀):"<<endl;
cin>>a;
if(a<6) {
i-- ;
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹"<<endl;
}
} else if(a==6) {
if(zd[i]==1) {
x2--;
i--;
cout<<"p2还剩"<<x2<<"血"<<endl;
} else {
i--;
cout<<"这是空弹";
}
} else {
if(zd[i]==1) {
x1--;
i--;
cout<<"p1还剩"<<x1<<"血"<<endl;
} else {
i--;
cout<<"这是空弹";
}
}
}
system("pause");
system("cls");
system("color 87") ;
if(x1==0) {
cout<<"p1你死了";
return 1;
} else if(x2==0) {
cout<<"p2你死了";
return 1;
}
}
}
return 1;
}
*/
//2024.2.22 1.0.2 更新
//2024 .2.22 可用刀,华子,手铐,啤酒1.0.3版
//2024.2.22 开始做放大镜
//2024.2.22 做完放大镜1.0版 (现以可以使用全部道具)
//修复BUG
//恶魔轮盘赌1.0.5 更新
//以可以做基本操作
5.勇士世界
#include<iostream>
#include<conio.h>
#include<windows.h>
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<string.h>
using namespace std;
int main()
{
int o,j,p,n,sh=5,sm=40,dm=0;
long long jb=0,bs=0,lj=0,sj=0,emzr=0,hyj=0,jssj=0,pgj=0,szj=0,hjj=0,zspf=0,hy=0,hfhzj=0,bd=1,ylb=1,zd=1,tnt=1;
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
Sleep(100);
cout<<" 这";
Sleep(400);
cout<<"是";
Sleep(100);
cout<<"一";
Sleep(100);
cout<<"个";
Sleep(100);
cout<<"勇";
Sleep(100);
cout<<"者";
Sleep(100);
cout<<"的";
Sleep(100);
cout<<"世";
Sleep(100);
cout<<"界";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
Sleep(200);
cout<<" 你";
Sleep(200);
cout<<"想";
Sleep(200);
cout<<"来";
Sleep(200);
cout<<"挑";
Sleep(200);
cout<<"战";
Sleep(200);
cout<<"一";
Sleep(200);
cout<<"下";
Sleep(200);
cout<<"吗";
Sleep(200);
cout<<"? 制作用时:5小时\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_RED);
Sleep(400);
cout<<" 确";
Sleep(400);
cout<<"认";
Sleep(400);
cout<<"输";
Sleep(400);
cout<<"入";
Sleep(400);
cout<<"1,";
Sleep(400);
cout<<"否";
Sleep(400);
cout<<"则";
Sleep(400);
cout<<"输";
Sleep(400);
cout<<"入";
Sleep(400);
cout<<"2";
cin>>o;
if(o==2)
{ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_RED);
cout<<"你不行啊!\n";
}
if(o==1)
{
zcd:
for(;;)
{
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<" \n";
cout<<" ----------------*主菜单*---------------- 如果你是新手,请在主菜单输入‘5 ’\n";
cout<<" |1.移动 2.查看背包 3.回血 4.战斗 5.其他| 进入其他,在其他里输入数字‘2 ’ \n";
cout<<" --------------祝您玩的开心-------------- 进入游戏相关信息,了解游戏规则 \n";
cout<<" \n";
cin>>o;
if(o==1)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto yd;
}
if(o==2)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto ckbb;
}
if(o==3)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto hx;
}
if(o==4)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zd;
}
if(o==5)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto qt;
}
yd:
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<" -------------*请选择*------------------------- \n";
cout<<" | 1.铁匠铺 2.盔甲铺 3.技能店 4.返回主菜单 | \n";
cout<<" -----------祝您玩的开心----------------------- \n";
cin>>j;
if(j==1)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto tjp;
}
if(j==2)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto kjp;
}
if(j==3)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto jnd;
}
if(j==4)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
tjp:
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<" -------------*铁匠铺*------------------------------------------------------------------------------------- \n";
cout<<" | 1.匕首(50金币,+2伤害)2.利剑(80金币,+3伤害)3.圣剑(120金币,+5伤害)4.恶魔之刃(200金币,+7伤害) | \n";
cout<<" | 5.火焰剑(300金币,+10伤害)6.绝世圣剑(500金币,+20伤害) 7.返回主菜单 | \n";
cout<<" ------------------------------祝您玩的开心---------------------------------------------------------------- \n";
cin>>p;
if(p==1)
{
if(jb>=50)
{
bs++;jb-=50;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了匕首,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==2)
{
if(jb>=80)
{
lj++;jb-=80;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了利剑,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==3)
{
if(jb>=120)
{
sj++;jb-=120;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了圣剑,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==4)
{
if(jb>=200)
{
emzr++;jb-=200;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了恶魔之刃,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==5)
{
if(jb>=300)
{
hyj++;jb-=300;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了火焰剑,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==6)
{
if(jb>=500)
{
jssj++;jb-=500;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了绝世圣剑,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==7)
{
goto zcd;
}
kjp:
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<" -------------*盔甲铺*--------------------------------------------------------------------------------------------- \n";
cout<<" | 1.皮革甲(50金币,+4防御)2.锁子甲(80金币,+6防御)3.黄金甲(120金币,+10防御)4.钻石披风(200金币,+14防御) | \n";
cout<<" | 5.火焰甲(300金币,+20防御)6.火凤凰之甲(500金币,+40防御) 7.返回主菜单 | \n";
cout<<" ------------------------------祝您玩的开心------------------------------------------------------------------------ \n";
cin>>p;
if(p==1)
{
if(jb>=50)
{
pgj++;jb-=50;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了皮革甲,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==2)
{
if(jb>=80)
{
szj++;jb-=80;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了锁子甲,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==3)
{
if(jb>=120)
{
hjj++;jb-=120;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了黄金甲,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==4)
{
if(jb>=200)
{
zspf++;jb-=200;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了钻石披风,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==5)
{
if(jb>=300)
{
hy++;jb-=300;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了火焰甲,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==6)
{
if(jb>=500)
{
hfhzj++;jb-=500;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了火凤凰之甲,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==7)
{
goto zcd;
}
jnd:
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<" -------------*技能店*------------------------ \n";
cout<<" |1.绷带 2.医疗包 3.炸弹 4.手雷 5.返回主菜单 | \n";
cout<<" |150金币 250金币 200金币 300金币 | \n";
cout<<" -----------祝您玩的开心---------------------- \n";
cin>>p;
if(p==1)
{
if(jb>=150)
{
bd++;jb-=150;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了绷带,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==2)
{
if(jb>=250)
{
ylb++;jb-=250;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了医疗包,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==3)
{
if(jb>=200)
{
zd++;jb-=200;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了炸弹,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==4)
{
if(jb>=300)
{
tnt++;jb-=300;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"您购买了手雷,您现在有"<<jb<<"金币\n";
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"您没有足够的金币\n";
}
Sleep(800);
goto zcd;
}
if(p==5)
{
goto zcd;
}
ckbb:
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
Sleep(100);
cout<<" ----------背包---------\n";
Sleep(100);
cout<<" 您有"<<jb<<"个金币 \n\n";
Sleep(100);
cout<<" 您有"<<sh<<"伤害(包括武器) \n";
Sleep(100);
cout<<" 您有"<<sm<<"血量(包括防具) \n\n";
Sleep(100);
cout<<" 您有"<<bs<<"个匕首(输入1装备,+2伤害) \n";
Sleep(100);
cout<<" 您有"<<lj<<"个利剑(输入2装备,+3伤害) \n";
Sleep(100);
cout<<" 您有"<<sj<<"个圣剑(输入3装备,+5伤害) \n";
Sleep(100);
cout<<" 您有"<<emzr<<"个恶魔之刃(输入4装备,+7伤害) \n";
Sleep(100);
cout<<" 您有"<<hyj<<"个火焰剑(输入5装备,+10伤害) \n";
Sleep(100);
cout<<" 您有"<<jssj<<"个绝世圣剑(输入6装备,+20伤害) \n\n";
Sleep(100);
cout<<" 您有"<<pgj<<"个皮革甲(输入7装备,+4防御) \n";
Sleep(100);
cout<<" 您有"<<szj<<"个锁子甲(输入8装备,+6防御) \n";
Sleep(100);
cout<<" 您有"<<hjj<<"个黄金甲(输入9装备,+10防御) \n";
Sleep(100);
cout<<" 您有"<<zspf<<"个钻石披风(输入10装备,+14防御) \n";
Sleep(100);
cout<<" 您有"<<hy<<"个火焰甲(输入11装备,+20防御) \n";
Sleep(100);
cout<<" 您有"<<hfhzj<<"个火凤凰之甲(输入12装备,+40防御) \n\n";
Sleep(100);
cout<<" 您有"<<bd<<"个绷带(回复5血) \n";
Sleep(100);
cout<<" 您有"<<ylb<<"个医疗包(回复10滴血) \n";
Sleep(100);
cout<<" 您有"<<zd<<"个炸弹(造成8伤害) \n";
Sleep(100);
cout<<" 您有"<<tnt<<"个手雷(造成15伤害) \n\n";
Sleep(100);
cout<<"输入13,返回主菜单\n";
system("color 3F");
cin>>j;
if(j==1)
{
if(bs>=1)
{
sh=7;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<" 正在装备中,请稍等...\n";
Sleep(1200);
cout<<" 装备成功\n\n";
Sleep(800);
goto zcd;
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"武器或装备数量小于1,装备失败\n";
Sleep(800);
goto zcd;
}
}
if(j==2)
{
if(lj>=1)
{
sh=8;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<" 正在装备中,请稍等...\n";
Sleep(1200);
cout<<" 装备成功\n\n";
Sleep(800);
goto zcd;
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"武器或装备数量小于1,装备失败\n";
Sleep(800);
goto zcd;
}
}
if(j==3)
{
if(sj>=1)
{
sh=10;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<" 正在装备中,请稍等...\n";
Sleep(1200);
cout<<" 装备成功\n\n";
Sleep(800);
goto zcd;
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"武器或装备数量小于1,装备失败\n";
Sleep(800);
goto zcd;
}
}
if(j==4)
{
if(emzr>=1)
{
sh=12;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<" 正在装备中,请稍等...\n";
Sleep(1200);
cout<<" 装备成功\n\n";
Sleep(800);
goto zcd;
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"武器或装备数量小于1,装备失败\n";
Sleep(800);
goto zcd;
}
}
if(j==5)
{
if(hyj>=1)
{
sh=15;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<" 正在装备中,请稍等...\n";
Sleep(1200);
cout<<" 装备成功\n\n";
Sleep(800);
goto zcd;
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"武器或装备数量小于1,装备失败\n";
Sleep(800);
goto zcd;
}
}
if(j==6)
{
if(jssj>=1)
{
sh=25;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<" 正在装备中,请稍等...\n";
Sleep(1200);
cout<<" 装备成功\n\n";
Sleep(800);
goto zcd;
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"武器或装备数量小于1,装备失败\n";
Sleep(800);
goto zcd;
}
}
if(j==7)
{
if(pgj>=1)
{
sm=44;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<" 正在装备中,请稍等...\n";
Sleep(1200);
cout<<" 装备成功\n\n";
Sleep(800);
goto zcd;
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"武器或装备数量小于1,装备失败\n";
Sleep(800);
goto zcd;
}
}
if(j==8)
{
if(szj>=1)
{
sm=46;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<" 正在装备中,请稍等...\n";
Sleep(1200);
cout<<" 装备成功\n\n";
Sleep(800);
goto zcd;
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"武器或装备数量小于1,装备失败\n";
Sleep(800);
goto zcd;
}
}
if(j==9)
{
if(hjj>=1)
{
sm=50;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<" 正在装备中,请稍等...\n";
Sleep(1200);
cout<<" 装备成功\n\n";
Sleep(800);
goto zcd;
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"武器或装备数量小于1,装备失败\n";
Sleep(800);
goto zcd;
}
}
if(j==10)
{
if(zspf>=1)
{
sm=54;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<" 正在装备中,请稍等...\n";
Sleep(1200);
cout<<" 装备成功\n\n";
Sleep(800);
goto zcd;
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"武器或装备数量小于1,装备失败\n";
Sleep(800);
goto zcd;
}
}
if(j==11)
{
if(hy>=1)
{
sm=60;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<" 正在装备中,请稍等...\n";
Sleep(1200);
cout<<" 装备成功\n\n";
Sleep(800);
goto zcd;
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"武器或装备数量小于1,装备失败\n";
Sleep(800);
goto zcd;
}
}
if(j==12)
{
if(hfhzj>=1)
{
sm=80;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<" 正在装备中,请稍等...\n";
Sleep(1200);
cout<<" 装备成功\n\n";
Sleep(800);
goto zcd;
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"武器或装备数量小于1,装备失败\n";
Sleep(800);
goto zcd;
}
}
if(j==13)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
hx:
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
Sleep(400);
cout<<" ---------------介绍--------------- \n";
Sleep(400);
cout<<" 每次战斗后血量不会重置会一直保持,\n";
Sleep(400);
cout<<" 如果不回血的话一直战斗有可能会死,\n";
Sleep(400);
cout<<" 死了掉落所有金币和所有武器和装备,\n";
Sleep(400);
cout<<" 以防万一您务必要花金币回血150金币,\n";
Sleep(400);
cout<<" 回完血后盔甲会自动掉落,请你重新装备盔甲\n";
Sleep(400);
cout<<" 请选择\n1.回满血 2.返回主菜单\n";
cin>>j;
if(j==1)
{
if(jb>=150)
{
jb-=150;
system("color 3F");
sm=40;
Sleep(1000);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"正在回血中\n";
Sleep(1000);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<" 1 \n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
Sleep(1000);
cout<<" 2 \n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_RED|BACKGROUND_GREEN);
Sleep(1000);
cout<<" 3 \n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_RED|BACKGROUND_RED);
Sleep(1000);
cout<<" 4 \n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_RED|BACKGROUND_BLUE);
Sleep(1000);
cout<<" 5 \n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_RED|BACKGROUND_BLUE);
Sleep(1000);
cout<<"回血完毕\n";
Sleep(500);
goto zcd;
}
else
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"金币不足,不能回血\n\n";
Sleep(700);
goto zcd;
}
if(j==2)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
zd:
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<" 战斗 "<<endl;
cout<<" 1.大狼 2.野蛮人 3.史莱姆 4.巨人 5.森林巨人 "<<endl;
cout<<" 6.森林巨人王 7.深海巨龙 8.九头大蛇 9.三头龙 "<<endl;
cout<<" 注意:数字越大,越难打!!! "<<endl;
cout<<" ---请你输入"<<endl;
cin>>j;
if(j==1)
{
dm=10;
for(;;)
{
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"战斗开始,大狼\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"1.攻击 2.使用技能\n";
cin>>p;
if(p==1)
{
dm-=sh;
sm-=3;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"正在打斗中,请稍等...\n";
Sleep(1500);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"敌方对你造成了3点伤害\n";
cout<<"我方生命值"<<sm<<"\n";
Sleep(300);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"你对敌方造成了"<<sh<<"点伤害\n";
cout<<"敌方生命值"<<dm<<"\n";
}
if(p==2)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"1.绷带 2.医疗包 3.炸弹 (在第一关禁止使用手雷)\n";
cin>>n;
if(n==1)
{
if(bd>=1)
{
sm+=5;
bd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了绷带,加了5血\n";
}
}
if(n==2)
{
if(ylb>=1)
{
sm+=10;
ylb--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了医疗包,加了10血\n";
}
}
if(n==3)
{
if(zd>=1)
{
dm-=8;
zd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了炸弹,造成8伤害\n";
}
}
}
Sleep(1000);
if(sm<=0)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你被敌方击败了,不幸牺牲\n“你的装备,武器和金币我就偷走了,哈哈哈~~~”死神说\n";
jb=0;
sm=40;
sh=5;
bs=0;
lj=0;
sj=0;
emzr=0;
hyj=0;
jssj=0;
pgj=0;
szj=0;
hjj=0;
zspf=0;
hy=0;
hfhzj=0;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
if(dm<=0)
{
jb+=20;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你击败了敌方获得了20金币\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
}
}
if(j==2)
{
dm=13;
for(;;)
{
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"战斗开始,野蛮人\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"1.攻击 2.使用技能\n";
cin>>p;
if(p==1)
{
dm-=sh;
sm-=4;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"正在打斗中,请稍等...\n";
Sleep(1500);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"敌方对你造成了4点伤害\n";
cout<<"我方生命值"<<sm<<"\n";
Sleep(300);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"你对敌方造成了"<<sh<<"点伤害\n";
cout<<"敌方生命值"<<dm<<"\n";
}
if(p==2)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"1.绷带 2.医疗包 3.炸弹 (在第二关禁止使用手雷)\n";
cin>>n;
if(n==1)
{
if(bd>=1)
{
sm+=5;
bd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了绷带,加了5血\n";
}
}
if(n==2)
{
if(ylb>=1)
{
sm+=10;
ylb--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了医疗包,加了10血\n";
}
}
if(n==3)
{
if(zd>=1)
{
dm-=8;
zd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了炸弹,造成8伤害\n";
}
}
}
Sleep(1000);
if(sm<=0)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你被敌方击败了,不幸牺牲\n“你的装备,武器和金币我就偷走了,哈哈哈~~~”死神说\n";
jb=0;
sm=40;
sh=5;
bs=0;
lj=0;
sj=0;
emzr=0;
hyj=0;
jssj=0;
pgj=0;
szj=0;
hjj=0;
zspf=0;
hy=0;
hfhzj=0;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
if(dm<=0)
{
jb+=30;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你击败了敌方获得了30金币\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
}
}
if(j==3)
{
dm=16;
for(;;)
{
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"战斗开始,史莱姆\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"1.攻击 2.使用技能\n";
cin>>p;
if(p==1)
{
dm-=sh;
sm-=6;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"正在打斗中,请稍等...\n";
Sleep(1500);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"敌方对你造成了6点伤害\n";
cout<<"我方生命值"<<sm<<"\n";
Sleep(300);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"你对敌方造成了"<<sh<<"点伤害\n";
cout<<"敌方生命值"<<dm<<"\n";
}
if(p==2)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"1.绷带 2.医疗包 3.炸弹 4.手雷\n";
cin>>n;
if(n==1)
{
if(bd>=1)
{
sm+=5;
bd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了绷带,加了5血\n";
}
}
if(n==2)
{
if(ylb>=1)
{
sm+=10;
ylb--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了医疗包,加了10血\n";
}
}
if(n==3)
{
if(zd>=1)
{
dm-=8;
zd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了炸弹,造成8伤害\n";
}
}
if(n==4)
{
if(tnt>=1)
{
dm-=15;
tnt--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了手雷,造成15伤害\n";
}
}
}
Sleep(1000);
if(sm<=0)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你被敌方击败了,不幸牺牲\n“你的装备,武器和金币我就偷走了,哈哈哈~~~”死神说\n";
jb=0;
sm=40;
sh=5;
bs=0;
lj=0;
sj=0;
emzr=0;
hyj=0;
jssj=0;
pgj=0;
szj=0;
hjj=0;
zspf=0;
hy=0;
hfhzj=0;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
if(dm<=0)
{
jb+=40;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你击败了敌方获得了40金币\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
}
}
if(j==4)
{
dm=21;
for(;;)
{
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"战斗开始,巨人\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"1.攻击 2.使用技能\n";
cin>>p;
if(p==1)
{
dm-=sh;
sm-=8;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"正在打斗中,请稍等...\n";
Sleep(1500);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"敌方对你造成了8点伤害\n";
cout<<"我方生命值"<<sm<<"\n";
Sleep(300);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"你对敌方造成了"<<sh<<"点伤害\n";
cout<<"敌方生命值"<<dm<<"\n";
}
if(p==2)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"1.绷带 2.医疗包 3.炸弹 4.手雷\n";
cin>>n;
if(n==1)
{
if(bd>=1)
{
sm+=5;
bd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了绷带,加了5血\n";
}
}
if(n==2)
{
if(ylb>=1)
{
sm+=10;
ylb--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了医疗包,加了10血\n";
}
}
if(n==3)
{
if(zd>=1)
{
dm-=8;
zd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了炸弹,造成8伤害\n";
}
}
if(n==4)
{
if(tnt>=1)
{
dm-=15;
tnt--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了手雷,造成15伤害\n";
}
}
}
Sleep(1000);
if(sm<=0)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你被敌方击败了,不幸牺牲\n“你的装备,武器和金币我就偷走了,哈哈哈~~~”死神说\n";
jb=0;
sm=40;
sh=5;
bs=0;
lj=0;
sj=0;
emzr=0;
hyj=0;
jssj=0;
pgj=0;
szj=0;
hjj=0;
zspf=0;
hy=0;
hfhzj=0;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
if(dm<=0)
{
jb+=50;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你击败了敌方获得了50金币\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
}
}
if(j==5)
{
dm=24;
for(;;)
{
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"战斗开始,森林巨人\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"1.攻击 2.使用技能\n";
cin>>p;
if(p==1)
{
dm-=sh;
sm-=9;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"正在打斗中,请稍等...\n";
Sleep(1500);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"敌方对你造成了9点伤害\n";
cout<<"我方生命值"<<sm<<"\n";
Sleep(300);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"你对敌方造成了"<<sh<<"点伤害\n";
cout<<"敌方生命值"<<dm<<"\n";
}
if(p==2)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"1.绷带 2.医疗包 3.炸弹 4.手雷\n";
cin>>n;
if(n==1)
{
if(bd>=1)
{
sm+=5;
bd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了绷带,加了5血\n";
}
}
if(n==2)
{
if(ylb>=1)
{
sm+=10;
ylb--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了医疗包,加了10血\n";
}
}
if(n==3)
{
if(zd>=1)
{
dm-=8;
zd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了炸弹,造成15伤害\n";
}
}
if(n==4)
{
if(tnt>=1)
{
dm-=15;
tnt--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了手雷,造成15伤害\n";
}
}
}
Sleep(1000);
if(sm<=0)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你被敌方击败了,不幸牺牲\n“你的装备,武器和金币我就偷走了,哈哈哈~~~”死神说\n";
jb=0;
sm=40;
sh=5;
bs=0;
lj=0;
sj=0;
emzr=0;
hyj=0;
jssj=0;
pgj=0;
szj=0;
hjj=0;
zspf=0;
hy=0;
hfhzj=0;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
if(dm<=0)
{
jb+=60;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你击败了敌方获得了60金币\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
}
}
if(j==6)
{
dm=30;
for(;;)
{
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"战斗开始,森林巨人王\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"1.攻击 2.使用技能\n";
cin>>p;
if(p==1)
{
dm-=sh;
sm-=20;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"正在打斗中,请稍等...\n";
Sleep(1500);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"敌方对你造成了20点伤害\n";
cout<<"我方生命值"<<sm<<"\n";
Sleep(300);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"你对敌方造成了"<<sh<<"点伤害\n";
cout<<"敌方生命值"<<dm<<"\n";
if(p==2)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"1.绷带 2.医疗包 3.炸弹 4.手雷\n";
cin>>n;
if(n==1)
{
if(bd>=1)
{
sm+=5;
bd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了绷带,加了5血\n";
}
}
if(n==2)
{
if(ylb>=1)
{
sm+=10;
ylb--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了医疗包,加了10血\n";
}
}
if(n==3)
{
if(zd>=1)
{
dm-=8;
zd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了炸弹,造成8伤害\n";
}
}
if(n==4)
{
if(tnt>=1)
{
dm-=15;
tnt--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了手雷,造成15伤害\n";
}
}
}
Sleep(1000);
if(sm<=0)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你被敌方击败了,不幸牺牲\n“你的装备,武器和金币我就偷走了,哈哈哈~~~”死神说\n";
jb=0;
sm=40;
sh=5;
bs=0;
lj=0;
sj=0;
emzr=0;
hyj=0;
jssj=0;
pgj=0;
szj=0;
hjj=0;
zspf=0;
hy=0;
hfhzj=0;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
if(dm<=0)
{
jb+=70;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你击败了敌方获得了70金币\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
}
}
}
if(j==7)
{
dm=41;
for(;;)
{
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"战斗开始,深海巨龙\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"1.攻击 2.使用技能\n";
cin>>p;
if(p==1)
{
dm-=sh;
sm-=31;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"正在打斗中,请稍等...\n";
Sleep(1500);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"敌方对你造成了31点伤害\n";
cout<<"我方生命值"<<sm<<"\n";
Sleep(300);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"你对敌方造成了"<<sh<<"点伤害\n";
cout<<"敌方生命值"<<dm<<"\n";
}
if(p==2)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"1.绷带 2.医疗包 3.炸弹 4.手雷\n";
cin>>n;
if(n==1)
{
if(bd>=1)
{
sm+=5;
bd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了绷带,加了5血\n";
}
}
if(n==2)
{
if(ylb>=1)
{
sm+=10;
ylb--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了医疗包,加了10血\n";
}
}
if(n==3)
{
if(zd>=1)
{
dm-=8;
zd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了炸弹,造成8伤害\n";
}
}
if(n==4)
{
if(tnt>=1)
{
dm-=15;
tnt--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了手雷,造成15伤害\n";
}
}
}
Sleep(1000);
if(sm<=0)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你被敌方击败了,不幸牺牲\n“你的装备,武器和金币我就偷走了,哈哈哈~~~”死神说\n";
jb=0;
sm=40;
sh=5;
bs=0;
lj=0;
sj=0;
emzr=0;
hyj=0;
jssj=0;
pgj=0;
szj=0;
hjj=0;
zspf=0;
hy=0;
hfhzj=0;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
if(dm<=0)
{
jb+=100;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你击败了敌方获得了100金币\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
}
}
if(j==8)
{
dm=80;
for(;;)
{
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"战斗开始,九头大蛇\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"1.攻击 2.使用技能\n";
cin>>p;
if(p==1)
{
dm-=sh;
sm-=35;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"正在打斗中,请稍等...\n";
Sleep(1500);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"敌方对你造成了35点伤害\n";
cout<<"我方生命值"<<sm<<"\n";
Sleep(300);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"你对敌方造成了"<<sh<<"点伤害\n";
cout<<"敌方生命值"<<dm<<"\n";
}
if(p==2)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"1.绷带 2.医疗包 3.炸弹 4.手雷\n";
cin>>n;
if(n==1)
{
if(bd>=1)
{
sm+=5;
bd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了绷带,加了5血\n";
}
}
if(n==2)
{
if(ylb>=1)
{
sm+=10;
ylb--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了医疗包,加了10血\n";
}
}
if(n==3)
{
if(zd>=1)
{
dm-=8;
zd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了炸弹,造成8伤害\n";
}
}
if(n==4)
{
if(tnt>=1)
{
dm-=15;
tnt--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了手雷,造成15伤害\n";
}
}
}
Sleep(1000);
if(sm<=0)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你被敌方击败了,不幸牺牲\n“你的装备,武器和金币我就偷走了,哈哈哈~~~”死神说\n";
jb=0;
sm=40;
sh=5;
bs=0;
lj=0;
sj=0;
emzr=0;
hyj=0;
jssj=0;
pgj=0;
szj=0;
hjj=0;
zspf=0;
hy=0;
hfhzj=0;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
if(dm<=0)
{
jb+=110;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"你击败了敌方获得了110金币\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
}
}
if(j==9)
{
dm=200;
for(;;)
{
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"战斗开始,三头龙\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"1.攻击 2.使用技能\n";
cin>>p;
if(p==1)
{
dm-=sh;
sm-=40;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"正在打斗中,请稍等...\n";
Sleep(1500);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_BLUE);
cout<<"敌方对你造成了40点伤害\n";
cout<<"我方生命值"<<sm<<"\n";
Sleep(300);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"你对敌方造成了"<<sh<<"点伤害\n";
cout<<"敌方生命值"<<dm<<"\n";
}
if(p==2)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"1.绷带 2.医疗包 3.炸弹 4.手雷\n";
cin>>n;
if(n==1)
{
if(bd>=1)
{
sm+=5;
bd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了绷带,加了5血\n";
}
}
if(n==2)
{
if(ylb>=1)
{
sm+=10;
ylb--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了医疗包,加了10血\n";
}
}
if(n==3)
{
if(zd>=1)
{
dm-=8;
zd--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了炸弹,造成8伤害\n";
}
}
if(n==4)
{
if(tnt>=1)
{
dm-=15;
tnt--;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"你使用了手雷,造成15伤害\n";
}
}
}
Sleep(1000);
if(sm<=0)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"“呵呵,不自量力的小鬼“\n”去死吧!!!”\n";
jb=0;
sm=40;
sh=5;
bs=0;
lj=0;
sj=0;
emzr=0;
hyj=0;
jssj=0;
pgj=0;
szj=0;
hjj=0;
zspf=0;
hy=0;
hfhzj=0;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
if(dm<=0)
{
jb+=120;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
cout<<"“不,不!!!我是不朽的!!!” “正义会得到伸张!” 你击败了三头龙\n从此,世界恢复了和平。(彩蛋)\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
system("pause");
return 1;
}
}
}
qt:
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<" --------------------*其他*-------------------- \n";
cout<<" | 1.清除屏幕上所有类容 2.游戏相关信息 | \n";
cout<<" | 3.返回主菜单 | \n";
cout<<" -----------------祝您玩的开心----------------- \n";
cin>>j;
if(j==1)
{
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n\n\n 正在清除 \n\n";
Sleep(1000);
cout<<" 5 \n";
Sleep(1000);
cout<<" 4 \n";
Sleep(1000);
cout<<" 3 \n";
Sleep(1000);
cout<<" 2 \n";
Sleep(1000);
cout<<" 1 \n";
Sleep(1000);
cout<<" 已清除\n";
system("cls");
goto zcd;
}
if(j==2)
{
system("color 3F");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |
FOREGROUND_GREEN);
cout<<"--------------------制作相关信息--------------------\n";
Sleep(300);
cout<<" 制作者:非揪咪 \n";
Sleep(300);
cout<<" 制作时间:16小时 \n";
Sleep(300);
cout<<" 制作日期:xxxx年x月xx日-xxxx年x月xx日 \n";
Sleep(300);
cout<<" 禁止侵权 \n";
Sleep(300);
cout<<" 联系电话1xxxxxxxxxx \n";
Sleep(300);
cout<<"\n------------------游戏相关信息--------------------\n";
Sleep(300);
cout<<" 由于作者赖 \n";
Sleep(300);
cout<<" 在战斗中使用技能,如果技能不够就会重新显示 \n";
Sleep(300);
cout<<" “1.攻击 2.使用技能” \n";
Sleep(300);
cout<<" 并不会显示数量不够 \n";
Sleep(300);
cout<<" 在查看背包里也可以查看金币和伤害和血量哦 \n";
Sleep(300);
cout<<" 为了真实,战斗前不会显示敌人的生命和伤害 \n";
Sleep(300);
cout<<" 只有自己试了才知道哦 \n";
Sleep(300);
cout<<" 经过多次战斗,不要怕金币损失,而不回血 \n";
Sleep(300);
cout<<" 如果死了,会掉落所有物品,到时候别伤心哦 \n";
Sleep(300);
cout<<" 在战斗时,绷带和医疗包,不仅可以恢复血量 \n";
Sleep(300);
cout<<" 还可以加血比如说,你有40血,使用绷带会加5滴血 \n";
Sleep(300);
cout<<" 就会突破上限值,变成45滴血 \n";
Sleep(300);
cout<<" 利用这个bug奋击你的敌人吧 \n";
Sleep(300);
cout<<" 战斗时一定要随时关注血量哦 \n";
Sleep(300);
cout<<" 战斗胜利了,不要骄傲 \n";
Sleep(300);
cout<<" 一定按时查看血量哦 \n";
Sleep(300);
cout<<" 战败了,所有东西没了,也不要失望 \n";
Sleep(300);
cout<<" 重整旗鼓,再来一局吧 \n";
Sleep(300);
cout<<" 由于游戏没有存档记录,关闭程序,存档记录就会消失哦\n";
Sleep(300);
cout<<" 只要打败最终BOSS三头龙,就算游戏通关了哦 \n";
Sleep(300);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |
FOREGROUND_RED);
system("pause");
goto zcd;
}
if(j==3)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |
FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);
cout<<"\n电脑正在拼命加载中...\n\n\n";
Sleep(1000);
goto zcd;
}
}
}
return 0;
}