DOS小遊戲(一.頭文件.h)

NND的。剛纔打得那麼幸苦。超過8W字竟然給我不能發佈。還清空了。。這。。。ios

簡直就吐血了windows

算了下。一共1174行代碼dom

效果圖;ide

 

 

 

好吧。。繼續。。。函數

程序已經打包見附件動畫

爲了方便一些人。我特意用2010- -從新生成了靜態庫的EXE文件,this

見附件spa

===================blog

頭文件get

=================

Blacksmith.h  鐵匠鋪

Character.h  角色屬性

Enemy.h       敵人屬性

Fighting.h    戰鬥控制

Select.h      主選擇界面

Wait.h       大腳丫動畫

========================================

 

  
  
  
  
  1. //Blacksmith.h  
  2. #ifndef ONE3  
  3. #include <iostream>   
  4. #include <windows.h>    
  5. #include"Select.h"  
  6.  
  7. using namespace std;  
  8.  
  9. class Blacksmith  
  10. {  
  11. public:  
  12.     static void display();  
  13.     friend void Select::display();//主選擇界面  
  14. private:  
  15. };  
  16.  
  17.  #define ONE3   
  18.  
  19. #endif ; 

 

  
  
  
  
  1. //Character.h  
  2. #ifndef ONE  
  3.  
  4.  
  5. #include <iostream>   
  6. #include <windows.h>    
  7. #include"Enemy.h"  
  8. #include"Blacksmith.h"  
  9. using namespace std;  
  10.  
  11. class Character  
  12. {  
  13. public:  
  14.  
  15.     static void display(string);  
  16.     static void show();  
  17.     static void view_properties();//查看屬性  
  18.     friend static void Enemy::set(string);//設置敵人屬性  
  19.     friend void Fighting::display(string);//戰鬥界面  
  20.     friend void Fighting::hurt(string p1);//傷害計算  
  21.     friend void Blacksmith::display();//武器強化界面  
  22.     friend void Select::display();//主選擇界面  
  23. private:  
  24.     /*=========常類=============*/ 
  25.     static int money;//錢  
  26.     static string name;//名字  
  27.     static int exp_max;//經驗上限   
  28.     static int exp_min;//經驗下限  
  29.     static int lv;//等級  
  30.     /*=========屬性類=============*/ 
  31.     static int life_max;//    生命上限  
  32.     static int life_min;//        下限  
  33.     static int magic_max;//   魔力上限  
  34.     static int magic_min;//       下限  
  35.     static double b_attack;//    基本***力  
  36.     static double attack;//   ***力=基本***力+武器***+武器屬性前綴提高  
  37.     static double b_defense;//   基本防護力  
  38.     static double defense;//   防護=基本防護+衣服防護  
  39.     /*=======裝備類==============*/ 
  40.     static string b_weapons_name; //身上武器名字  
  41.     static int b_weapons;//身上武器屬性  
  42.     static string b_prefix_name;//身上武器前綴名字  
  43.     static int b_prefix;//身上武器前綴屬性  
  44.     static string b_clothes_name;     //身上衣服名字  
  45.     static int    b_clothes;          //身上衣服屬性  
  46.  
  47.     /*=========庫類===========*/ 
  48.     static string weapons_name[5];//武器名字  
  49.     static int weapons[5];//        武器屬性  
  50.     static string clothes_name;//衣服名字  
  51.     static int clothes;//        衣服屬性  
  52.     static string prefix_name[4];//      屬性前綴名字  
  53.     static int prefix[4];//         屬性前綴    
  54.       
  55.  
  56.     };  
  57.  
  58.  #define ONE   
  59.  
  60. #endif ; 

 

 

 

 

  
  
  
  
  1. //Enemy.h  
  2. #ifndef ONE1  
  3. #include <iostream>   
  4.    
  5. #include<string>  
  6. #include"Fighting.h"  
  7.  
  8. using namespace std;  
  9. class Enemy  
  10. {  
  11. public:  
  12.     static void set(string);//設置敵人屬性  
  13.     static void display(string );//輸出敵人屬性  
  14.     friend void Fighting::display(string);//戰鬥界面  
  15.     friend void Fighting::hurt(string );//傷害計算  
  16. private:  
  17.     static string e_name;  
  18.     static int e_hp;  
  19.     static int e_att;  
  20.     static int e_def;  
  21.     //====BOSS=====  
  22.     static string boss_name;  
  23.     static int boss_hp;  
  24.     static int boss_att;  
  25.     static int boss_def;  
  26. };  
  27.  
  28.  #define ONE1   
  29.  
  30. #endif ; 

 

 

  
  
  
  
  1. //Fighting.h  
  2. #ifndef ONE2  
  3. #include<iostream>  
  4. #include<string>  
  5. #include"Blacksmith.h"  
  6.  
  7.  
  8.  
  9. #include"Select.h"  
  10. using namespace std;  
  11.  
  12. class Fighting  
  13. {  
  14. public:  
  15.     static void d_speed(int,string);//對話顯示  
  16.     static int random(int a);//隨機函數  
  17.     static void display(string);//進入戰鬥界面  
  18.     static void hurt(string);//傷害計算  
  19.     friend void Blacksmith::display();//武器強化界面  
  20.     friend void Select::display();//主選擇界面  
  21. private:  
  22.     static char role[3][50];//人物對話  
  23.     static char e_role[3][50];//怪物對話  
  24.     static char b_role[3][50];//BOSS對話  
  25.     static string mode;//戰鬥模式  
  26. };  
  27.  #define ONE2   
  28.  
  29. #endif ; 

 

 

 

  
  
  
  
  1. //Select.h  
  2. #ifndef ONE4  
  3. #include<iostream>  
  4. //#include"Fighting.h"  
  5. using namespace std;  
  6.  
  7. class Select //選擇界面  
  8. {  
  9. public:  
  10.     static void display();  
  11.     //friend void Fighting::display(string p);  
  12. };  
  13.  #define ONE4  
  14.  
  15. #endif ; 

 

 

 

  
  
  
  
  1. //Wait.h  
  2. #include <iostream>   
  3. #include <windows.h>    
  4. #include"Fighting.h"  
  5. #include"Blacksmith.h"  
  6. using namespace std;    
  7. class Wait  
  8. {  
  9. public:  
  10.     static void display(int time);  
  11.     friend void Fighting::display(string p);  
  12.     friend void Blacksmith::display();//武器強化界面  
  13.      private:  
  14.           
  15. };