#include
#include
#include
#include
using namespace std;
void Welcome()
{
cout << "杨";
Sleep(300);
cout << "氏";
Sleep(300);
cout << "出";
Sleep(300);
cout << "品";
Sleep(300);
cout << ":";
Sleep(300);
cout << "打";
Sleep(300);
cout << "怪";
Sleep(300);
cout << "小";
Sleep(300);
cout << "游";
Sleep(300);
cout << "戏" << endl;
}
void Showwelcome()
{
cout << "____________________________________________" << endl;
cout << "| |" << endl;
cout << "| 欢迎来到《打怪小游戏》 |" << endl;
cout << "|__________________________________________|" << endl;
cout << "| |" << endl;
cout << "| 1、登录 |" << endl;
cout << "| 2、注册 |" << endl;
cout << "|__________________________________________|" << endl;
cout << "| |" << endl;
cout << "| 请勿在游戏中辱骂、讨论色情、 |" << endl;
cout << "| 黄赌毒和政治等敏感内容,和 |" << endl;
cout << "| 谐游戏,和谐生活! |" << endl;
cout << "| 特此声明: |" << endl;
cout << "| 本游戏不适合13岁以下的孩子 |" << endl;
cout << "| 谢谢! |" << endl;
cout << "|__________________________________________|" << endl;
}
int main()
{
system("color F2");
SetWindowTextA(GetConsoleWindow(), "打怪小游戏");
int num = 1;
Welcome();
int attack = 10;
int Lucky = 10;
int defense = 100;
int maxhp = 100;
int hp1 = 100;
int money = 10;
int boss[16] = { 2,4,6,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768 };
int boss_attack[16] = { 2,4,6,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768 };
srand(time_t(NULL));
system("cls");
string str;
XFHG:
Showwelcome();
int n;
cin >> n;
system("cls");
if (n == 1)
{
if (num == 4)
{
cout << "次数已全部用完,无法进入!" << endl;
goto XFHG;
}
else
{
for (int i = 1; i <= 3; i++)
{
if (num <= 3)
{
NUM:
if (num == 4)
{
cout << "三次未输正确!\n强制退出!" << endl;
system("pause");
system("cls");
goto XFHG;
}
cout << "请输入用户名:";
cin >> str;
if (str == "杨歌")
{
cout << "请输入密码:";
cin >> str;
if (str == "BF8Y8-GN2QH-T84XB-QVY3B-RC4DF")
{
int attack = 100;
int Lucky = 10;
int defense = 1000;
int maxhp = 1000;
int hp1 = 1000;
int money = 100;
while (1)
{
QT:
SZ:
system("cls");
cout << "1、商城\t2、打怪\t3、恢复\t4、查看\t5、抽奖\t6、退出游戏" << endl;
int n;
cin >> n;
system("cls");
switch (n)
{
case 1:
{
FLAG:
system("cls");
cout << "品名\t威力\t金钱\n盔甲\t抵御20\t20\n防弹头盔抵御100\t100\n防弹衣\t抵御200\t200\n圣盾\t抵御320\t320\n长矛\t攻击30\t30\n机枪\t攻击100\t100\nAWM\t攻击300 300\n无敌战轮攻击100000\t(非卖品)\n三级套\t防御100000\t(非卖品)\n(返回初始界面)";
string str1;
cin >> str1;
if (str1 == "盔甲")
{
if (money - 20 > 0)
{
maxhp += 20;
defense += 20;
money -= 20;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto FLAG;
}
else if (str1 == "防弹头盔")
{
if (money - 100 > 0)
{
maxhp += 100;
defense += 100;
money -= 100;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto FLAG;
}
else if (str1 == "防弹衣")
{
if (money - 200 > 0)
{
maxhp += 200;
defense += 200;
money -= 200;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto FLAG;
}
else if (str1 == "圣盾")
{
if (money - 320 > 0)
{
maxhp += 320;
defense += 320;
money -= 320;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto FLAG;
}
else if (str1 == "匕首")
{
if (money - 1 > 0)
{
attack += 1;
money -= 1;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto FLAG;
}
else if (str1 == "长矛")
{
if (money - 30 > 0)
{
attack += 30;
money -= 30;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto FLAG;
}
else if (str1 == "机枪")
{
if (money - 100 > 0)
{
attack += 100;
money -= 100;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto FLAG;
}
else if (str1 == "AWM")
{
if (money - 300 > 0)
{
attack += 300;
money -= 300;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto FLAG;
}
else if (str1 == "返回初始界面")
{
system("cls");
goto QT;
}
break;
}
case 2:
{
int k;
IO:
cout << "请输入对手等级(1~15)" << endl;
cin >> k;
system("cls");
if (k > 15 || k < 0)
{
goto IO;
}
system("cls");
while (1)
{
int num;
num = rand();
if (num % 2 == 0)
{
cout << "人类先攻击!" << endl;
system("cls");
boss[k] -= attack;
if (boss[k] <= 0)
{
cout << "人类获胜" << endl;
int temp1;
int jk = rand();
if (jk >= 10000)
{
cout << "成功进入两个非卖品选择处!" << endl;
cout << "请选择:" << endl;
cout << "1、无敌战轮\t2、三级套" << endl;
int xys;
cin >> xys;
if (xys == 1)
{
cout << "恭喜您获得无敌战轮!" << endl;
attack += temp1 = 10000;
cout << "攻击力+" << temp1 << endl;
system("pause");
system("cls");
}
else
{
cout << "恭喜您获得三级套!" << endl;
defense += temp1 = 10000;
maxhp += 10000;
cout << "防御力+" << temp1 << "\t最大生命值+" << temp1 << endl;
system("pause");
system("cls");
}
}
money += temp1 = rand() % 100 + 1;
Lucky++;
cout << "金钱+" << temp1 << "\t剩余金钱" << money << "\t抽奖次数+1" << "\t剩余抽奖次数" << Lucky << endl;
system("pause");
system("cls");
break;
}
}
else
{
cout << "怪物先攻击!" << endl;
system("cls");
if (boss_attack[k] - defense >= 0)
{
hp1 -= (boss_attack[k] - defense);
}
if (hp1 <= 0)
{
cout << "怪物获胜" << endl;
system("pause");
system("cls");
cout << "请问是否复活?(y/n)" << endl;
string str;
cin >> str;
if (str == "y" || str == "Y")
{
X:
system("cls");
cout << "请输入复活密匙!" << endl;
cin >> str;
system("cls");
if (str == "BF8Y8-GN2QH-T84XB-QVY3B-RC4DF")
{
cout << "复活成功!" << endl;
system("pause");
system("cls");
goto SZ;
}
else
{
cout << "密匙输入错误!" << endl;
cout << "是否重新输入?(y/n)" << endl;
cin >> str;
system("pause");
if (str == "y" || str == "Y")
{
goto X;
}
else
{
system("cls");
cout << "G";
Sleep(300);
cout << "A";
Sleep(300);
cout << "M";
Sleep(300);
cout << "E";
cout << " ";
Sleep(300);
cout << "O";
Sleep(300);
cout << "V";
Sleep(300);
cout << "E";
Sleep(300);
cout << "R" << endl;
Sleep(3000);
system("cls");
return 0;
}
}
}
else
{
system("cls");
cout << "G";
Sleep(300);
cout << "A";
Sleep(300);
cout << "M";
Sleep(300);
cout << "E";
cout << " ";
Sleep(300);
cout << "O";
Sleep(300);
cout << "V";
Sleep(300);
cout << "E";
Sleep(300);
cout << "R" << endl;
Sleep(3000);
system("cls");
return 0;
}
}
}
}
break;
}
case 3:
{
if (money - money * 4 / 5 - 1 > 0)
{
hp1 = maxhp;
cout << "恢复成功!" << endl;
money -= money * 4 / 5 - 1;
}
else
cout << "这可是看钱的时代!" << endl;
system("pause");
system("cls");
break;
}
case 4:
{
cout << "金币数量:" << money << endl;
cout << "生命值:" << hp1 << endl;
cout << "生命值上限:" << maxhp << endl;
cout << "攻击力:" << attack << endl;
cout << "防御力:" << defense << endl;
cout << "抽奖次数:" << Lucky << endl;
system("pause");
system("cls");
break;
}
case 5:
{
cout << "*************************" << endl;
cout << "**** 欢迎来到大转盘!****" << endl;
cout << "*************************" << endl;
cout << "* 抽十次 *" << endl;
cout << "* 抽一次 *" << endl;
cout << "*************************" << endl;
string str;
cin >> str;
system("cls");
if (str == "抽一次")
{
if (Lucky - 1 >= 0)
{
Lucky--;
cout << "抽奖中...." << endl;
Sleep(300);
system("cls");
int xy;
xy = rand() % 9 + 2;
if (xy == 1)
{
maxhp += 20;
defense += 20;
cout << "恭喜抽中盔甲!" << endl;
system("pause");
system("cls");
}
else if (xy == 2)
{
maxhp += 100;
defense += 100;
cout << "恭喜抽中防弹头盔!" << endl;
system("pause");
system("cls");
}
else if (xy == 3)
{
maxhp += 200;
defense += 200;
cout << "恭喜抽中防弹衣!" << endl;
system("pause");
system("cls");
}
else if (xy == 4)
{
maxhp += 320;
defense += 320;
cout << "恭喜抽中圣盾!" << endl;
system("pause");
system("cls");
}
else if (xy == 5)
{
attack += 30;
cout << "恭喜抽中长矛!" << endl;
system("pause");
system("cls");
}
else if (xy == 6)
{
attack += 100;
cout << "恭喜抽中机枪!" << endl;
system("pause");
system("cls");
}
else if (xy == 7)
{
attack += 300;
cout << "恭喜抽中AWM!" << endl;
system("pause");
system("cls");
}
else
{
cout << "什么都没中!" << endl;
system("pause");
system("cls");
}
}
else
{
cout << "没币?这可是看币的机器!" << endl;
system("pause");
}
}
if (str == "抽十次")
{
if (Lucky - 10 >= 0)
{
int i = 1;
Lucky -= 10;
int xy;
while (i <= 10)
{
xy = rand() % 9 + 2;
if (xy == 1)
{
maxhp += 20;
defense += 20;
cout << "恭喜抽中盔甲!" << endl;
system("pause");
system("cls");
}
else if (xy == 2)
{
maxhp += 100;
defense += 100;
cout << "恭喜抽中防弹头盔!" << endl;
system("pause");
system("cls");
}
else if (xy == 3)
{
maxhp += 200;
defense += 200;
cout << "恭喜抽中防弹衣!" << endl;
system("pause");
system("cls");
}
else if (xy == 4)
{
maxhp += 320;
defense += 320;
cout << "恭喜抽中圣盾!" << endl;
system("pause");
system("cls");
}
else if (xy == 5)
{
attack += 30;
cout << "恭喜抽中长矛!" << endl;
system("pause");
system("cls");
}
else if (xy == 6)
{
attack += 100;
cout << "恭喜抽中机枪!" << endl;
system("pause");
system("cls");
}
else if (xy == 7)
{
attack += 300;
cout << "恭喜抽中AWM!" << endl;
system("pause");
system("cls");
}
else
{
cout << "什么都没中!" << endl;
system("pause");
system("cls");
}
i++;
}
}
else
{
cout << "没币?这可是看币的机器!" << endl;
system("pause");
}
i++;
}
break;
}
case 6:
{
cout << "欢";
Sleep(300);
cout << "迎";
Sleep(300);
cout << "下";
Sleep(300);
cout << "次";
Sleep(300);
cout << "再";
Sleep(300);
cout << "来";
Sleep(300);
cout << "!" << endl;
Sleep(3000);
system("cls");
return 0;
}
case 7:
{
cout << "欢迎来到开挂世界!" << endl;
cout << "请输入密码:";
string i;
cin >> i;
if (i == "BF8Y8-GN2QH-T84XB-QVY3B-RC4DF")
{
cout << "开挂成功!" << endl;
money += 100000;
Lucky += 100;
}
else
cout << "开挂失败!" << endl;
system("pause");
system("cls");
}
}
}
break;
}
else
{
cout << "密码错误!" << endl;
num++;
system("pause");
system("cls");
goto NUM;
}
}
else
{
cout << "用户名错误!" << endl;
system("pause");
num++;
system("cls");
goto NUM;
}
}
}
}
}
else
{
cout << "请输入用户名" << endl;
cin >> str;
cout << "请输入密码" << endl;
cin >> str;
system("cls");
while (1)
{
GHHFH:
GUI:
system("cls");
cout << "1、商城\t2、打怪\t3、恢复\t4、查看\t5、抽奖\t6、退出游戏" << endl;
int n;
cin >> n;
system("cls");
switch (n)
{
case 1:
{
XFS:
system("cls");
cout << "品名\t威力\t金钱\n盔甲\t抵御20\t20\n防弹头盔抵御100\t100\n防弹衣\t抵御200\t200\n圣盾\t抵御320\t320\n长矛\t攻击30\t30\n机枪\t攻击100\t100\nAWM\t攻击300 300\n无敌战轮攻击100000\t(非卖品)\n三级套\t防御100000\t(非卖品)\n(返回初始界面)";
string str1;
cin >> str1;
if (str1 == "盔甲")
{
if (money - 20 > 0)
{
maxhp += 20;
defense += 20;
money -= 20;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto XFS;
}
else if (str1 == "防弹头盔")
{
if (money - 100 > 0)
{
maxhp += 100;
defense += 100;
money -= 100;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto XFS;
}
else if (str1 == "防弹衣")
{
if (money - 200 > 0)
{
maxhp += 200;
defense += 200;
money -= 200;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto XFS;
}
else if (str1 == "圣盾")
{
if (money - 320 > 0)
{
maxhp += 320;
defense += 320;
money -= 320;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto XFS;
}
else if (str1 == "匕首")
{
if (money - 1 > 0)
{
attack += 1;
money -= 1;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto XFS;
}
else if (str1 == "长矛")
{
if (money - 30 > 0)
{
attack += 30;
money -= 30;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto XFS;
}
else if (str1 == "机枪")
{
if (money - 100 > 0)
{
attack += 100;
money -= 100;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto XFS;
}
else if (str1 == "AWM")
{
if (money - 300 > 0)
{
attack += 300;
money -= 300;
}
else
cout << "没钱?这可是看钱的社会!" << endl;
system("pause");
goto XFS;
}
else if (str1 == "返回初始界面")//QT=GHHFH
{
system("cls");
goto GHHFH;
}
break;
}
case 2:
{
int k;
GJH:
cout << "请输入对手等级(1~15)" << endl;
cin >> k;
system("cls");
if (k > 15 || k < 0)
{
goto GJH;//IO=GJH
}
system("cls");
while (1)
{
int num;
num = rand();
if (num % 2 == 0)
{
cout << "人类先攻击!" << endl;
system("cls");
boss[k] -= attack;
if (boss[k] <= 0)
{
cout << "人类获胜" << endl;
int temp1;
int jk = rand();
if (jk >= 10000)
{
cout << "成功进入两个非卖品选择处!" << endl;
cout << "请选择:" << endl;
cout << "1、无敌战轮\t2、三级套" << endl;
int xys;
cin >> xys;
if (xys == 1)
{
cout << "恭喜您获得无敌战轮!" << endl;
attack += temp1 = 10000;
cout << "攻击力+" << temp1 << endl;
system("pause");
system("cls");
}
else
{
cout << "恭喜您获得三级套!" << endl;
defense += temp1 = 10000;
maxhp += 10000;
cout << "防御力+" << temp1 << "\t最大生命值+" << temp1 << endl;
system("pause");
system("cls");
}
}
money += temp1 = rand() % 100 + 1;
Lucky++;
cout << "金钱+" << temp1 << "\t剩余金钱" << money << "\t抽奖次数+1" << "\t剩余抽奖次数" << Lucky << endl;
system("pause");
system("cls");
break;
}
}
else
{
cout << "怪物先攻击!" << endl;
system("cls");
if (boss_attack[k] - defense >= 0)
{
hp1 -= (boss_attack[k] - defense);
}
if (hp1 <= 0)
{
cout << "怪物获胜" << endl;
system("pause");
system("cls");
cout << "请问是否复活?(y/n)" << endl;
string str;
cin >> str;
if (str == "y" || str == "Y")
{
SD:
system("cls");
cout << "请输入复活密匙!" << endl;
cin >> str;
system("cls");
if (str == "BF8Y8-GN2QH-T84XB-QVY3B-RC4DF")
{
cout << "复活成功!" << endl;
system("pause");
system("cls");
goto GUI;//SZ=GUI
}
else
{
cout << "密匙输入错误!" << endl;
cout << "是否重新输入?(y/n)" << endl;
cin >> str;
system("pause");
if (str == "y" || str == "Y")
{
goto SD;
}
else
{
system("cls");
cout << "G";
Sleep(300);
cout << "A";
Sleep(300);
cout << "M";
Sleep(300);
cout << "E";
cout << " ";
Sleep(300);
cout << "O";
Sleep(300);
cout << "V";
Sleep(300);
cout << "E";
Sleep(300);
cout << "R" << endl;
Sleep(3000);
system("cls");
return 0;
}
}
}
else
{
system("cls");
cout << "G";
Sleep(300);
cout << "A";
Sleep(300);
cout << "M";
Sleep(300);
cout << "E";
cout << " ";
Sleep(300);
cout << "O";
Sleep(300);
cout << "V";
Sleep(300);
cout << "E";
Sleep(300);
cout << "R" << endl;
Sleep(3000);
system("cls");
return 0;
}
}
}
}
break;
}
case 3:
{
if (money - money * 4 / 5 - 1 > 0)
{
hp1 = maxhp;
cout << "恢复成功!" << endl;
money -= money * 4 / 5 - 1;
}
else
cout << "这可是看钱的时代!" << endl;
system("pause");
system("cls");
break;
}
case 4:
{
cout << "金币数量:" << money << endl;
cout << "生命值:" << hp1 << endl;
cout << "生命值上限:" << maxhp << endl;
cout << "攻击力:" << attack << endl;
cout << "防御力:" << defense << endl;
cout << "抽奖次数:" << Lucky << endl;
system("pause");
system("cls");
break;
}
case 5:
{
cout << "*************************" << endl;
cout << "**** 欢迎来到大转盘!****" << endl;
cout << "*************************" << endl;
cout << "* 抽十次 *" << endl;
cout << "* 抽一次 *" << endl;
cout << "*************************" << endl;
string str;
cin >> str;
system("cls");
if (str == "抽一次")
{
if (Lucky - 1 >= 0)
{
Lucky--;
cout << "抽奖中...." << endl;
Sleep(300);
system("cls");
int xy;
xy = rand() % 9 + 1;
if (xy == 1)
{
maxhp += 20;
defense += 20;
cout << "恭喜抽中盔甲!" << endl;
system("pause");
system("cls");
}
else if (xy == 2)
{
maxhp += 100;
defense += 100;
cout << "恭喜抽中防弹头盔!" << endl;
system("pause");
system("cls");
}
else if (xy == 3)
{
maxhp += 200;
defense += 200;
cout << "恭喜抽中防弹衣!" << endl;
system("pause");
system("cls");
}
else if (xy == 4)
{
maxhp += 320;
defense += 320;
cout << "恭喜抽中圣盾!" << endl;
system("pause");
system("cls");
}
else if (xy == 5)
{
attack += 1;
cout << "恭喜抽中匕首!" << endl;
system("pause");
system("cls");
}
else if (xy == 6)
{
attack += 30;
cout << "恭喜抽中长矛!" << endl;
system("pause");
system("cls");
}
else if (xy == 7)
{
attack += 100;
cout << "恭喜抽中机枪!" << endl;
system("pause");
system("cls");
}
else if (xy == 8)
{
attack += 300;
cout << "恭喜抽中AWM!" << endl;
system("pause");
system("cls");
}
else
{
cout << "什么都没中!" << endl;
system("pause");
system("cls");
}
}
else
{
cout << "没币?这可是看币的机器!" << endl;
system("pause");
}
}
if (str == "抽十次")
{
int i = 1;
if (Lucky - 10 >= 0)
{
Lucky -= 10;
while (i <= 10)
{
cout << "抽奖中...." << endl;
Sleep(300);
system("cls");
int xy;
xy = rand() % 9 + 1;
if (xy == 1)
{
maxhp += 20;
defense += 20;
cout << "恭喜抽中盔甲!" << endl;
system("pause");
system("cls");
}
else if (xy == 2)
{
maxhp += 100;
defense += 100;
cout << "恭喜抽中防弹头盔!" << endl;
system("pause");
system("cls");
}
else if (xy == 3)
{
maxhp += 200;
defense += 200;
cout << "恭喜抽中防弹衣!" << endl;
system("pause");
system("cls");
}
else if (xy == 4)
{
maxhp += 320;
defense += 320;
cout << "恭喜抽中圣盾!" << endl;
system("pause");
system("cls");
}
else if (xy == 5)
{
attack += 30;
cout << "恭喜抽中长矛!" << endl;
system("pause");
system("cls");
}
else if (xy == 6)
{
attack += 100;
cout << "恭喜抽中机枪!" << endl;
system("pause");
system("cls");
}
else if (xy == 7)
{
attack += 300;
cout << "恭喜抽中AWM!" << endl;
system("pause");
system("cls");
}
else
{
cout << "什么都没中!" << endl;
system("pause");
system("cls");
}
i++;
}
}
else
{
cout << "没币?这可是看币的机器!" << endl;
system("pause");
}
i++;
}
break;
}
case 6:
{
cout << "欢";
Sleep(300);
cout << "迎";
Sleep(300);
cout << "下";
Sleep(300);
cout << "次";
Sleep(300);
cout << "再";
Sleep(300);
cout << "来";
Sleep(300);
cout << "!" << endl;
Sleep(3000);
system("cls");
return 0;
}
case 7:
{
cout << "欢迎来到开挂世界!" << endl;
cout << "请输入密码:";
string i;
cin >> i;
if (i == "BF8Y8-GN2QH-T84XB-QVY3B-RC4DF")
{
cout << "开挂成功!" << endl;
money += 100000;
Lucky += 100;
}
else
cout << "开挂失败!" << endl;
system("pause");
system("cls");
}
}
}
}
return 0;
}