一、基本介绍
支持Dev-C++5.11版本(务必调为英文输入法),基本操作看游戏里的介绍,怎么做的......懒得说,能看懂就看注释,没有的自己猜,如果你很固执......私我吧
二、代码部分
cpp
#include<bits/stdc++.h>
#include<windows.h>
#include<unistd.h>
using namespace std;
void rules();
int main() {
int c=1;
int m=1;
long long m_x=1000;
long long m_xl=1000;
int g_a=250;
int g_d=200;
int coins=50;
int p_n=1;
int n=0;
int win=100;
int buy;
int d_n=0;
int p_a=75;
int p_na, jj_a, jj_d;
system("cls");
cout<<"请选择难度:"<<endl;
cout<<endl;
cout<<endl;
cout<<"A.初级难度"<<endl;
cout<<endl;
cout<<"B.中级难度"<<endl;
cout<<endl;
cout<<"C.地狱难度"<<endl;
cout<<"请输入:";
char x;
cin>>x;
if(x=='A'){
jj_a=100;
jj_d=60;
p_na=50;
}
else if(x=='B'){
jj_a=125;
jj_d=75;
p_na=55;
}
else if(x=='C'){
jj_a=175;
jj_d=125;
p_na=45;
}
while(win>=0) {
if(n<0){
n=0;
}
if(win<=0){
break;
}
m_xl-=n*g_a;
if(m_xl<=0) {
system("cls");
cout<<"您的门已经被噬梦者攻破,G A M E O V E R!"<<endl;
return 0;
}
system("cls");
cout<<"金币:"<<coins<<" 电力:"<<d_n<<" 炮台:"<<p_n<<"个 "<<"门的血量:"<<m_xl<<endl;
cout<<endl;
cout<<" 墙墙墙墙 墙墙墙墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙◎◎墙 墙◎◎墙"<<endl;
cout<<" 墙 墙 墙 墙"<<endl;
cout<<" 墙 墙 怪 墙 墙"<<endl;
cout<<" 墙 墙 "<<n<<"墙 墙"<<endl;
cout<<"墙墙墙墙 墙 门 墙 墙墙墙墙"<<endl;
cout<<"墙 ◎◎ ◎ 墙"<<endl;
cout<<"墙 ◎床◎ ☆☆☆墙"<<endl;
cout<<"墙 ☆★★墙"<<endl;
cout<<"墙 ☆★★墙"<<endl;
cout<<"墙墙墙墙墙墙墙墙墙墙墙墙墙墙墙墙"<<endl;
cout<<endl;
cout<<"您正在床上发育......"<<endl;
cout<<"有"<<n<<"只噬梦者在挠你的门!"<<endl;
cout<<"输入1以建造炮台:25金币"<<endl;
cout<<"输入2以升级门: 50金币"<<endl;
cout<<"输入3以升级床: 35金币"<<endl;
cout<<"输入4以放弃此次建造机会"<<endl;
cout<<"输入5以拆除1个炮台:获得15金币"<<endl;
cout<<"输入6以让门回血"<<endl;
cout<<"您的门的级位是"<<m<<"级"<<endl;
cout<<"您的床是"<<c<<"级"<<endl;
cout<<"◎:炮台"<<endl;
cout<<"☆:维修台"<<endl;
cout<<"★:发电机"<<endl;
n-=p_n*p_a/g_d;
win-=p_n*p_a/g_d;
cin>>buy;
switch(buy) {
case 1:
if(coins<25) {
cout<<"您的钱不够"<<endl;
break;
}
if(p_n==17){
cout<<"最大上限为17个炮台!"<<endl;
break;
}
coins-=25;
p_n++;
break;
case 2:
if(coins<50) {
cout<<"您的钱不够"<<endl;
break;
}
if(m==19){
cout<<"您的门已达到黄金门,不能够再次升级了!"<<endl;
system("pause");
break;
}
coins-=50;
m++;
m_x*=7;
m_xl=m_x;
break;
case 3:
if(coins<35) {
cout<<"您的钱不够"<<endl;
break;
}
coins-=35;
c++;
break;
case 4:
break;
case 5:
coins+=15;
p_n--;
case 6:
m_xl=m_x;
break;
default:
cout<<"没有此选项"<<endl;
break;
}
if(m_xl==0) {
system("cls");
cout<<"您的门已经被噬梦者攻破,G A M E O V E R!"<<endl;
return 0;
}
if(n==31) {
n--;
}
coins+=c*15;
sleep(2);
n++;
if(n==31) {
n--;
}
d_n+=4*10000;
}
cout<<"恭喜您打败了所有噬梦者,获得了胜利!"<<endl;
}
void rules() {
string o="您在野外建造了一间房屋,现在是晚上,有噬梦者来攻击您。如果您能打败所有(100个)噬梦者,您就胜利了!如果门被挠破,则输!";
for(int i=0; i<o.size(); i++) {
cout<<o[i];
Sleep(100);
}
cout<<endl;
cout<<endl;
system("pause");
}