周次windows |
學習時間數組 |
新編寫代碼行數dom |
博客量(篇)ide |
學到知識點函數 |
第15周學習 |
|
1573測試 |
1動畫 |
再次熟悉項目流程spa
|
Game.h (頭文件)指針
#pragma once #include"stdio.h" #include"stdlib.h" #include"string.h" #include"hero.h" #include"windows.h" #define CLS " " #define SEP "|--------------------------------------------------------------------------------------------------|" #define COL 100 //遊戲頁面總長 #define MARGIN_X 20 //左邊距 #define MARGIN_XX 45 #define MARGIN_10 8 #define PAGE_TITLE_X 45 #define PAGE_TITLE_Y 2 #define MAP_START_Y 4 #define MAP_END_Y 16 #define INFOR_START_Y 15 #define INFOR_END_Y 23 #define SUP_NAME_Y 25 #define SUP_EXE_Y 27 /* 商品結構:商品編號,商品名稱,商品價格,商品數量(庫存),商品描述 玩家結構:玩家名稱,金錢,身份(平民V0/VIP),【揹包】 揹包結構:物品【100】(初始容量100),當前道具數量,最大道具數量 */ typedef enum _stufftype //道具類型 { Weapon=0,Armor=1,Mean=2,con=3 //武器,防具,功法,消耗品 }stufftype; /*商品結構*/ typedef struct _stuff //道具 { int id; //商品編號 char name[20]; //商品名稱 float price; //商品單價 int amoung; //商品數量 char desc[500]; //商品描述 stufftype type; //商品種類 union { //聯合-多選一 int minattack; //武器(或者功法) - 增長攻擊力 int mindefence; //防具 - 增長防護力 int minpower; //功法(或者道具) - 增長真元 }; union { //聯合-多選一 int maxattack; //武器(或者功法) - 增長攻擊力 int maxdefence; //防具 - 增長防護力 int maxpower; //功法(或者道具) - 增長真元 }; }Stuff; /*揹包結構*/ typedef struct _bag { Stuff item[10]; //揹包內的物品 int sum; //當前揹包內物品數量 int summax; //當前揹包內可容納最大的物品數量 int specount; //揹包內的物品種類的數量 }Bag; /*玩家結構*/ typedef struct _player { int id; char name[50]; //玩家暱稱 char pass[100]; //玩家的密碼 int glod; //玩家的財富(金幣) int wealth; //玩家的點券(經過充值得到) char iden[20]; //玩家的身份(VIP or V0) Bag bag; //玩家的揹包 int level; //玩家的遊戲等級 int exp; //玩家當前的經驗值 int nextexp; //玩家升級所需經驗 char achieve[10]; //玩家的境界 int hp; //玩家的血量 int attack; //玩家的攻擊力 int defence; //玩家的防護力 char mean[20]; //玩家所修功法 三個char型名稱其實能夠去掉,但我懶得刪了 int meanindex; //所修功法的標記(在揹包使用時記住ta的編號) 用stuff[index].name的形式使用 char weapon[20]; //玩家所裝備的武器 int weaponindex; //武器標記(在揹包使用時記住ta的編號) char armor[20]; //玩家所裝備的防具 int armorindex; //防具標記(在揹包使用時記住ta的編號) }Player; /*地圖結構*/ typedef struct _map { int id; //地圖編號 char name[20]; //地圖名稱 int minlevel; //進入最低等級 //座標結構 COORD coord; //地圖的座標 char desc[500]; //地圖介紹 Introduction }Map; /*怪物結構*/ typedef struct _monster { int id; //怪物id char name[30]; //怪物名稱 int level; //怪物的等級 char achieve[10]; //怪物的修爲 int hp; //怪物的血量 int attack; //怪物的攻擊力 int defence; //怪物的防護力 int minmoney; //殺死怪物後掉落金幣最低值 int maxmoney; //殺死怪物後掉落金幣最高值 int exp; //殺死怪物後得到的經驗值 int state; //怪物的狀態 0-死亡 非0表示存活 //Stuff item; //殺死怪物後有可能掉落的物品 COORD coord; //怪物的座標 }Monster; void Exit(); char Umenu(); //功能大廳 void Uloiinsucceed(); //登錄成功的動畫 void Ulogin(); //登錄界面 void Newlogn(); //新用戶註冊界面 int Uloginmenu(); //遊戲登錄界面 void Uopenstore(); //打開商城 void Lshowbag(Player *players); //打開揹包 void Ltrade(Player *player, int tradeid); //交易函數 void Lshowmap(Player *players); //打開地圖 void showinformation(Player *players); //打開我的信息 void LshowInformation(); //打印信息顯示區 void Lrefrush(Player *players); //刷新玩家的各類屬性 void Lshowmonster(Player *players); //顯示當前地圖上的怪物 void LCombat(int monsterid, Player *players); //核心:打怪啦 /*******************************************遊戲庫文件********************************************************/ void init(); //初始化遊戲設置,也就是包含如下函數設置 void SetTitle(char *title); //設置遊戲窗標題 /* 0-黑色, 1-藍色, 2-綠色, 3-淺綠色, 4-紅色, 5-紫色, 6-黃色, 7-白色 8-灰色, 9-淺藍色, 10-淺綠色, 11-淡淺綠色, 12-淡紅色, 13-淡紫色, 14-淡黃色, 15-亮白色 */ void SetColor(int foreColor,int backColor); //設置遊戲的前景色,背景色 void SetPosition(int x,int y); //設置光標的座標(位置) void ClearInfor(); //清除信息顯示區的消息 void LshowMapInfor(int x, int y); //在顯示區顯示地圖息信 void Lclearmall(); //商城清屏函數
Sour.c (源文件)
#include"stdio.h" #include"stdlib.h" #include"string.h" #include"hero.h" #include"windows.h" #include"conio.h" #include"Game.h" #pragma warning(disable:4996) extern Player players[]; extern Stuff stuffs[]; Monster monsters[]; extern int X, Y; /***************************前言**************************************/ /*當前遊戲還有着各類各樣的BUG,排版,怪物一大堆問題*/ /*還有我以前調試問題留下的大量註釋語句*/ main() { //char ch = getch(); //players[0].exp++; //printf("%d",players[0].exp); //getch(); init(); //scanf("%s", players[4].name); //printf("%s", players[4].name); int result; //登錄界面獲得的結果 char choice=' '; //選擇進入的功能 do { int index = 0; //返回登錄界面的標記 result = Uloginmenu(); if (result == 0) Ulogin(); while (1) { choice = Umenu(); switch (choice) { case '1': Lshowbag(players); break; case '2': Uopenstore(); break; case '3': Lshowmap(players); break; case '4': showinformation(players); break; case '8': index = 1; break; //標記,返回登錄界面 case '9': Exit(); break; } if (index == 1) break; } } while (1); getch(); return 0; }
Function.c (實現文件)
#include"stdio.h" #include"stdlib.h" #include"time.h" #include"string.h" #include"hero.h" #include"windows.h" #include"conio.h" #include"Game.h" #include"math.h" #pragma warning(disable:4996) Player players[]={ {0, "TEXT", "123456",50000,0 ,"Vip3",.bag.summax=10,1,1,1,"武道一重天",1000,100,100,}, {1, "hhh", "123456" ,500000,0 ,"Vip0",.bag.summax = 10 ,1,1,10,"武道一重天",100,10,10 , }, {2, "小七699", "123456" ,50000,0 ,"Vip0",.bag.summax = 10,1,1,10,"武道一重天",100,10,10," ",0," " ,0," ",0 }, {3, "何無", "123456",80000000,80000 ,"Vip8",.bag.summax = 10 ,1,1,10,"武道一重天",100,10,10," ",0," " ,0," ",0 } }; //int Playerlen=sizeof(players)/sizeof(Player); int playid=4; int loginid =0; //登陸標記 Stuff stuffs[] = { { 0,"天靈草",8999.0,5,"強大的治癒效果。能夠激發傳說中的天靈體。",con,.minpower=500,.maxpower=0}, { 1,"血魂果",11000.0,5,"增長大量肉身之力,令人血肉充足。" ,con,.minpower = 800,.maxpower = 1000 }, { 2,"生死花",89999.0,1,"由死轉生,能夠再人剛死那一瞬間將人救回。",con,.minpower = 5000,.maxpower = 10000 }, { 3,"天尊符昭",150000.0,2,"天尊強大因此能夠躲避劫罰,帶有天尊氣息都符昭能夠避劫。" ,con,.mindefence = 500,.maxdefence = 1000 }, { 4,"真仙魂血",9999999.9,0,"真仙的一滴魂血,蘊含毀天滅地的能量(可遇不可求)。" ,con,.minattack=800,.maxpower = 1000 }, { 5,"武道精氣(金)",88888,3,"至關於100條藍色等級的武道精氣,可以使人脫胎換骨。" ,con,.minpower = 500,.maxpower = 1000 }, { 6,"木劍",1000,30,"入門必備!" ,Weapon,.minattack = 20,.maxattack = 30 }, { 7,"玄天劍",2000,20,"入門必備!" ,Weapon,.minattack = 20,.maxattack = 50 }, { 8,"玄天刀",2000,20,"入門必備!" ,Weapon,.minattack = 15,.maxattack = 48 }, { 9,"絕影槍",5000,10,"搶出如龍,輕掠如火,難知如音!" ,Weapon,.minattack = 20,.maxattack = 60 }, { 10,"裂天弓",8000,30,"裂天弓!九箭,一箭一輩子死!" ,Weapon,.minattack = 20,.maxattack = 70 }, { 11,"血魔拳套",9500,30,"入門必備!" ,Weapon,.minattack = 20,.maxattack = 80 }, { 12,"玄天盾",3000,10,"入門必備!" ,Armor,.mindefence = 20,.maxdefence = 60 }, { 13,"玄天袍",3000,10,"入門必備!" ,Armor,.mindefence = 20,.maxdefence = 60 }, { 14,"荊棘戰甲",12000,5,"萬年玄鐵,九天玄冥刺融合而成的強大戰甲!" ,Armor,.mindefence = 20,.maxdefence = 100 }, { 15,"太極圖",10000,30,"入門必備!" ,Weapon,.minattack = 20,.maxattack = 80 }, { 16,"九轉玄陽罡氣",500000,1,"聖武顧家最強功法,聖武大陸九大聖階祕典之一!" ,Mean,.minattack = 200,.maxattack = 850 }, { 17,"天龍古經",450000,1,"聖武九門-天龍門鎮派之祕典,聖武大陸九大聖階祕典之一!" ,Mean,.minattack = 200,.maxattack = 800 }, { 18,"太和經",800000,1,"聖武大陸最神奇的功法,熔鍊各類功法!" ,Mean,.minattack = 500,.maxattack = 1200 }, { 19,"魔典",500000,30,"聖武大陸魔道之首魔宮,其主魔帝功力冠絕天下,鮮有敵手!" ,Mean,.minattack = 20,.maxattack = 850 }, { 20,"血魔手",50000,30,"極品功法!" ,Mean,.minattack = 20,.maxattack = 200 }, { 21,"烈焰拳!",10000,30,"高級功法!" ,Mean,.minattack = 20,.maxattack = 100 }, { 22,"七轉斷山拳",30000,30,"高級功法,無限趨近極品功法!" ,Mean,.minattack = 20,.maxattack = 189 }, { 23,"劍風決",80000,30,"極品功法!" ,Mean,.minattack = 20,.maxattack = 220 }, { 24,"九重金身決",100000,30,"絕品功法!" ,Mean,.minattack = 20,.maxattack = 360 }, { 25,"潛龍藥劑",10000,5,"神級藥劑!血量永久加300" ,con,.minpower=20,.maxpower = 300 }, { 26,"玄清丹",6000,1,"神級藥劑!經驗值加200" ,con,.minpower = 20,.maxpower = 200 }, { 27,"大力牛魔丹",10000,1,"神級藥劑!力量永久加300" ,con,.minpower = 20,.maxpower = 300 }, { 28,"心魔草",3000,50,"集齊10個能夠煉心魔丹" ,con,.minpower = 20,.maxpower = 30 }, { 29,"武道石",10000,5,"逆天神物" ,con,.minpower = 20,.maxpower = 300 }, { 30,"武道草",10000,5,"逆天神物" ,con,.minpower = 20,.maxpower = 300 }, { 31,"龍涎香",30000,1,"神級藥劑!血量永久加500" ,con,.minpower = 20,.maxpower = 500 }, { 32,"經驗藥劑(小)",1000,50,"神級藥劑!經驗永久加30" ,con,.minpower = 20,.maxpower = 30 }, { 33,"經驗藥劑(大)",10000,5,"神級藥劑!血量永久加300" ,con,.minpower = 20,.maxpower = 300 }, { 34,"三陽烈焰斬",300000,1,"仙域術法" ,Mean,.minattack = 20,.maxattack = 1000 }, { 35,"純陽指",310000,1,"仙域術法" ,Mean,.minattack = 20,.maxattack = 1200 }, { 36,"八荒六合功",500000,1,"仙域術法,準聖功法" ,Mean,.minattack = 20,.maxattack = 3000 }, { 37,"九千殺伐術",550000,1,"仙域術法,準聖功法" ,Mean,.minattack = 20,.maxattack = 3200 }, { 38,"神鳳焚天印",1000000,1,"真正的聖人功法!梵天滅地" ,Mean,.minattack = 20,.maxattack =5300 }, { 39,"破滅印",1000000,1,"真正的聖人功法!剛猛霸道,無堅不摧,破壞力不可思議。" ,Mean,.minattack = 20,.maxattack = 5000 }, { 40,"無極聖元功",9999999,1,"天上地下第一功法!" ,Mean,.minattack = 20,.maxattack = 10000 }, { 41,"九天驚雷術!",9780000,1,"真仙級功法!召喚滅世天劫" ,Mean,.minattack = 20,.maxattack = 8800 }, { 42,"吞煉山河",10000000,1,"真正的聖人功法!" ,Mean,.minattack = 20,.maxattack = 9200 }, //空缺5,6,7欄位的商品 { 100,"太極圖",10000,30,"入門必備!" ,Mean,.minattack = 20,.maxattack = 80 } }; int Stufflen = sizeof(stuffs) / sizeof(Stuff); int X = 3; int Y = 2; Map mapArray[8][8] = { { { 1,"顧家花園",1,{ 0.0 }," 顧家一座安靜的花園,這裏亭臺坐落,小橋流水,周圍更有有百花爭豔,綻開異彩。特別是那一簇又一簇迷人的花色,被清澈如鏡的水面映照之下,使得這裏流光溢彩,猶若仙境。偶爾,一兩隻蝴蝶飛過,翅膀上彩霞點點,尤爲在明媚的陽光下,更加奪目。" },{ 2,"顧家主殿",1,{ 0.1 },"這裏是燕國聖武九門之一的聖武世家,顧家!" }, { 3,"後山禁地",1,{ 0.2 },"後山禁地,那是一座上古之地,整片天地都籠罩在浩大的上古大陣中,傳說裏面有着諸多神祕。" },{ 3,"柴房",1,{ 0.3 },"說着,顧風惡狠狠地拎着那管理雜物的管家走向房間,不知道說了些什麼。當出來後,顧老八徹底變了個樣兒,看向雪十三的目光充滿了陰厲與蔑視。" }, { 5,"聖武山",1,{ 0.4 },"顧家所在!" },{ 5,"聖武城",1,{ 0.5 },"聖武城,世間共有九座,分別隸屬於聖武九門的九大聖武世家。 眼前顧家的這座城池,更是燕國僅有的惟一一座聖武城,意義非凡!" }, { 7,"燕國",1,{ 0.6 },"這裏是是一切故事開始的地方!" },{ 8,"大永帝國",1,{ 0.7 },"燕國的友邦,兩國間的關係一直很好。" } }, { { 9,"通天樓",1,{ 1.0 }," 通天樓,這是在燕國赫赫有名的一大勢力,他們尤其出名的是情報消息,號稱本領通天,無所不知。" },{ 10,"天劍門",1,{ 1.2 }," " }, { 11,"雅軒閣",1,{ 1.2 },"拍賣行!" },{ 12,"天魔山",1,{ 1.3 },"魔宮所在,魔宮中的有名強者被劃分爲:金木水火土五大閻君,其次爲青龍、白虎、朱雀、玄武、麒麟五大護法,接着是十大長老,天、地、人三大魔帥,兩大魔尊,最後則是……魔宮的宮主,被稱爲魔帝。" }, { 13,"銀黃殿",1,{ 1.4 },"一座氣勢磅礴,連綿成片的巨大宮殿羣呈如今眼前,僅是門面的雕琢,便充滿一股貴氣。" },{ 14,"黑龍帝國",1,{ 1.5 },"黑龍帝國內憂外患,隨時可以滅國。" }, { 15,"飛雪山莊",1,{ 1.6 },"飛雪山莊,在整個天下間也是極爲有名氣的。整個飛雪山莊,最強者是他們的老祖,卡在八重天圓滿之境多年,一直不能破入九重天。可是,傳說,那是一件被武道神話凌之軒加持過的絕品神器,真正威能比之聖階神器絲絕不弱,還要更強。" },{ 16,"天山祕境",1,{ 1.7 },"此祕境八百年沒有開啓了,想必裏面各類古藥、靈果" } }, { { 17,"司徒家",1,{ 2.0 },"聖武九門之一!" },{ 18,"竹屋",1,{ 2.1 },"八百年前的武道神話凌之軒曾經居住過的地方。" }, { 19,"鳳音閣",1,{ 2.2 },"聖武九門之一!" },{ 20,"神宮",1,{ 2.3 },"一個龐大,神祕的勢力!" }, { 21,"血衣門",1,{ 2.4 },"血衣門惡名昭彰,任誰聽到名字都要聞風喪膽。" },{ 22,"天龍門",1,{ 2.5 },"聖武世家的威嚴不可侵犯!" }, { 23,"天霜門",1,{ 2.6 },"可聖武世家之間是有着盟約的,任何一方敢覬覦對方的聖階祕典,將遭到全部勢力的圍攻。" },{ 24,"天雲帝國",1,{ 2.7 }," !" } }, { { 25,"無量宗",1,{ 3.0 },"「千年以前,聖武九門分紅三派,一派是血衣門與魔宮兩大邪道,一派是我等名門正派,最後一派則是……無量宗。」" },{ 26,"天靈山",1,{ 3.1 },"妖獸縱橫!" }, { 27,"上古戰場",1,{ 3.2 }," 有數百丈大的骸骨橫陳,不知是何種異獸,骨骼現在還有些晶瑩,散着股讓人心驚的氣息。" },{ 28,"永生道門",1,{ 3.3 },"此門威力無窮,可上震諸天,下震九幽,假若可以打開其奧祕,將使人堪破生死,得證長生!只是,這個過程十分危險,須有勇往直前的信心,一旦失敗,將萬劫不復。" }, { 29,"雲嵐帝國",1,{ 3.4 },"「此處靠近雲嵐帝國,據說該國以一套上古殘陣而聞名大6,是周圍方圓數萬裏內的巨無霸,比肩一流勢力。大家……但是雲嵐帝國的人?」" },{ 30,"血狼谷",1,{ 3.5 },"血狼谷谷主是風雲榜上的強者,位於前列,實力強大恐怖。" }, { 31,"亂劍山",1,{ 3.6 },"大周帝國的一個強大勢力。" },{ 32,"西部冰域李家",1,{ 3.7 },"聖武九門之一!" } }, { { 33,"鳳鳴谷",1,{ 4.0 }," 鳳鳴谷是一片絕世凶地,若是是日常人到此,只會見到外圍的那片廢墟峽谷,連入口都難以找到。!" },{ 34,"百花宮",1,{ 4.1 },"百花宮皆女子,全部人彙集此處,可謂百花爭豔,芳香怡人,讓人看得眼花繚亂。" }, { 35,"穿雲宮",1,{ 4.2 },"穿雲宮屬於一流勢力,但其老祖只是一隻腳踏入了九重天,並未真正跨入進去。但憑藉着穿雲宮的震天弓,其攻擊力卻足以達到九重天的層次。這才使得他們位列一流勢力當中。!" },{ 36,"大周帝國",1,{ 4.3 },"大周帝國雖然是一流強國,但在整個天下間,卻也並非特別顯眼。!" }, { 37,"鳳陽城",1,{ 4.4 },"鳳陽城!" },{ 38,"天星谷",1,{ 4.5 },"不長時間,他們便見到遠處一座密林,冒着氤氳靈氣,雲蒸霧繞,此時天沒亮,那邊的光芒卻映照的璀璨一片,彷彿一片仙家神聖之地!" }, { 39,"風神宮",1,{ 4.6 },"!" },{ 40,"仙門",1,{ 4.7 },"能夠說,要想成就武道神話,就必須跨越聖武九門這九座龐然大物,不然,即是灰飛煙滅的下場。此劫被稱爲……生死劫!" } }, //如下開始爲仙道世界地圖 { { 41,"雪神宮",11,{ 5.0 },"這裏也是故事開始的地方!" },{ 42,"帝氏一族",11,{ 5.1 },"滄瀾界雖然比不上仙道世界那麼的浩大輝煌,可畢竟也是一片修仙大世界,資源雄渾。所以,這裏早已被仙域中的幾你們族佔領,統御此處。而帝氏一族,即是其中之一。" }, { 43,"鬼蜮",11,{ 5.2 },"鬼蜮,聽說,那是一片神祕的地域,聽說,那裏是一羣曾經死去的人棲居。!" },{ 44,"萬蒼聖宮",11,{ 5.3 },"雪十三知道一些這個勢力的傳說,那萬蒼聖人的《萬蒼聖功》無比霸道,一經施展,能將人的一身生機給抽掉。雪十三知道一些這個勢力的傳說,那萬蒼聖人的《萬蒼聖功》無比霸道,一經施展,能將人的一身生機給抽掉。" }, { 45,"北玄域",11,{ 5.4 },"聽聞她們一貫與世無爭,安靜修煉,還不時地救濟一些貧苦的修士" },{ 46,"麒麟巢",11,{ 5.5 },"真正的麒麟巢,這裏空間比外面還要浩大許多,周圍,那龍眼大的珍珠、寶石等,數不勝數,流光溢彩,美輪美奐。!" }, { 47,"天雷宗",11,{ 5.6 },"!" },{ 48,"北玄域",11,{ 5.7 },"那裏各大妖族盤踞,不說萬族林立,也差不了多少,最起碼有上千個種族。" } }, { { 49,"妖域",11,{ 6.0 },"大妖遍地,強勢無比!" },{ 50,"萬劍宮",11,{ 6.1 },"!" }, { 51,"金龍拍賣行",11,{ 6.2 },"這個商會無比龐大,分行遍及整個北玄域,聽說,在其餘幾大域中也有勢力盤根錯節,十分很差惹。 根本緣由,是該族有聖人坐鎮。!" },{ 52,"玄昆宮",11,{ 6.3 },"那玄昆宮的宮主便到來,一身藍色錦袍,很年輕,面如刀削,髮絲漆黑,眸子若星辰般明亮,整我的的氣勢渾然天成。!" }, { 53,"化龍洞",11,{ 6.4 },"毫無疑問,這化龍洞是一場天大的造化,可同時又是一處無比恐怖的地方,就是稱爲禁地都不過度,太可怕了。這麼多年來,進去的人活着出來的不足十分之一,而成功領悟完成蛻變,得到大造化者,倒是不足千分之一。" },{ 54,"聖天宮",11,{ 6.5 },"那是聖天宮的殿主,他踏着大印而來,聽說那是他的成名法器,以稀有的金屬鍛造,有山河之重,可一力破萬法。!" }, { 55,"邪域",11,{ 6.6 },"!" },{ 56,"大元殿",11,{ 6.7 },"大元殿殿主的那口神劍,神霞千萬,都撕裂虛空了,太恐怖。!" } }, { { 57,"天靈觀",11,{ 7.0 },"此道觀雖非聖人傳承,也不是什麼名震天下的大勢力,可卻曾在兩萬年前現出過仙蹟。 傳說,這裏有真仙留下的一道法印烙印,十分了得,擁有不朽的奧義,參悟後可得長生。!" },{ 58,"天秀宮",11,{ 7.1 },"天秀宮是南玄域一個一流大勢力,門派中有化虛層次的強者坐鎮,雖然不是聖人傳承世家,可存在的歲月古老,底蘊深厚,威震一方。" }, { 59,"玉劍宮",11,{ 7.2 },"這裏是一片山脈,霧靄騰騰,百花怒放,馨香撲鼻,還有鳥獸啼鳴,一片祥和的氣息,出塵而寧靜,這是一方淨土。" },{ 60,"死亡星海",11,{ 7.3 },"這裏處處都是毀滅般的氣息,根本沒有一絲的生機,四周的地面也都是光禿禿的一片,由於被這種氣息籠罩,任何植被都沒法生長。每個時代,每一段時空,都被死亡星海貫穿,全部殞落的生靈,破碎的物體,包括星辰世界等,都會被它吸過來。" }, { 61,"永恆族",11,{ 7.4 },"域外神祕種族!" },{ 62,"殺戮神殿",11,{ 7.5 },"殺戮聖騎士的歸屬!" }, { 63,"初始之地",11,{ 7.6 },"混沌!" },{ 64,"天尊傳承",20,{ 7.7 },"有概率得到天尊傳承!" } } }; Monster monsters[] = { //鳳鳴谷 { 1,"守門弟子",1,"武道一重天",150,150,150,10,15,5,1,{0,4}}, { 2,"外門弟子",3,"武道三重天",300,400,150,20,35,20,1 ,{ 0,4 } }, { 3,"內門弟子",5,"武道五重天",500,600,30,65,50,1,{ 0, } }, { 4,"精英弟子",6,"武道六重天",1000,700,250,50,200,100,1,{ 0,4 } }, { 5,"傳承弟子",7,"武道七重天",1000,800,300,200,500,300,1 ,{ 0,4 } }, { 6,"外門長老",8,"武道八重天",2000,1000,320,500,605,500,1 ,{ 0,4 } }, { 7,"內門長老",8,"武道八重天",2000,1020,330,500,655,600,1 ,{ 0,4 } }, { 8,"大長老",9,"武道九重天",3000,1550,350,600,800,800,1 ,{ 0,4 } }, { 9,"掌門",10,"武道通神",5000,1660,400,1000,3500,1000,1 ,{ 0,4 } }, //神宮 { 10,"血袍人",1,"武道一重天",150,150,100,10,15,5,1,{ 3,2 } }, { 11,"血袍人",3,"武道三重天",300,400,150,20,35,20,1,{ 3,2 } }, { 12,"血袍人",5,"武道五重天",500,600,200,30,65,50,1,{ 3,2 } }, { 13,"血袍人",6,"武道六重天",1000,700,250,50,200,100,1,{ 3,2 } }, { 14,"血袍人",7,"武道七重天",1000,800,300,200,500,300,1 ,{ 3,2 } }, { 15,"陳皇(少主)",8,"武道八重天",2000,1000,320,500,605,500,1 ,{ 3,2 } }, { 16,"血袍總管",8,"武道八重天",2000,1030,330,500,655,600,1 ,{ 3,2 } }, { 17,"血袍大總管",9,"武道九重天",3000,1250,350,600,800,800,1 ,{ 3,2 } }, { 18,"神宮宮主",10,"武道通神",5200,1680,400,1000,3500,1000,1 ,{ 3,2 } }, //顧家主殿 //{ 19,"弟子",1,"武道一重天",150,100,100,10,15,5,1,{ 1,0 } }, { 20,"弟子",3,"武道三重天",300,150,150,20,35,20,1,{ 1,0 } }, { 21,"弟子",5,"武道五重天",500,400,200,30,65,50,1,{ 1,0 } }, { 22,"弟子",6,"武道六重天",1000,650,250,50,200,100,1,{ 1,0 } }, { 23,"第五供奉",7,"武道七重天",1000,700,300,200,500,300,1 ,{ 1,0 } }, { 24,"第四供奉",8,"武道八重天",2000,820,320,500,605,500,1 ,{ 1,0 } }, { 25,"第三供奉",8,"武道八重天",2000,1030,330,500,655,600,1 ,{ 1,0 } }, { 26,"第二供奉",9,"武道九重天",3000,1350,350,600,800,800,1 ,{ 1,0 } }, { 27,"第一供奉",10,"武道通神",5100,1400,400,1000,3500,1000,1 ,{ 1,0 } }, { 28,"劍尊",10,"武道通神",5300,1480,400,1000,3500,1000,1 ,{ 1,0 } }, //聖武山 { 29,"弟子",5,"武道五重天",500,600,200,30,65,50,1,{ 4,0 } }, { 30,"弟子",6,"武道六重天",1000,750,250,50,200,100,1,{ 4,0 } }, { 31,"第九供奉",7,"武道七重天",1000,1000,300,200,500,300,1 ,{ 4,0 } }, { 32,"第八供奉",8,"武道八重天",2000,1320,320,500,605,500,1 ,{ 4,0 } }, { 33,"第七供奉",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 4,0 } }, { 34,"第六供奉",9,"武道九重天",3000,1650,350,600,800,800,1 ,{ 4,0 } }, { 35,"二長老",10,"武道通神",5100,1400,400,1000,3500,1000,1 ,{ 4,0 } }, { 36,"顧西風",10,"武道通神",5300,1500,400,1000,3500,1000,1 ,{ 4,0 } }, { 37,"顧天霸",10,"武道通神",5300,1800,400,1000,3500,1000,1 ,{ 4,0 } }, //神宮 { 10,"血袍人",1,"武道一重天",150,150,100,10,15,5,1,{ 3,2 } }, { 11,"血袍人",3,"武道三重天",300,400,150,20,35,20,1,{ 3,2 } }, { 12,"血袍人",5,"武道五重天",500,600,200,30,65,50,1,{ 3,2 } }, { 13,"血袍人",6,"武道六重天",1000,700,250,50,200,100,1,{ 3,2 } }, { 14,"血袍人",7,"武道七重天",1000,800,300,200,500,300,1 ,{ 3,2 } }, { 15,"陳皇(少主)",8,"武道八重天",2000,1000,320,500,605,500,1 ,{ 3,2 } }, { 16,"血袍總管",8,"武道八重天",2000,1030,330,500,655,600,1 ,{ 3,2 } }, { 17,"血袍大總管",9,"武道九重天",3000,1250,350,600,800,800,1 ,{ 3,2 } }, { 18,"神宮宮主",10,"武道通神",5200,1680,400,1000,3500,1000,1 ,{ 3,2 } }, //顧家主殿 //{ 19,"弟子",1,"武道一重天",150,100,100,10,15,5,1,{ 1,0 } }, { 20,"弟子",3,"武道三重天",300,150,150,20,35,20,1,{ 1,0 } }, { 21,"弟子",5,"武道五重天",500,400,200,30,65,50,1,{ 1,0 } }, { 22,"弟子",6,"武道六重天",1000,650,250,50,200,100,1,{ 1,0 } }, { 23,"第五供奉",7,"武道七重天",1000,700,300,200,500,300,1 ,{ 1,0 } }, { 24,"第四供奉",8,"武道八重天",2000,820,320,500,605,500,1 ,{ 1,0 } }, { 25,"第三供奉",8,"武道八重天",2000,1030,330,500,655,600,1 ,{ 1,0 } }, { 26,"第二供奉",9,"武道九重天",3000,1350,350,600,800,800,1 ,{ 1,0 } }, { 27,"第一供奉",10,"武道通神",5100,1400,400,1000,3500,1000,1 ,{ 1,0 } }, { 28,"劍尊",10,"武道通神",5300,1480,400,1000,3500,1000,1 ,{ 1,0 } }, //聖武山 { 29,"弟子",5,"武道五重天",500,600,200,30,65,50,1,{ 4,0 } }, { 30,"弟子",6,"武道六重天",1000,750,250,50,200,100,1,{ 4,0 } }, { 31,"第九供奉",7,"武道七重天",1000,1000,300,200,500,300,1 ,{ 4,0 } }, { 32,"第八供奉",8,"武道八重天",2000,1320,320,500,605,500,1 ,{ 4,0 } }, { 33,"第七供奉",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 4,0 } }, { 34,"第六供奉",9,"武道九重天",3000,1650,350,600,800,800,1 ,{ 4,0 } }, { 35,"二長老",10,"武道通神",5100,1400,400,1000,3500,1000,1 ,{ 4,0 } }, { 36,"顧西風",10,"武道通神",5300,1500,400,1000,3500,1000,1 ,{ 4,0 } }, { 37,"顧天霸",10,"武道通神",5300,1800,400,1000,3500,1000,1 ,{ 4,0 } }, //天魔山 { 38,"魔宮弟子",5,"武道五重天",500,600,200,30,65,50,1,{ 3,1 } }, { 42,"木閻行君",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 3,1 } }, { 42,"金閻行君",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 3,1 } }, { 42,"土閻行君",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 3,1 } }, { 42,"火閻行君",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 3,1 } }, { 43,"水閻行君",9,"武道九重天",3000,1650,350,600,800,800,1 ,{ 3,1 } }, { 44,"白魔尊",10,"武道通神",5100,1400,400,1000,3500,1000,1 ,{ 3,1 } }, { 45,"黑魔尊",10,"武道通神",5300,1500,400,1000,3500,1000,1 ,{ 3,1 } }, { 46,"魔帝",10,"武道通神",5300,1700,400,1000,3500,1000,1 ,{ 3,1 } }, //後山禁地 { 47,"禁地英魂",5,"武道五重天",500,600,200,30,65,50,1,{ 2,0 } }, { 48,"禁地英魂",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 2,0 } }, { 49,"禁地英魂",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 2,0 } }, { 50,"禁地英魂",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 2,0 } }, { 51,"禁地英魂",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 2,0 } }, { 52,"禁地英魂",9,"武道九重天",3000,1650,350,600,800,800,1 ,{ 2,0 } }, { 53,"禁地英魂",10,"武道通神",5100,1400,400,1000,3500,1000,1 ,{ 2,0 } }, { 54,"禁地英魂",10,"武道通神",5300,1500,400,1000,3500,1000,1 ,{ 2,0 } }, { 55,"顧天雄",10,"武道通神",5300,1700,400,1000,3500,1000,1 ,{ 2,0 } }, //天山祕境 { 29,"祕境亡魂",5,"武道五重天",500,600,200,30,65,50,1,{ 7,1 } }, { 30,"祕境亡魂",6,"武道六重天",1000,750,250,50,200,100,1,{ 7,1 } }, { 31,"祕境亡魂",7,"武道七重天",1000,1000,300,200,500,300,1 ,{ 7,1 } }, { 32,"祕境亡魂",8,"武道八重天",2000,1320,320,500,605,500,1 ,{ 7,1 } }, { 33,"祕境亡魂",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 7,1 } }, { 34,"祕境亡魂",9,"武道九重天",3000,1650,350,600,800,800,1 ,{ 7,1 } }, { 35,"祕境亡魂",10,"武道通神",5100,1400,400,1000,3500,1000,1 ,{ 7,1 } }, { 36,"祕境亡魂",10,"武道通神",5300,1500,400,1000,3500,1000,1 ,{ 7,1 } }, { 37,"祕境亡魂",10,"武道通神",5300,1600,400,1000,3500,1000,1 ,{ 7,1 } }, //永生道門 { 55,"恐怖身影",10,"武道通神",5300,1800,400,1000,3500,1000,1 ,{ 3,3 } }, //上古戰場 { 47,"上古英魂",5,"武道五重天",500,600,200,30,65,50,1,{ 2,3 } }, { 48,"上古英魂",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 2,3 } }, { 49,"上古英魂",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 2,3 } }, { 50,"上古英魂",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 2,3 } }, { 51,"上古英魂",8,"武道八重天",2000,1330,330,500,655,600,1 ,{ 2,3 } }, { 52,"上古英魂",9,"武道九重天",3000,1650,350,600,800,800,1 ,{ 2,3 } }, { 53,"上古英魂",10,"武道通神",5100,1400,400,1000,3500,1000,1 ,{ 2,3 } }, { 54,"上古英魂",10,"武道通神",5300,1500,400,1000,3500,1000,1 ,{ 2,3 } }, { 55,"上古英魂",10,"武道通神",5300,1700,400,1000,3500,1000,1 ,{ 2,3 } }, { 100,"魔帝",10,"武道通神",5300,1700,400,1000,3500,1000,1 ,{ 3,1 } } }; int monstercount = sizeof(monsters) / sizeof(Monster); int Uloginmenu() //遊戲登錄界面 { //getchar(); system("cls"); char choice; printf("\n"); printf("\t\t\t\t\t歡迎來到- 仙域天尊 -!\n\n"); SetPosition(MARGIN_X, 4); printf("請選擇:\t(1)【老用戶登錄】 (2)【新用戶註冊】 (3)【遊客登錄】(暫不開放)\n"); do { printf("\n"); printf(" 請輸入1 or 2;"); choice = getchar(); if (choice == '2') { Newlogn(); printf("\t\t\t\t註冊成功!按任意鍵進入登錄頁面.\n"); getch(); break; } else if (choice == '1') { break; } } while (choice != 1 && choice != 2); return 0; } void Newlogn() { int a = playid; printf("\t\t\t\t請設置用戶名/暱稱:"); scanf("%s", players[a].name); //gets(players[playid].name); //fflush(stdin); printf("\t\t\t\t請設置密碼:"); scanf("%s", players[a].pass); //gets(players[playid].pass); fflush(stdin); players[a].id = playid; playid++; players[a].glod = 50000; players[a].wealth = 0; strcpy(players[a].iden, "Vip0"); players[a].bag.summax = 20; players[a].level = 1; players[a].exp = 1; players[a].nextexp = 10; strcpy(players[a].achieve, "武道一重天"); players[a].hp = 100; players[a].attack = 10; players[a].defence = 10; strcpy(players[a].weapon," "); strcpy(players[a].armor, " "); strcpy(players[a].mean, " "); } void Ulogin() { int i; int wrongcount=0; int flag=0; char temp[20]; char pass[20]; system("cls"); printf("\n"); SetPosition(PAGE_TITLE_X, PAGE_TITLE_Y); printf("仙域天尊-997工做室\n"); printf("\n"); do { printf("\t\t\t\t\t請輸入用戶名/暱稱:"); scanf("%s", temp); printf("\t\t\t\t\t請輸入密碼:"); scanf("%s", pass); //printf("%s\n",players[playid].name); //printf("%s\n",temp); for (i = 0; i < playid;i++) { if ((strcmp(temp, players[i].name) == 0) && (strcmp(pass, players[i].pass) == 0)) { flag = 1; loginid = i; } } //printf("%d",flag); if (flag == 1) { Uloiinsucceed(); break; } else wrongcount++; printf(" 帳號或密碼錯誤,請從新輸入!已輸入錯誤%d次,錯誤3次將退出遊戲!\n",wrongcount); } while (wrongcount != 3); if (wrongcount == 3) { printf("\n"); printf(" "); printf("輸入錯誤3次,正在退出系統!"); for (int i = 0; i < 3; i++) { printf("."); Sleep(500); } exit(0); } } void Uloiinsucceed() { printf("\t\t\t\t\t\t\t\t\t\t|當前用戶爲:%s(%s)\n", players[loginid].name, players[loginid].iden); printf("\t\t\t\t 請選擇區服;\n"); printf("\t\t\t\t 1.測試先驅服1\n\t\t\t\t 2.......\n"); getchar(); printf(" 正在進入\n"); printf(" "); for (int i = 0; i < 20; i++) { printf("□"); Sleep(300); } } char Umenu() //功能大廳 { char choice=' '; system("cls"); printf("\n"); printf(" 仙域天尊-功能大廳\n"); printf("\n"); //printf("\t\t\t\t\t\t\t|當前用戶爲:%s(%s)| 金幣:%d | 點券:%d |\n", players[loginid].name, players[loginid].iden, players[loginid].glod, players[loginid].wealth); printf("\n"); printf("\t\t1.揹包\t\t\t 2.商城\t\t 3.地圖\n"); printf("\t\t4.我的信息\t\t\t8.退出登錄\t\t\t9.退出遊戲\n"); printf("\t\t請輸入您的選擇:"); scanf("%c", &choice); return choice; } void Uopenstore() { getchar(); char a; //接收是否交易的指令 int choiceindex = 0; //接收須要購買商品的編號 system("cls"); printf("\n"); SetPosition(PAGE_TITLE_X, PAGE_TITLE_Y); printf("仙域天尊-遊戲商城\n"); printf("\n"); printf("\t\t\t\t\t\t\t\t|當前用戶爲:%s(%s)| 金幣:%d | 點券:%d |\n", players[loginid].name, players[loginid].iden, players[loginid].glod, players[loginid].wealth); printf("\n"); printf(" <1>默認\t<2>\t <3>\t <4>\t <5>\t <6>\t <7>\t <8>\n"); printf("熱門商品 | 裝備(武道) | 功法(武道) | 物品(武道) | 裝備(仙道) | 功法(仙道) | 物品(仙道) | 天地造化(仙域)\n"); printf("熱門商品-->\n"); printf("ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=(~ ̄▽ ̄)~\n"); printf("\n"); //int len; int i=0; //len = sizeof(stuffs) / sizeof(Stuff); printf("編號\t商品名稱\t單價\t\tVIP價格\t\t數量\t物品描述\n"); for(i=0;i<7;i++) printf("%d\t%-12s %-10.1f\t%-10.1f\t%d\t%s\n",stuffs[i].id, stuffs[i].name, stuffs[i].price, stuffs[i].price*0.8, stuffs[i].amoung, stuffs[i].desc); printf("\n"); printf(" d=================================================================================( ̄▽ ̄*)b\n"); do { for (i = 0; i < 4; i++) { SetPosition(0, 24+i); printf(" "); } SetPosition(80, 23); printf("Tps:當前商店;欄位5,6,7暫無物品"); SetPosition(0, 23); printf("請選擇商店欄位(按ENTER鍵直接進入購買或按ESC退出):"); //scanf("%c", &a); a = getch(); if (a == 'Y' || a == 'y' || a == '1' || a == '2' || a == '3' || a == '4' || a == '5' || a == '6' || a == '7' || a==13 || a==108 ||a==27 || a=='8') //暫時只開發聖武大陸 { if (a == 27) break; if(a!=13) Lclearmall(); //商城清屏函數 if (a == 13) { SetPosition(0,25); printf("請輸入要購買的商品的編號:"); scanf("%d", &choiceindex); Ltrade(&players[loginid], choiceindex); } else if (a == '1') { SetPosition(0, 8); printf("熱門商品-->\n"); printf("ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=(~ ̄▽ ̄)~\n"); printf("\n"); //int len; int i = 0; //len = sizeof(stuffs) / sizeof(Stuff); printf("編號\t商品名稱\t單價\t\tVIP價格\t\t數量\t物品描述\n"); for (i = 0; i < 7; i++) printf("%d\t%-12s %-10.1f\t%-10.1f\t%d\t%s\n", stuffs[i].id, stuffs[i].name, stuffs[i].price, stuffs[i].price*0.8, stuffs[i].amoung, stuffs[i].desc); printf("\n"); printf(" d=================================================================================( ̄▽ ̄*)b\n"); } else if (a == '2') { SetPosition(0, 8); printf("裝備(武道)-->\n"); printf("ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=(~ ̄▽ ̄)~\n"); printf("\n"); //int len; int i = 0; //len = sizeof(stuffs) / sizeof(Stuff); printf("編號\t商品名稱\t單價\t\tVIP價格\t\t數量\t物品描述\n"); for (i = 7; i < 16; i++) printf("%d\t%-12s %-10.1f\t%-10.1f\t%d\t%s\n", stuffs[i].id, stuffs[i].name, stuffs[i].price, stuffs[i].price*0.8, stuffs[i].amoung, stuffs[i].desc); printf("\n"); printf(" d=================================================================================( ̄▽ ̄*)b\n"); } else if (a == '3') { SetPosition(0, 8); printf("功法(武道)-->\n"); printf("ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=(~ ̄▽ ̄)~\n"); printf("\n"); //int len; int i = 0; //len = sizeof(stuffs) / sizeof(Stuff); printf("編號\t商品名稱\t單價\t\tVIP價格\t\t數量\t物品描述\n"); for (i = 16; i < 25; i++) printf("%d\t%-12s %-10.1f\t%-10.1f\t%d\t%s\n", stuffs[i].id, stuffs[i].name, stuffs[i].price, stuffs[i].price*0.8, stuffs[i].amoung, stuffs[i].desc); printf("\n"); printf(" d=================================================================================( ̄▽ ̄*)b\n"); } else if (a == '4') { SetPosition(0, 8); printf("物品(武道)-->\n"); printf("ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=(~ ̄▽ ̄)~\n"); printf("\n"); //int len; int i = 0; //len = sizeof(stuffs) / sizeof(Stuff); printf("編號\t商品名稱\t單價\t\tVIP價格\t\t數量\t物品描述\n"); for (i = 25; i < 34; i++) printf("%d\t%-12s %-10.1f\t%-10.1f\t%d\t%s\n", stuffs[i].id, stuffs[i].name, stuffs[i].price, stuffs[i].price*0.8, stuffs[i].amoung, stuffs[i].desc); printf("\n"); printf(" d=================================================================================( ̄▽ ̄*)b\n"); } else if (a == '5') { SetPosition(0, 8); printf("裝備(仙道)-->\n"); printf("ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=(~ ̄▽ ̄)~\n"); printf("\n"); //int len; int i = 0; //len = sizeof(stuffs) / sizeof(Stuff); printf("編號\t商品名稱\t單價\t\tVIP價格\t\t數量\t物品描述\n"); /* for (i = 42; i < 50; i++) printf("%d\t%-12s %-10.1f\t%-10.1f\t%d\t%s\n", stuffs[i].id, stuffs[i].name, stuffs[i].price, stuffs[i].price*0.8, stuffs[i].amoung, stuffs[i].desc); printf("\n"); printf(" d=================================================================================( ̄▽ ̄*)b\n");*/ printf("抱歉,當前欄位暫無商品!"); } else if (a == '6') { SetPosition(0, 8); printf("功法(仙道)-->\n"); printf("ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=(~ ̄▽ ̄)~\n"); printf("\n"); //int len; int i = 0; //len = sizeof(stuffs) / sizeof(Stuff); printf("編號\t商品名稱\t單價\t\tVIP價格\t\t數量\t物品描述\n"); /* for (i = 42; i < 50; i++) printf("%d\t%-12s %-10.1f\t%-10.1f\t%d\t%s\n", stuffs[i].id, stuffs[i].name, stuffs[i].price, stuffs[i].price*0.8, stuffs[i].amoung, stuffs[i].desc); printf("\n"); printf(" d=================================================================================( ̄▽ ̄*)b\n");*/ printf("抱歉,當前欄位暫無商品!"); } else if (a == '7') { SetPosition(0, 8); printf("物品(仙道)-->\n"); printf("ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=(~ ̄▽ ̄)~\n"); printf("\n"); //int len; int i = 0; //len = sizeof(stuffs) / sizeof(Stuff); printf("編號\t商品名稱\t單價\t\tVIP價格\t\t數量\t物品描述\n"); /* for (i = 42; i < 50; i++) printf("%d\t%-12s %-10.1f\t%-10.1f\t%d\t%s\n", stuffs[i].id, stuffs[i].name, stuffs[i].price, stuffs[i].price*0.8, stuffs[i].amoung, stuffs[i].desc); printf("\n"); printf(" d=================================================================================( ̄▽ ̄*)b\n");*/ printf("抱歉,當前欄位暫無商品!"); } else if (a == '8') { SetPosition(0, 8); printf("天地造化-->\n"); printf("ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=ε=(~ ̄▽ ̄)~\n"); printf("\n"); //int len; int i = 0; //len = sizeof(stuffs) / sizeof(Stuff); printf("編號\t商品名稱\t單價\t\tVIP價格\t\t數量\t物品描述\n"); for (i = 34; i < 43; i++) printf("%d\t%-12s %-10.1f\t%-10.1f\t%d\t%s\n", stuffs[i].id, stuffs[i].name, stuffs[i].price, stuffs[i].price*0.8, stuffs[i].amoung, stuffs[i].desc); printf("\n"); printf(" d=================================================================================( ̄▽ ̄*)b\n"); } } /*else { printf("按任意鍵返回大廳"); break; getch(); }*/ } while (1); } void Ltrade(Player *player, int tradeid) { int i; //printf("請輸入要購買的商品編號:"); //scanf("%d",&choice); Stuff *tradestuff=NULL; //購買商品的指針 for (i = 0; i < Stufflen; i++) //商品數組中遍歷選擇的那個編號 { if (stuffs[i].id == tradeid) { // printf("%d", Stufflen); tradestuff = stuffs + i;//tradestuff=&stuffs[i]; break; } } //知足交易條件後,執行交易操做; if (tradestuff->amoung = 0) { printf("商品庫存不足,下次早點來哦!/(ㄒoㄒ)/~~"); getch(); Uopenstore(); } if (player->glod <= tradestuff->price) { printf("您的金幣不足,要賺夠了錢再來找我喲!(ง •_•)ง"); getch(); Uopenstore(); } if (player->bag.sum >= player->bag.summax) { printf("您的金幣不足,要賺夠了錢再來找我喲!(ง •_•)ง"); getch(); Uopenstore(); } //購買成功 //1.商城庫存-1 tradestuff->amoung--; //2.玩家的金錢-商品單價 player->glod -= tradestuff->price; //3.玩家的揹包增長物品 for (i = 0; i < player->bag.sum; i++) { //經過玩家揹包中物品的id來判斷是否擁有 if (tradestuff->id == player->bag.item[i].id) //3.1 判斷玩家揹包中是否已有該商品 { player->bag.item[i].amoung++; //3.2 若是有,該商品的數量+1 player->bag.sum++; break; } } if (i == player->bag.sum) //3.3 若是沒有,就向背包裏添加該商品 { int newindex = player->bag.sum; player->bag.item[newindex].id = tradestuff->id; player->bag.item[newindex].price = tradestuff->price; player->bag.item[newindex].amoung = 1; strcpy(player->bag.item[newindex].name,tradestuff->name); strcpy(player->bag.item[newindex].desc, tradestuff->desc); //player->bag.specount= tradestuff->id+1; player->bag.sum++; player->bag.specount++; player->bag.item[newindex].type = tradestuff->type; switch (players[loginid].bag.item[newindex].type) //此地有BUG { case Weapon: player->bag.item->maxattack=tradestuff->maxattack; break; case Armor: player->bag.item->maxdefence=tradestuff->maxdefence; break; case Mean: player->bag.item->maxattack= tradestuff->maxattack; break; case con: player->bag.item->maxpower += tradestuff->maxpower; break; } } printf("購買成功!<( ̄︶ ̄)↗[GO!]\n"); printf("按任意鍵返回商城\n"); getch(); } void Exit() { printf("\n"); printf(" "); printf("正在退出系統!"); for (int i = 0; i < 3; i++) { printf("."); Sleep(500); } exit(0); } void Lshowbag(Player *players) //打開揹包 { int i=0; char spec[20]=" "; //道具類型 int choice=-1; system("cls"); printf("\n"); SetPosition(PAGE_TITLE_X,PAGE_TITLE_Y); printf("仙域天尊-個人揹包\n"); printf("\n"); SetPosition(PAGE_TITLE_X+7, MAP_START_Y); printf("當前用戶爲:%s(%s)| 金幣:%d | 點券:%d |\n", players[loginid].name, players[loginid].iden, players[loginid].glod, players[loginid].wealth); printf("\n"); printf("\n"); // printf("%d\n", players[loginid].bag.summax); SetPosition(MARGIN_X-10, 6); printf("編號\t 物品名稱\t擁有數量\t物品類型\t物品描述\n"); SetPosition(MARGIN_X-10, 7); printf(SEP); if (players[loginid].bag.sum == 0) { SetPosition(MARGIN_X - 10, 7); printf(SEP); SetPosition(MARGIN_XX, 8); printf("當前揹包暫無物品"); SetPosition(MARGIN_X - 10, 9); printf(SEP); SetPosition(MARGIN_X - 10, 10); printf("按任意鍵返回大廳."); getch(); return; } for ( i = 0; i <players[loginid].bag.specount;i++) { switch (players[loginid].bag.item[i].type) //此地有BUG { case Weapon: strcpy(spec, "武器"); break; case Armor: strcpy(spec, "防具"); break; case Mean: strcpy(spec, "功法"); break; case con: strcpy(spec, "消耗品"); break; } SetPosition(MARGIN_X-10, 8+i); printf("%d\t %-12s %d\t\t%s \t%s\n", players[loginid].bag.item[i].id, players[loginid].bag.item[i].name, players[loginid].bag.item[i].amoung,spec, players[loginid].bag.item[i].desc); } SetPosition(MARGIN_X - 10, 7 + i ); printf(SEP); do //裝備武器防具或功法,使用道具等。 { if (choice == 888) { break; } SetPosition(MARGIN_X, 12 + i); printf("請選擇須要使用的裝備的編號(按888退出):"); scanf("%d",&choice); for (i = 0; i < players[loginid].bag.specount; i++) { if (players[loginid].bag.item[i].id == choice) { int actualattack = players[loginid].bag.item[i].maxattack; int actualdefence = players[loginid].bag.item[i].maxdefence; /* switch (players[loginid].bag.item[i].type) { case Weapon:strcpy(players[loginid].weapon, players[loginid].bag.item[i].name); players[loginid].weaponattack = actualattack; break; case Armor:strcpy(players[loginid].armor, players[loginid].bag.item[i].name); players[loginid].armordefence = actualdefence; break; case Mean:strcpy(players[loginid].mean, players[loginid].bag.item[i].name); players[loginid].meanattack = players[loginid].bag.item[i].maxattack; break; case con:players[loginid].hp = players[loginid].bag.item[i].maxpower; break; }*/ if (players[loginid].bag.item[i].type == Weapon) { strcpy(players[loginid].weapon, players[loginid].bag.item[i].name); players[loginid].weaponindex = choice; } else if (players[loginid].bag.item[i].type == Armor) { strcpy(players[loginid].armor, players[loginid].bag.item[i].name); players[loginid].armorindex = choice; } else if (players[loginid].bag.item[i].type == con) { players[loginid].hp = players[loginid].bag.item[i].maxpower; } else if (players[loginid].bag.item[i].type == Mean) { strcpy(players[loginid].mean , players[loginid].bag.item[i].name); players[loginid].meanindex = choice; } SetPosition(MARGIN_X , 13+i); printf("使用成功!"); break; } else { SetPosition(MARGIN_X, 15 + i); printf("當前揹包暫無此裝備,請到商城購買!"); } } } while (1); getch(); } void showinformation(Player *players) //打開我的信息 { Lrefrush(players); system("cls"); printf("\n"); SetPosition(PAGE_TITLE_X, PAGE_TITLE_Y); printf("仙域天尊-我的信息\n"); printf("\n"); printf("\t\t\t\t\t\t\t\t|當前用戶爲:%s(%s)| 金幣:%d | 點券:%d |\n", players[loginid].name, players[loginid].iden, players[loginid].glod, players[loginid].wealth); printf("\n"); Lrefrush(players); players[loginid].defence = players[loginid].attack; SetPosition(MARGIN_X,7); printf("血量:%d\t\t攻擊力:%d\t\t防護力:%d\t\t真元:∞(嫌麻煩我去掉了藍條)", players[loginid].hp, players[loginid].attack + stuffs[players[loginid].weaponindex].maxattack + stuffs[players[loginid].meanindex].maxattack, players[loginid].defence+ stuffs[players[loginid].armorindex].maxdefence); SetPosition(MARGIN_X, 9); printf("等級:%d<%s>\t\t經驗值:%d(距離升級還差%d經驗)", players[loginid].level, players[loginid].achieve, players[loginid].exp, players[loginid].nextexp- players[loginid].exp); SetPosition(MARGIN_X, 11); printf("所裝備的武器:%s\t\t所裝備的防具:%s\t\t所修功法:%s\t\t", players[loginid].weapon, players[loginid].armor, players[loginid].mean); SetPosition(45, 15); printf("Tps:玩家前五級會有新手保護,HP很高,請在在那以後就靠大家本身了!"); getch(); } void Lshowmap(Player *players) //打開地圖 { char key ; int i, j; system("cls"); printf("\n"); SetPosition(PAGE_TITLE_X, PAGE_TITLE_Y-1); printf("仙域天尊-地圖一-聖武大陸\n"); while (1) { SetPosition(MARGIN_10, MAP_START_Y - 2); printf("%s", SEP); for (i = 0; i < 5; i++) { // printf("\t | "); SetPosition(MARGIN_10, 3 + i); printf("| "); for (j = 0; j < 8; j++) { if (i == Y && j == X) //若是當前地圖的索引跟玩家所在的位置同樣(通俗點就是玩家來到某個地圖) { SetColor(5,15); //就改變當前地圖的前景色,背景色(這個地圖的顏色就變了,讓人知道玩家在哪一個地圖) } printf("%-12s", mapArray[i][j].name); SetColor(1, 7); //玩家離開後,將顏色改回以前的顏色(不流痕跡!) } printf(" |"); printf("\n"); } printf("\n"); SetPosition(PAGE_TITLE_X, 9); printf(" -地圖二-仙道世界\n"); printf("\n"); for (i = 5; i < 8; i++) { // printf("\t | "); SetPosition(MARGIN_10, 11 + i - 5); printf("| "); for (j = 0; j < 8; j++) { if (i == Y && j == X) { SetColor(5 , 15); } printf("%-12s", mapArray[i][j].name); SetColor(1, 7); } printf(" |"); printf("\n"); } SetPosition(MARGIN_10, MAP_END_Y - 2); printf("%s\n", SEP); LshowInformation(); //打印信息顯示區 LshowMapInfor(Y,X); //打印當前地圖信息 SetPosition(PAGE_TITLE_X * 2 - 8, SUP_NAME_Y - 1); printf("Tip:按ENTER鍵進入地圖"); SetPosition(PAGE_TITLE_X * 2 - 8, SUP_NAME_Y); printf("Tip:按ESC鍵退出地圖,回到大廳"); Lrefrush(players); SetPosition(MARGIN_10, SUP_NAME_Y); printf("【%s】-%s", players[loginid].name, players[loginid].iden); SetPosition(MARGIN_10, SUP_NAME_Y + 1); printf("LV.%d[%s]", players[loginid].level, players[loginid].achieve); SetPosition(MARGIN_10, SUP_EXE_Y); printf(" "); SetPosition(MARGIN_10, SUP_EXE_Y); printf("經驗值: %d/%d", players[loginid].exp, players[loginid].nextexp); printf("\t\tHP:%d", players[loginid].hp); printf("\t\tAttack:%d", players[loginid].attack + stuffs[players[loginid].weaponindex].maxattack + stuffs[players[loginid].meanindex].maxattack); printf("\t\tDefence:%d", players[loginid].defence + stuffs[players[loginid].armorindex].maxdefence); //SetPosition(11,3); fflush(stdin); key=getch(); fflush(stdin); if (key == 38 || key == 72)//上鍵 { Y--; } if (key == 37 || key == 75)//左鍵 { X--; } if (key == 39 || key == 77)//右鍵 { X++; } if (key == 40 || key == 80)//下鍵 { Y++; } if (key == 13 || key == 108)//ENTER鍵 { Lshowmonster(players); } if (key == 27)//ESC鍵 { break; } if (X > 7) X = 0; if (X < 0) X = 7; if (Y > 7)Y = 0; if (Y < 0) Y = 7; // SetPosition(X,Y); } getch(); } void LshowInformation() //打印信息顯示區 { // SetPosition(MARGIN_10, INFOR_START_Y); int i; for (i = 0; i < 8; i++) { SetPosition(MARGIN_10, INFOR_START_Y+i); printf("|"); SetPosition(MARGIN_10+99, INFOR_START_Y+i); printf("|"); } SetPosition(MARGIN_10, INFOR_END_Y); printf(SEP); } void Lrefrush(Player *players) //刷新玩家的各類屬性 { if (players[loginid].exp >= 10 ) { players[loginid].level =2; } if (players[loginid].exp >= 100 ) { players[loginid].level = 3; } if (players[loginid].exp >= 1000 ) { players[loginid].level = 4; } if (players[loginid].exp >= 2000 ) { players[loginid].level = 5; } if (players[loginid].exp >= 3000 ) { players[loginid].level = 6; } if (players[loginid].exp >= 500) { players[loginid].level = 7; } if (players[loginid].exp >= 7000 ) { players[loginid].level = 8; } if (players[loginid].exp >= 10000 ) { players[loginid].level = 9; } if (players[loginid].exp >= 15000) { players[loginid].level = 10; } if (players[loginid].exp >= 30000 ) { players[loginid].level =11; } if (players[loginid].exp >= 50000 ) { players[loginid].level = 12; } if (players[loginid].exp >= 100000) { players[loginid].level = 13; } if (players[loginid].exp >= 200000 ) { players[loginid].level = 14; } if (players[loginid].exp >= 350000 ) { players[loginid].level = 15; } if (players[loginid].exp >= 500000) { players[loginid].level = 16; } if (players[loginid].exp >= 1000000 ) { players[loginid].level = 17; } if (players[loginid].exp >= 1800000 ) { players[loginid].level = 18; } if (players[loginid].exp >= 2000000 ) { players[loginid].level = 19; } if (players[loginid].exp >= 5000000) { players[loginid].level = 20; } if (players[loginid].exp >= 7000000 ) { players[loginid].level = 21; } if (players[loginid].exp >= 10000000 ) { players[loginid].level = 22; } if (players[loginid].exp >= 16000000 ) { players[loginid].level = 23; } if (players[loginid].exp >= 50000000 ) { players[loginid].level = 24; } if (players[loginid].exp >= 99999999 ) { players[loginid].level = 25; } switch (players[loginid].level) { case 1:strcpy(players[loginid].achieve, "武道一重天"); players[loginid].nextexp = 10; players[loginid].hp = 1000; players[loginid].attack = 100; players[loginid].defence= 100; break; case 2:strcpy(players[loginid].achieve, "武道二重天"); players[loginid].nextexp = 100; players[loginid].hp = 2000; players[loginid].attack = 200; players[loginid].defence = 200; break; case 3:strcpy(players[loginid].achieve, "武道三重天"); players[loginid].nextexp = 1000; players[loginid].hp = 3000; players[loginid].attack = 300; players[loginid].defence= 300; break; case 4:strcpy(players[loginid].achieve, "武道四重天"); players[loginid].nextexp = 2000; players[loginid].hp = 3000; players[loginid].attack = 400; players[loginid].defence= 400; break; case 5:strcpy(players[loginid].achieve, "武道五重天"); players[loginid].nextexp = 3000; players[loginid].hp = 3000; players[loginid].attack = 500; players[loginid].defence; break; case 6:strcpy(players[loginid].achieve, "武道六重天"); players[loginid].nextexp = 5000; players[loginid].hp = 500; players[loginid].attack = 600; players[loginid].defence= 600; break; case 7:strcpy(players[loginid].achieve, "武道七重天"); players[loginid].nextexp = 7000; players[loginid].hp = 500; players[loginid].attack = 700; players[loginid].defence = 700; break; case 8:strcpy(players[loginid].achieve, "武道八重天"); players[loginid].nextexp = 10000; players[loginid].hp = 500; players[loginid].attack = 1000; players[loginid].defence = 1000; break; case 9:strcpy(players[loginid].achieve, "武道九重天"); players[loginid].nextexp = 15000; players[loginid].hp = 500; players[loginid].attack = 1500; players[loginid].defence = 1500; break; case 10:strcpy(players[loginid].achieve, "武道通神"); players[loginid].nextexp = 30000; players[loginid].hp = 1000; players[loginid].attack = 1600; players[loginid].defence = 1600; break; case 11:strcpy(players[loginid].achieve, "武道神話"); players[loginid].nextexp = 50000; players[loginid].hp = 5000; players[loginid].attack = 2000; players[loginid].defence = 2000; break; case 12:strcpy(players[loginid].achieve, "道胎境"); players[loginid].nextexp = 100000; players[loginid].hp = 10000; players[loginid].attack = 2100; players[loginid].defence = 2100; break; case 13:strcpy(players[loginid].achieve, "一陽境"); players[loginid].nextexp = 200000; players[loginid].hp = 10000; players[loginid].attack = 2200; players[loginid].defence = 2200; break; case 14:strcpy(players[loginid].achieve, "凝神境"); players[loginid].nextexp = 350000; players[loginid].hp = 10000; players[loginid].attack = 3000; players[loginid].defence = 3000; break; case 15:strcpy(players[loginid].achieve, "靈泉境"); players[loginid].nextexp = 500000; players[loginid].hp = 10000; players[loginid].attack = 4000; players[loginid].defence = 4000; break; case 16:strcpy(players[loginid].achieve, "化虛境"); players[loginid].nextexp = 1000000; players[loginid].hp = 10000; players[loginid].attack = 5000; players[loginid].defence = 5000; break; case 17:strcpy(players[loginid].achieve, "五龍境"); players[loginid].nextexp = 1800000; players[loginid].hp = 10000; players[loginid].attack = 6000; players[loginid].defence = 6000; break; case 18:strcpy(players[loginid].achieve, "準聖境"); players[loginid].nextexp = 2000000; players[loginid].hp = 50000; players[loginid].attack = 8000; players[loginid].defence = 8000; break; case 19:strcpy(players[loginid].achieve, "聖人境"); players[loginid].nextexp = 5000000; players[loginid].hp = 50000; players[loginid].attack = 10000; players[loginid].defence = 10000; break; case 20:strcpy(players[loginid].achieve, "聖王境"); players[loginid].nextexp = 7000000; players[loginid].hp = 50000; players[loginid].attack = 30000; players[loginid].defence = 30000; break; case 21:strcpy(players[loginid].achieve, "僞仙境"); players[loginid].nextexp = 10000000; players[loginid].hp = 50000; players[loginid].attack = 50000; players[loginid].defence = 50000; break; case 22:strcpy(players[loginid].achieve, "真仙境"); players[loginid].nextexp = 16000000; players[loginid].hp = 50000; players[loginid].attack = 80000; players[loginid].defence = 80000; break; case 23:strcpy(players[loginid].achieve, "戰仙境"); players[loginid].nextexp = 50000000; players[loginid].hp = 100000; players[loginid].attack = 100000; players[loginid].defence = 100000; break; case 24:strcpy(players[loginid].achieve, "天尊境"); players[loginid].nextexp = 99999999; players[loginid].hp = 500000; players[loginid].attack = 5000000; players[loginid].defence = 500000; break; case 25:strcpy(players[loginid].achieve, "主宰境"); players[loginid].nextexp = 999999999; players[loginid].hp = 9999999; players[loginid].attack = 99999999; players[loginid].defence = 99999999; break; } } void LshowMapInfor(int x,int y) //在顯示區顯示地圖的信息 { ClearInfor(); SetPosition(PAGE_TITLE_X,INFOR_START_Y); printf("當前玩家所在地圖 【%s】",mapArray[x][y].name); SetPosition(MARGIN_X, INFOR_START_Y+1); char *desc=mapArray[x][y].desc; int desclen = strlen(desc); int i, j; for (i = 0; i < desclen; i++) { if (i != 0 && i % 76 == 0) { SetPosition(MARGIN_X -4, INFOR_START_Y + 1+i/76); } printf("%c",desc[i]); } } void Lshowmonster(Player *players) //顯示當前地圖上的怪物 { ClearInfor(); int monstercount = sizeof(monsters)/sizeof(Monster)+1; //整個遊戲的怪物數組的怪物數量 int currmonsterindex[12]; //當前地圖的怪物下標 int currmonstercount = 0; //當前地圖的怪物數量 int i; for (i = 0; i < monstercount; i++) { if (monsters[i].coord.X == X && monsters[i].coord.Y == Y && monsters[i].state != 0) //暫時未作斷定怪物死亡的代碼 currmonsterindex[currmonstercount++] = i; if (currmonstercount == 9) { break; } } //打印怪物 SetPosition(PAGE_TITLE_X, INFOR_START_Y); if (players[loginid].level < mapArray[Y][X].minlevel) { printf("您當前等級不足,此地圖還沒有開放!"); SetPosition(PAGE_TITLE_X, INFOR_START_Y+1); printf("當前地圖開放等級爲:Lv.%d", mapArray[Y][X].minlevel); } else if (currmonstercount == 0) { SetPosition(PAGE_TITLE_X, INFOR_START_Y); printf("當前地圖什麼都沒有!"); } else { printf("在當前地圖發現了:"); SetPosition(MARGIN_10 + 3, INFOR_START_Y + 1); for (i = 0; i < currmonstercount; i++) { if (i !=0 && i%3==0) { SetPosition(MARGIN_10 + 3, INFOR_START_Y + 1 + i / 3); } printf("%2d.Lv%-2d %-10s[%-10s] ",monsters[currmonsterindex[i]].id, monsters[currmonsterindex[i]].level, monsters[currmonsterindex[i]].name, monsters[currmonsterindex[i]].achieve); if (i == 12) break; } do { SetPosition(MARGIN_10 + 6, INFOR_START_Y + 6); printf(CLS); SetPosition(MARGIN_10 + 6, INFOR_START_Y + 7); printf(CLS); SetPosition(MARGIN_10 + 6, INFOR_START_Y + 6); printf("請選擇要挑戰的對象(按0返回):"); int pkmonsterid = -1; scanf("%d", &pkmonsterid); if (pkmonsterid == 0) { break; } // SetPosition(MARGIN_10 + 46, INFOR_START_Y + 7); //printf("要挑戰的編號爲:%d",pkmonsterid); // printf("%d", monstercount); LCombat(pkmonsterid,players); SetPosition(MARGIN_10 + 75, INFOR_START_Y + 7); printf("按任意鍵繼續挑戰."); getch(); } while (1); getch(); } getch(); } void LCombat(int monsterid, Player *players) //核心:打怪啦 { int Attack = players[loginid].attack + stuffs[players[loginid].weaponindex].maxattack + stuffs[players[loginid].meanindex].maxattack; //攻擊力=基礎攻擊力+武器攻擊力+功法加成 int Defence = players[loginid].defence + stuffs[players[loginid].armorindex].maxdefence; int Exper= players[loginid].exp; int Level= players[loginid].level; int combatcount = 0; Player currplayer = players[loginid]; int monsterindex = -1; int i; for (i = 0; i <= monstercount; i++) { if (monsters[i].id == monsterid ) //&& monsters[monsterid].coord.X==X && monsters[monsterid].coord.Y==Y //加上此句會有一些怪物顯示,挑戰不了的問題,已懶得解決 { monsterindex = i; break; } // printf("%d", monsters[monsterindex].defence); //getch(); } if (monsterindex == -1) { SetPosition(MARGIN_10 + 6, INFOR_START_Y + 7); printf("當前地圖不存在要此怪物,按任意鍵繼續!"); return; } while (1) { srand(time(NULL)); monsters[monsterindex].hp -= Attack-monsters[monsterindex].defence/2; //過程 currplayer.hp -= monsters[monsterindex].attack-currplayer.defence/2; combatcount++; SetPosition(MARGIN_10 + 6, INFOR_START_Y + 7); printf(CLS); SetPosition(MARGIN_10 + 6, INFOR_START_Y + 7); printf("當前戰鬥第%2d回合, %s:%dHP %s:%dHP", combatcount, currplayer.name, currplayer.hp, monsters[monsterindex].name, monsters[monsterindex].hp); Sleep(1000); SetPosition(PAGE_TITLE_X * 2 - 8, SUP_NAME_Y - 1); printf("Tip:按ENTER鍵進入地圖"); SetPosition(PAGE_TITLE_X * 2 - 8, SUP_NAME_Y); printf("Tip:按ESC鍵退出地圖,回到大廳"); Lrefrush(players); SetPosition(MARGIN_10, SUP_NAME_Y); printf("【%s】-%s", players[loginid].name, players[loginid].iden); SetPosition(MARGIN_10, SUP_NAME_Y + 1); printf("LV.%d[%s]", currplayer.level, players[loginid].achieve); SetPosition(MARGIN_10, SUP_EXE_Y); printf(" "); SetPosition(MARGIN_10, SUP_EXE_Y); printf("經驗值: %d/%d", currplayer.exp, players[loginid].nextexp); printf("\t\tHP:%d", currplayer.hp); printf("\t\tAttack:%d",Attack); printf("\t\tDefence:%d", Defence); if (monsters[monsterindex].hp <= 0) { break; } if (currplayer.hp <= 0) { break; } } if (currplayer.hp <= 0) { SetPosition(MARGIN_10 + 6, INFOR_START_Y + 7); printf(CLS); SetPosition(MARGIN_10 + 6, INFOR_START_Y + 7); printf("失敗,在與%s[%s]的戰鬥中死亡!", monsters[monsterindex].name, monsters[monsterindex].achieve); currplayer.hp = 1; return; } int actualgold = (rand() % (monsters[monsterindex].maxmoney - monsters[monsterindex].minmoney)) + monsters[monsterindex].minmoney; SetPosition(MARGIN_10 + 6, INFOR_START_Y + 7); printf(CLS); SetPosition(MARGIN_10 + 6, INFOR_START_Y + 7); printf("通過艱苦的戰鬥,您擊敗了%s!得到了%d點經驗,%d金幣", monsters[monsterindex].name,monsters[monsterindex].exp, actualgold); Exper += monsters[monsterid].exp; currplayer.glod += actualgold; Lrefrush(players); SetPosition(PAGE_TITLE_X * 2 - 8, SUP_NAME_Y - 1); printf("Tip:按ENTER鍵進入地圖"); SetPosition(PAGE_TITLE_X * 2 - 8, SUP_NAME_Y); printf("Tip:按ESC鍵退出地圖,回到大廳"); players[loginid].exp= Exper; players[loginid].level= Level; Lrefrush(players); SetPosition(MARGIN_10, SUP_NAME_Y); printf("【%s】-%s", players[loginid].name, players[loginid].iden); SetPosition(MARGIN_10, SUP_NAME_Y + 1); printf("LV.%d[%s]", currplayer.level, players[loginid].achieve); SetPosition(MARGIN_10, SUP_EXE_Y); printf(" "); SetPosition(MARGIN_10, SUP_EXE_Y); printf("經驗值: %d/%d", currplayer.exp, players[loginid].nextexp); printf("\t\tHP:%d", currplayer.hp); printf("\t\tAttack:%d", Attack); printf("\t\tDefence:%d", Defence); } /*******************************************遊戲庫函數********************************************************/ /* 0-黑色, 1-藍色, 2-綠色, 3-淺綠色, 4-紅色, 5-紫色, 6-黃色, 7-白色 8-灰色, 9-淺藍色, 10-淺綠色, 11-淡淺綠色, 12-淡紅色, 13-淡紫色, 14-淡黃色, 15-亮白色 */ void init() //初始化遊戲設置,也就是包含如下函數設置 { SetTitle("仙域天尊之縱橫聖武 1.0 — C語言測試版(Fairy domain Buddha 1.0 -The C language BETA)"); SetColor(1,7); } void SetTitle(char *title) //設置遊戲窗標題 { SetConsoleTitle(title); //windows.h 內設置窗口標題的函數 } void SetColor(int foreColor, int backColor)//設置遊戲的前景色,背景色 { HANDLE winhandle; //handle把手的意思 winhandle=GetStdHandle(STD_OUTPUT_HANDLE); //拿到控制檯窗口 //設置文字顏色 SetConsoleTextAttribute(winhandle,foreColor+backColor * 0x10); } void SetPosition(int x, int y) //設置光標的座標(位置) { HANDLE winhandle; //handle把手的意思 COORD pos = { x,y }; winhandle = GetStdHandle(STD_OUTPUT_HANDLE); //拿到控制檯窗口 SetConsoleCursorPosition(winhandle,pos); //參數一:須要設置的對象 //參數二:座標 } void ClearInfor() //清除信息顯示區的消息 { int i, j; for (i = 0; i < 8; i++) { for (j = 0; j < 98; j++) { SetPosition(MARGIN_10 + 1+j, INFOR_START_Y + i); printf(" "); } } } void Lclearmall() //商城清屏函數 { SetPosition(0, 11); int i; for (i = 0; i < 11; i++) { SetPosition(0, 11 + i); printf(" "); } }