文字游戏(超无聊)

  1 #include<bits/stdc++.h>
  2 using namespace std;
  3 int boss=1000,money,HP=100,ATK=0;
  4 string s;
  5 void shop();
  6 void village();
  7 void buy();
  8 void buy_judge();
  9 void sell();
 10 void over();
 11 void war();
 12 void MONSTER();
 13 void victory();
 14 void victory()
 15 {
 16     cout<<"victory"<<endl;
 17     for(int i=1;i<=20;i++){
 18         cout<<endl;
 19     }
 20     return ;
 21 }
 22 void MONSTER()
 23 {
 24     cout<<"You meet the MONSTER!"<<endl;
 25     while(HP>0&&boss>0){
 26         cout<<"your HP:"<<HP<<"  boss HP:"<<boss<<endl;
 27         for(int i=1;i<=23;i++){
 28             cout<<endl;
 29         }
 30         system("pause");
 31         HP-=10;boss-=ATK;
 32     }
 33     if(boss<0) boss=0;
 34     cout<<"your HP:"<<HP<<"  boss HP:"<<boss<<endl;
 35     for(int i=1;i<=23;i++){
 36         cout<<endl;
 37     }
 38     system("pause");
 39     if(HP==0) over();
 40     else victory();
 41 }
 42 void war()
 43 {
 44     money+=100;
 45     cout<<"You meet a slime!"<<endl;
 46     for(int i=1;i<=23;i++){
 47         cout<<endl;
 48     }
 49     system("pause");
 50     cout<<"You killed a slime!"<<endl;
 51     for(int i=1;i<=23;i++){
 52         cout<<endl;
 53     }
 54     system("pause");
 55     cout<<"You get 100 money!        your money:"<<money<<endl;
 56     for(int i=1;i<=23;i++){
 57         cout<<endl;
 58     }
 59     system("pause");
 60     
 61     village();
 62 }
 63 void over()
 64 {
 65     cout<<"You dead";
 66     for(int i=1;i<=21;i++){
 67         cout<<endl;
 68     }
 69     return ;
 70 }
 71 void buy_judge(int need)
 72 {
 73     if(money>=need){
 74         money-=need;
 75         cout<<"Deal!"<<endl;
 76         ATK=need;
 77     }else{
 78         cout<<"You haven't enougth to buy this!"<<endl;
 79     }
 80     for(int i=1;i<=23;i++){
 81         cout<<endl;
 82     }
 83     system("pause");
 84     shop();
 85 }
 86 void buy()
 87 {
 88     cout<<"What do you want to buy?"<<endl;
 89     cout<<"input 1 :Wooden sword (cost 100)"<<endl;
 90     cout<<"input 2 :Stone sword (cost 200)"<<endl;
 91     cout<<"input 3 :Iron sword (cost 300)"<<endl;
 92     cout<<"input 4 :nothing"<<endl;
 93     for(int i=1;i<=19;i++){
 94         cout<<endl;
 95     }
 96     cin>>s;
 97     switch(s[0]){
 98         case '1':buy_judge(100);break;
 99         case '2':buy_judge(200);break;
100         case '3':buy_judge(300);break;
101         case '4':shop();break;
102     }
103 }
104 void sell()
105 {
106     cout<<"Sorry we have no money."<<endl;
107     for(int i=1;i<=23;i++){
108         cout<<endl;
109     }
110     system("pause");
111     shop();
112 }
113 void shop()
114 {
115     cout<<"You are in the shop now!        your money:"<<money<<endl;
116     cout<<"What do you want to do?"<<endl;
117     cout<<"input 1 :buy something"<<endl;
118     cout<<"input 2 :sell something"<<endl;
119     cout<<"input 3 :exit"<<endl;
120     for(int i=1;i<=19;i++){
121         cout<<endl;
122     }
123     cout<<"You want:";
124     cin>>s;
125     switch(s[0]){
126         case '1':buy();break;
127         case '2':sell();break;
128         case '3':village();break;
129         
130     }
131 }
132 void village()
133 {
134     cout<<"You are in the village now!        your money:"<<money<<endl;
135     cout<<"What do you want to do?            your ATK:"<<ATK<<endl;
136     cout<<"input 1 :kill yourself"<<endl;
137     cout<<"input 2 :go to the shop"<<endl;
138     cout<<"input 3 :adventure"<<endl;
139     cout<<"input 4 :KILL THE MONSTER"<<endl;
140     for(int i=1;i<=18;i++){
141         cout<<endl;
142     }
143     cout<<"You want:";
144     cin>>s;
145     switch(s[0]){
146         case '1':over();break;
147         case '2':shop();break;
148         case '3':war();break;
149         case '4':MONSTER();break;
150     }
151 }
152 int main()
153 {
154     village();
155     return 0;
156 }
View Code

不喜勿喷。。。

猜你喜欢

转载自www.cnblogs.com/ZRed/p/11865184.html
今日推荐