勇闯迷塔小游戏(c++)

勇闯迷塔小游戏(c++),第1张

勇闯迷塔小游戏(c++)

        游戏背景:

            在古老的传说中,有一座五层妖塔,塔中住着魔王和他手下的妖精们。

            一日,妖塔中的魔术师决定举办一次祭祀活动,以增强魔王的法力。他们抓来了一个可怜的流浪商人,关在第四层的一个房间里,他被魔术师施了魔法(魔化了),准备拿来当作祭品。

            国王听说此事后,派出了一位勇士(就是你),来到了妖塔下面,你的任务是干掉魔王,为国家除害。当然,你不是空手去的,你随身携带一本怪物书(monster_book),每次杀掉怪物之后,你都会获取与怪物相关的数据。在妖塔中,有很多妖怪散落的装备或者药水可以供你使用,还有一些商店(奸商)给你提供商品。

           ...好了,你自己玩吧...

------------------------------------------------丑不拉叽的分割线---------------------------------------------------------

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define BNUM 17
#define TOWER 5
#define COLS 40
#define LINES 100 
#define RUNE 22
struct BLOCKS
{
	string name;
	int hp;
	int attack;
	int defence;
	bool go;
	bool monster;
	int xp;
	int number;
};
struct PLAYER
{
	string name;
	int hp;
	int attack;
	int defence;
	int tower;
	int x;
	int y;
	int xp;
	int level;
	int money;
};
unsigned long long uplevel[]={0,10,25,40,60,80,150,300,400,650,800,950,1100,1200,1500,1800,2000,3100,5000,6500,7900,8900,9700,10000,12000,14000,15860,17738,18939,20039,21950,25910,27830,29382,31829,33849,35939,36788,38193,41829,43829,45888,47361,49382,51853,54830};
BLOCKS map[BNUM][COLS][LINES];
string runec[RUNE]=
{
"魔王在进行一种祭祀仪式(最高机密,不可泄漏),只要集齐了日月的阴阳之力(眼熟吧),就可以召唤^&*!%!%@(字迹不清)",
"吼...",
"妖怪们最喜欢在一层的这个右侧房间玩耍了,因为有卫兵和骑士把守,十分安全...",
"传说中的储物间中,存放着妖精们的武器和神秘药水,不知有何作用...",
"真是个奇怪的骑士,还带着假面,还是不要惹他为好...",
"长满了青苔和杂草的楼梯间,上面还传来了不明的低吼声...",
"魔法师在这里布下重重迷阵,并制造了许多分身,防止有人破坏了祭祀仪式...n", 
"只有通过了迷阵,才能找到下一个楼梯间...n",
"无数的怪物在里面防守着,可见内部可能藏着什么东西...n", 
"魔王允许一个人类在这里开设商店,并且高价卖破烂,就是为了坑钱...n",
"迷宫,又是迷宫...n",
"魔法师:&*#$^!...(消失不见)...n",
"魔王将魔兽与人类生下的孩子在这里培养,这些孩子长得歪瓜裂枣(很丑),但好像很喜欢打架...n",
"伪装的魔王在这里等待着客人的来临...n",
"别想着走捷径,傻瓜...n",
"传说中的英文字母表(不会的请回幼儿园重读),不过好像并没有那么简单呢...n",
"一块石碑: 旅行者的血肉,魔术师的魔法,还有被感染的人类,可以召唤        (只有聪明的人才能看见那些东西)...n",
"只要干掉魔王,就能终止祭祀仪式,        就不会出现...n",
"阴之月符文: $&^%!!# 聚集月的阴之力...n",
"阴之日符文:#%^&!$! 聚集日的阴之力...n",
"阳之日符文:!$!&^%# 聚集日的阳之力...n",
"阳之月符文:#!!%^&$ 聚集月的阳之力...n",
};
int rtower[RUNE]={0,0,0,0,0,0,1,1,1,1,1,1,2,2,2,3,4,4,4,4,4,4};
int rposx[RUNE]={2,17,7,6,31,37,1,9,31,1,2,38,3,33,39,2,1,1,16,19,19,22};
int rposy[RUNE]={1,1,3,9,59,97,1,10,1,31,42,97,2,98,92,2,2,3,36,34,40,46};bool DidFile=false;
bool monster_[BNUM]={0};
string sympol=" #shjlmdbzaSftg@";
string Name[BNUM]={"空地","墙","卫兵","骑士","假面骑士","小丑","魔术师","商店","流浪商人_魔化","治疗药水","战斧","盾牌","魔王_假","魔王_真","小鬼","符文"};
int Hp[BNUM]=     {0,0,100,200,800,1500,1800,0,1200,0,0,0,3000,6000,500,0};
int Attack[BNUM]= {0,0, 30, 50,220,200, 570,0,400,0,0,0,600,1000,130,0};
int Defence[BNUM]={0,0, 10, 20, 80,120, 220,0,150,0,0,0,350,500,35,0};
bool Go[BNUM]=    {1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
bool monster[BNUM]={0,0,1,1,1,1,1,0,1,0,0,0,1,1,1,0};
int Xp[BNUM]={2,0,10,30,60,100,150,0,100,0,0,0,5000,20000,300,10};
PLAYER player;
int sudu=5;
unsigned long long Time,now;
char MAP[TOWER][40][102]=
{
	{
		"# ##################################################################################################",
		"# ##      s  s     #z    #a    #a       #                                                          #",
		"#@s#  a   #  #  h  #     #     #        #                                                          #",
		"#z ########hh#########s######s#####h#####                           a                              #",
		"#  #     @                              #                                                          #",
		"#  #     ##h##    ########################                  a    S     S   a                       #",
		"#  #    #h# #h#  #zzs                    #                          z                              #",
		"# s@   #       #  ###                    #                  a    S     S   a                       #",
		"#  ####         ##### #       #     #    #                                                         #",
		"#  #ah                 #     #      #    #                          a                              #",
		"#  #hh                  #   #       #    #                                                         #",
		"# ##        l lg         # #        #    #                                                         #",
		"# #         mgm           #         ### ##        #####                            hh              #",
		"# #        g   l          #         #    #        #   #                           hhhh             #",
		"# #                       #         #    #        # # #############################hh###############",
		"# #                       #         #    ########## #               #                              #",
		"# #                       #         #    #########  ##              #                              #",
		"#@#                     ##     ##s#       #     #    #              #                              #",
		"#f##                  ##   #   #jh#   #    #   # #   ##             #                              #",
		"#f  #                #     #   ####  #  #   # #   #   #             #                              #",
		"#    ######ss########     #         # # #   # #    #   #            #                              #",
		"#          hh        ## ##           #  ## #   #     #  #           #                              #",
		"#                                    #  ##      #     # #           #                              #",
		"#                                     #   #      #  # #  #          #                              #",
		"#                                     # ##### ####  #    ##         #                              #",
		"#                                      #   #        #  ##           #                              #",
		"#                                           ####### # #             #                              #",
		"######################################################              #                              #",
		"#                                                                   #                              #",
		"#                                                                   #                              #",
		"#################### ######################################h######################## ###############",
		"#                                                 #        @    j         #                        #",
		"#     #######      #####  #                       #                       #                        #",
		"#          #         #    #                       #                       #                        #",
		"#         #          #    #                       #                       #                        #",
		"#        #           #    #                       #                                                #",
		"#       #        #   #    #                       #                       #                        #",
		"#      #         #   #    #                       #                       #                      @j#",
		"#    ########     ####    #######                 #                       #                      j #",
		"####################################################################################################",
	},
	{
		"# ##################################################################################################",
		"#@#    jSaz#   #  dj  @                   #                                                        #",
		"# #   ######   #      #            #      @                                                        #",
		"#h             #  hs  #            #### ####   ##   #####  #   #### ###### #######                 #",
		"#z#            #####################      # # #  # #   #  # #  #   #   #  ##  #                    #",
		"#a#   z z             #            #      #  #    #   #  ##### ####    #   ######                  #",
		"# #    z       ###hs###     l hh   h      # # #   #  #  #     ##   #   #  ##  #                    #",
		"# #   z z      #  sh  #     l hh   #      #####################################################    #",
		"# #            #      #            #      #           #   #   #    #   #      #  ##             ## #",
		"##########@#########################      #     ###     #   #    #   #   #    ##      #  ###  # #  #",
		"#  ##    # #z         #            #      #   #    ######################## ##       #  #   # #  # #",
		"##    #  #z######### ##            #      # #  #  ##             #  ####      ##  ##  #  # #   #   #",
		"# #####  # #       #  #            l      #  #  #          ##   #  #    #      # #  ##       #  #  #",
		"#z  j #  #z#          #       S    #      #   #  ## #        # #    ####    ##       #         # # #",
		"#  #  z  # # #######  #            #      #  ### # m#      ## #     #            ##         #####  #",
		"# #   #  #z#z      # ##            #      #   #   # ######       ## ###### ##  #   # # # # # #   # #",
		"# #####  # ####### #zz##############      #    #     #    #       #     #    ##  ##  ##   #  # #   #",
		"# z  ##  #z        ## #            #      #     ######   #   # ##m       ####  #   #  ## #  #   #  #",
		"#  z# #z ##########z h#     S      j      j#               # #             f  ## #  #   #  #   #   #",
		"#    z#              ##            #      #                 ##             # #    # # # #     #    #",
		"# # # #################     S      #      #                   # #### ####     #      # #       #   #",
		"#  #   z           #  #            #      #                   #    #    #                      #   #",
		"#########z ############            #      #                   # ####  ###                     #    #",
		"#  z     # #    z     ##############      #                   # #       #                     #    #",
		"#  z    h   h   z     #           jj      j#                  # #### ####                      #   #",
		"#################### ##    a       #      #                   #                               #    #",
		"#   z h  zzzz  h z    #            #      #                   #  #   #####                   #     #",
		"## ####################a   S   a   #      #                #  #  #   #                        #    #",
		"#  zh   aaaaaa  hz    #            #      #               ### #  #   #####                     #   #",
		"#################### ##            #      #                #  #  #       #                    #    #",
		"# hz   SSSSSSSS  zh   # a    a     #      #                   #  #   #####                    f    #",
		"#@####################################  ############## ######################## ####################",
		"#shjjjzsjshjjjjjjhsjsslfjfjjjshljsh      ####          #   #### #### #####       zzzzzzzz          #",
		"#sajjjzazjjzSshsajsssh######## ### ######              #      #    # #   #       zaaaaaaz          #",
		"#hzzsjsjzsjSjsjhjzjjjjshshhhslshhsh   #a#              #   ####  ### #####       zSSSSSSz          #",
		"#sjzsSzSzsSjjhsahhhhSh######## ### ####a#              #   #       # #   #       zzzzzzzz          #",
		"#sjjsssSzajjjsSjjjsshj#sszhzjahhsms   #a#              #   #### #### #####                         #",
		"#hjhzjassssssjssssshjj###########################################################################m##",
		"#jjhsjssjjhsssssjjsssajjjljjjjjjjjj                                                              @ #",
		"####################################################################################################",
	},
	{
		"####################################################################################################",
		"#  #                                                                                               #",
		"##@g        g       g                            g    ggggggggggg                                  #",
		"#gg##g#g#g#g#g#######g##########################g###############g################################  #",
		"#  g        g         g                        g                g                                  #",
		"#gg##g#g#g#g#g#########g######################g#################g################################  #",
		"#  g        g           g                    g                  g                                  #",
		"#gg##g#g#g#g#g###########g##################g###################g################################  #",
		"#  g        g             g                g                    g                                  #",
		"#gg##g#g#g#g#g#############g##############g#####################g################################  #",
		"#  g        g               g            g                      g                                  #",
		"#gg##g#g#g#g#g###############g##########g#######################g################################  #",
		"#  g        g                 g        g                        g                                  #",
		"#gg##g#g#g#g#g#################g######g#########################g##########gggggggggg############  #",
		"#  g        g                   g    g                          g                                  #",
		"#gg##g#g#g#g#g###################g##g###########################g################################  #",
		"#  g        g                     gg                            g                                  #",
		"#gg##g#g#g#g#g####################gg############################g##########gggggggggg############  #",
		"#  g        g                    g  g                           g                                  #",
		"#gg##g#g#g#g#g##################g####g##########################g################################  #",
		"#  g        g                  g      g                         g                                  #",
		"#gg##g#g#g#g#g################g########g########################g################################  #",
		"#  g        g                g          g                       g                                  #",
		"#jj##g#g#g#g#g##############g############g######################g################################  #",
		"#  g        g              g              g                     g                                  #",
		"#jj##g#g#g#g#g############g################g####################g################################  #",
		"#  g        g            g                  g                   g                                  #",
		"#jj##g#g#g#g#g##########g####################g##################g################################  #",
		"#  g        g          g                      g                 g                                  #",
		"#gg##g#g#g#g#g########g########################g################g################################  #",
		"#  g        g        g                          g               g                                  #",
		"#gg##g#g#g#g#g######g############################g##############g################################  #",
		"#  g #     z      aaaaaa    s  a                                                                  @#",
		"## #  # zzzzzzz   a a a      sa                                                                 zzz#",
		"#  # #   z z z   a  aa a     zs                                                                 zzz#",
		"##    ##z zzz z    aaaa     z  s                                                                 #z#",
		"#  #    #  z       aaaaa                                                                         #z#",
		"#   #  ###########################################################################################f#",
		"#    #                                                                                      @mlfff #",
		"####################################################################################################",
	},
	{
		"####################################################################################################",
		"# j    a         #                     #                     #                   #                 #",
		"#j@   a a        #    bggg             #         zzz         #     mmmm          #                 #",
		"#    a   a       #    g   g            #        z   z        #     l   m         #    jjjjjj       #",
		"#   aaaaaaa      g    gggg             g       z             #     l    m        #    j            #",
		"#  a       a     #    g    g           #       z    z        l     l d   m       l    jjjjj        #",
		"# a         a    #    g    g           #        zzzz         #     l     m       #    j            #",
		"#                #    ggggg            #                     #     l    m        #    j            #",
		"#                #                     #                     #     mmmmm         #    jjjjjjj      #",
		"#                #                     #                     #                   #                 #",
		"##########################################################################################l#########",
		"#                #                     #                     #                   #                 #",
		"#                #                     #                     #                   #                 #",
		"#  #             #       jjjjjj        #   #    #            #                   #     ########    #",
		"#  #             #          j          #   #    #            #      gggggg       #     #           #",
		"#  #             #          j          #   #    #            #     g      g      #     #           #",
		"#  #   #         #          j          #   ######      #     #     g             #     #           #",
		"#  #  #                    j               #    #   #  #     j     g gggggg      g     ######      #",
		"#  ###           #     j  j            #   #    #      #     #     g     g       #     #           #",
		"#  # #           #      jj             #   #    #   #        #     g     g       #     #           #",
		"#  #  #          #                     #   #    #   #  #     #     ggggggg       #     #           #",
		"#  #   #         #                     #                     #                   #                 #",
		"#                #                     #                     #                   #                 #",
		"###### #############################################################################################",
		"#                #                     #                     #                   #                 #",
		"#   l            #                     #     #     #         #      jj           #     #####       #",
		"#   l            #                     #     ##    #         #     j  j          #     #    #      #",
		"#   l            #                     #     # #   #         #    j    j         #     #####       #",
		"#   l            #                           #  #  #         #    j    j               #           #",
		"#   l            #                     #     #   # #         #    j   j          #     #           #",
		"#   l      l     #                     #     #    ##         #     jjj           #     #           #",
		"#   llllllll     #                     #     #     #         #                   #                 #",
		"#                #                     #                     #                   #                 #",
		"######## ################# ##################### ##################### ################### #########",
		"#                #                     #       #m##          #      zzzz         #      lll        #",
		"#    g   g       #       #####         #      #    #                z  z         #     l   l       #",
		"#    g   g                 #           #      #              #      zzz          #     l  ll       #",
		"#    g   g       #         #           #       ####          #      z  z         #      llll       #",
		"#     ggg g      #         #           #     #    #          #                   #          l      #",
		"####################################################################################################",
	},
	{
		"####################################################################################################",
		"# @@                                 m                                  #                         ##",
		"###                                 mmm                                # #                         #",
		"#  #                               #   #                              #   #                      # #",
		"#   #                             #     #                            #     #                       #",
		"#    #                           #       #                          #       #                   #  #",
		"#     #                         #         #                        #         #                     #",
		"#      #                       #           #                      #           #                #   #",
		"#       #                     #a           a#                    #             #                   #",
		"#        #                   # aa         aa #                  #               #             #    #",
		"#         #                 #  aaa  aaaa aaa  #                #                 #                 #",
		"#          #               #        aaaa       #              #                   #          #     #",
		"#           #             #         aaaa        #            #                     #               #",
		"#            #           #z         aaaa        z#          #                       #       #      #",
		"#             #         #  z                   z  #        #                         #             #",
		"#              #       #    z                 z    #      #                           #    #       #",
		"#               #     #      z    ###@###    z      #    #                             #           #",
		"#                #   #      zzzz  #     #   zzzzz    #  #                               # #        #",
		"#                 m m       zzzz  # fff #  z zzzz     mm                                 #         #",
		"#                 mmm       zzzzz @ ftf @ z  zzzz     mm                                 mm        #",
		"#                 mmm       zzzz z# fff #z   zzzz     mm                                 mm        #",
		"#                 m m           a #     # a           mm                                 #         #",
		"#                #   #         a  ###@###  a         #  #                               # #        #",
		"#               #     #       a             a       #    #                             #           #",
		"#              #       #     a               a     #      #                           #    #       #",
		"#             #         #   a       zzzz      a   #        #                         #             #",
		"#            #           # aSSS     zzzz    SSSa #          #                       #       #      #",
		"#           #             # SS      zzzz     SS #            #                     #               #",
		"#          #               #S       zzzz      S#              #                   #          #     #",
		"#         #                 #                 #                #                 #                 #",
		"#        #                   #               #                  #               #             #    #",
		"#       #                     #             #                    #             #                   #",
		"#      #                       #           #                      #           #                #   #",
		"#     #                         #         #                        #         #                     #",
		"#    #                           #       #                          #       #                   #  #",
		"#   #                             #     #                            #     #                       #",
		"#  #                               #   #                              #   #                      # #",
		"# #                                 mmm                                # #                         #",
		"##                                   m                                  #                         ##",
		"####################################################################################################",
	},
};
int tower=0;
void addlevels();
int AttAck(int attack);
void AttackMonster();
void color(int x); 
void cls();
void coutwhat(int a,int b,int c,int d,string n);
void Die();
void game();
char getin(char x,char y);
void gotoxy(int y,int x);
void gs();
void hidden();
void init();
void monsterbook();
void PrintfMap(int x);
int random(int n,int m);
void rf();
void Sout(string n);
void wf(); 
void shop();
void bnm(); 
void monsterbook()
{
	cls();
	int i,j,k;
	for(i=0;i=60)
	  	  j=-j;
	  	if (i<=0)
	  	  j=-j;
	  	Sleep(1);
	  }
}
void init()
{
	int i,j,k,I;
	Time=time_t();
	printf("初始化请稍等...");
	for(I=0;Iy);
	return l;
}
int random(int n,int m)
{
	int s;
	s=rand()%(m-n+1);
	s+=n;
	return s;
}
void cls()
{
	system("cls");
}
void shop()
{
	cls();
	int much[10]={30,50,120,30,50,150,30,50,120};
	
	while(1)
	  {printf("欢迎,你想买些什么?");
	printf("1.锈迹斑斑的铁剑 (attack+3) $30n");
	printf("2.崭新的铁剑 (attack+5) $50n");
	printf("3.银光闪闪的宝剑 (attack+12) $120n");
	printf("4.发霉的药水 (hp+20) $30n");
	printf("5.普通的药水 (hp+40) $50n");
	printf("6.高级药水 (hp+500 attack+10) $150n");
	printf("7.破烂盾牌 (defence+1) $30n");
	printf("8.木头盾牌 (defence+2) $50n");
	printf("9.坚固的铁盾(defence+4) $120n");
	printf("0.离开 $0n");
		char n=_getch();
		if (n=='0')
		  break;
		printf("确定买%c吗?Y/N",n);
		char m=_getch();
		if (m=='N'||m=='n')
		  continue;
		if (player.money0)
	  {
		m=player.hp/(j.attack-player.defence);
		if (player.attack-j.defence<=0)
		  {
	  		printf("你现在可能还打不过他呢,是否继续挑战?Y.yes N.no");
	  		l=_getch();
	  		player.attack=n;
	  		if (l=='n'||l=='N')
	  		  {
	  		  	PrintfMap(player.tower);
	  		  	player.x=x,player.y=y;
	  	 	    return;
	  	 	  }
	  	  }
		m*=(player.attack-j.defence);
		if (m<=j.hp)
	  	  {
	  		printf("你现在可能还打不过他呢,是否继续挑战?Y.yes N.no");
	  		l=_getch();
	  		player.attack=n;
	  		if (l=='n'||l=='N')
	  		  {
	  		  	PrintfMap(player.tower);
	  		  	player.x=x,player.y=y;
	  	 	    return;
	  	 	  }
	  	  }
	  }
	player.attack=n;
	while(j.hp>0&&player.hp>0)
	  {
		cls();
		printf("敌人:%sn",j.name.c_str());
		printf("敌人的血量:%dn",j.hp);
		printf("敌人的攻击:%dn",j.attack);
		printf("敌人的防御:%dn",j.defence);
		printf("你的血量:%dn",player.hp);
		printf("你的攻击:%dn",player.attack);
		printf("你的防御:%dn",player.defence); 
		printf("1.attack 2.run awayn");
		l=_getch();
		if (l=='2')
		  if (rand()%4==1&&j.name!="魔术师"&&j.name!="魔王_真")
		    {
		      map[player.tower][player.x][player.y].hp=j.hp;
		      return;
		    }
		  else
		    printf("逃跑失败!");
		 n=AttAck(player.attack);
		 n-=j.defence;
		 j.hp-=n;
		 if (n<=0)
		   n=1;
		 printf("你发起了攻击,%s受到了%d点伤害!n",j.name.c_str(),n);
		 n=j.attack*random(9,12)/10.0;
		 n-=player.defence;
		 if (n<=0)
		   n=1;
		 player.hp-=n;
		 printf("%s发起了攻击,你受到了%d点伤害!n",j.name.c_str(),n);
		 gs();
	  }
	if (player.hp<=0)
	  Die();
	if (map[player.tower][player.x][player.y].name=="魔王_真")
	  {
	  	system("cls");
	  	Sout("你成功打败了魔王,游戏结束,你赢了!");
	  	exit(0);
	  }
	if (map[player.tower][player.x][player.y].name=="流浪商人_魔化")
	  map[player.tower][player.x][player.y].name="流浪商人";
	map[player.tower][player.x][player.y].hp=0;
	map[player.tower][player.x][player.y].attack=0;
	map[player.tower][player.x][player.y].defence=0;
	map[player.tower][player.x][player.y].go=1;
	map[player.tower][player.x][player.y].monster=0;
	monster_[map[player.tower][player.x][player.y].number]=1;
	player.money+=Xp[map[player.tower][player.x][player.y].number];
	MAP[player.tower][player.x][player.y]=' ';
	PrintfMap(player.tower);
	return;
}
void addlevels()
{
	while(player.xp>uplevel[player.level])
	  player.level++,player.hp+=80,player.attack+=6,player.defence+=3;
}
void game()
{
	char l;
	int i,j,k,n,m;
	while(player.tower0&&map[player.tower][player.x-1][player.y].go) player.x--;break;
		  	  	case 's':if (player.x0&&map[player.tower][player.x][player.y-1].go) player.y--;break;
		  	  	case 'd':if (player.y>n;if (n<5)player.tower=n;else player.hp+=n,player.attack+=n,player.defence+=n,player.money+=n*100;
			  }
			if (sx!=player.x||sy!=player.y)
			  {
			  	gotoxy(sx,sy);
			  	cout<<" ";
			  	gotoxy(player.x,player.y);
			  	cout<<"O";
			  }
			if (map[player.tower][player.x][player.y].monster) 
			  if (MessageBox(NULL,TEXT("是否挑战此怪物?"),TEXT("?"),MB_YESNO)==IDYES)
			    AttackMonster(sx,sy);
			  else
			    {
			      gotoxy(player.x,player.y);
			      printf("%c",MAP[player.tower][player.x][player.y]);
			      player.x=sx,player.y=sy; 
			    }
			gotoxy(45,0);
			printf("位置:%d,%d,%d",player.x,player.tower+1,player.y);
			if (map[player.tower][player.x][player.y].hp<=0)
			  player.xp+=map[player.tower][player.x][player.y].xp;
			addlevels();
			map[player.tower][player.x][player.y].xp=0;
			if (map[player.tower][player.x][player.y].number==9)
			  player.hp+=50,MAP[player.tower][player.x][player.y]=' ',map[player.tower][player.x][player.y].number=0;
			if (map[player.tower][player.x][player.y].number==10)
			  player.attack+=10,MAP[player.tower][player.x][player.y]=' ',map[player.tower][player.x][player.y].number=0;
			if (MAP[player.tower][player.x][player.y]=='S')
			  player.defence+=4,MAP[player.tower][player.x][player.y]=' ',map[player.tower][player.x][player.y].number=0;
			if (MAP[player.tower][player.x][player.y]=='d'||map[player.tower][player.x][player.y].name=="流浪商人")
			  {
			    shop(); 
			    gotoxy(player.x,player.y);
			    printf("%c",MAP[player.tower][player.x][player.y]);
			    player.x=sx,player.y=sy; 
			  }
			if (MAP[player.tower][player.x][player.y]=='@')
			  {
			  	gotoxy(46,0);
			  	for(i=0;i0)));
		if (player.x==COLS-2&&player.y==LINES-2)
		  player.tower++,player.x=1,player.y=1;
		else if (player.tower>0)
		  player.tower--,player.x=38,player.y=98;
		//wf();
	  }
}
int main()
{
	char l;
	int i,j,k;
	hidden();
	init();
	game();
	return 0;
}

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4652715.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-06
下一篇 2022-11-06

发表评论

登录后才能评论

评论列表(0条)

保存