剑·途 V1.3
//程序名:新的C++程序 //作者: #include<iostream> #include<fstream> #include<algorithm> #include<bits/stdc++.h> #include<windows.h> #define PN a[0].name #define PL a[0].level #define PK a[0].kill #define PF a[0].fy #define PS a[0].sudu #define PJ a[0].jineng #define PM a[0].money #define PZ a[0].zhuangbei #define PB a[0].blood #define PBJ a[0].baoji #define PX a[0].xixue #define PE a[0].ex #define PSB a[0].shanbi using namespace std; struct player { string name; int shanbi,level,blood,kill,fy,sudu,jineng[5],jns,money,zhuangbei[7],zbs,baoji,xixue,ex; }a[1]; string boss_name[120]={"御宝司","梨将","六灵","巫师","战士队长","骑手","大力士","船夫","加勒比海盗船长","尼摩","武林高手","铁神","谢皓韩"}; int boss_kill[100]={10,23,40,50,120,200,500,600,1000,1200,2000,2000}; int boss_blood[100]={30,120,500,770,1300,1000,2000,2500,4000,5000,9000,100000}; int boss_fy[100]={5,13,26,60,100,100,200,300,600,800,900,1000}; int boss_sudu[100]={6,11,20,40,80,230,160,300,400,500,600,800}; int boss_jineng[100]={0,0,0,1,0,0,0,0,2,3,4,0}; int boss_shanbi[100]={0,0,0,0,10,20,20,50,70,70,50,0}; int boss_killp[100]={5,17,30,50,100,130,150,200,250,270,300}; int boss_bloodp[100]={30,90,150,150,200,210,250,300,350,400,400}; int boss_fyp[100]={4,13,22,30,50,20,70,80,80,100,110}; int boss_sudup[100]={6,8,12,30,50,80,50,80,80,90,100}; int boss_jinengp[100]={0,0,0,1,0,0,0,0,2,3,0,0}; int boss_moneyp[100]={10,60,100,130,150,100,200,230,250,260,300}; int boss_exp[100]={60,80,300,500,700,700,1000,2000,3000,4000,5000}; int boss_sbp[100]={1,1,1,1,1,1,2,3,4,5,5}; string wuqi_name[60]={"","石剑","快刀","铁斧","环扣剑","守护碎刃","狂魔镰"}; int wuqi_gongji[60]={0,6,0,14,0,15,500}; int wuqi_sudu[60]={0,0,6,0,12,15,300}; int wuqim[60]={0,12,12,30,30,60,1<<31-1}; string kaijia_name[60]={"","布甲","铁盾","石甲","轻盾","守护铠"}; int kaijia_blood[60]={0,50,0,90,0,300}; int kaijia_fangyu[60]={0,0,5,0,10,25}; int kaijiam[60]={0,12,12,30,30,60}; int lev[150]={0,50,100,150,200,300,500,800,1000,1200,1500,2000,3000,5000,7000}; string jinengg[6]={"","鲜血汲取","海啸","海的召唤","绝杀"}; int gk,wqs=6,kjs=5; bool boss[60]; void fight() { system("cls"); printf("通关数:%d\n",gk); printf("请选择你要挑战的对手:\n"); for(int i=0;i<=gk;i++)cout<<i+1<<"."<<boss_name[i]<<"\n"; int p; cin>>p; if(p>gk+1) { system("cls"); printf("指令无效!"); Sleep(1000); fight(); return; } else if(p==0)return; else { p--; int t=PB,k=boss_blood[p],pf=PF,pk=PK,bk1=boss_kill[p],bf=boss_fy[p]; while(t>0&&k>0) { for(int i=1;i<=max(0,PS/boss_sudu[p])+rand()%1+1;i++) { if(k<=0||t<=0)break; cout<<"你的血量:"<<max(0,t)<<" "<<boss_name[p]<<"的血量:"<<max(0,k)<<endl; int l=rand(); if(l%4==0&&PJ[1]!=0) { cout<<PN<<"对"<<boss_name[p]<<"使用了"<<jinengg[PJ[1]]<<"\n"; if(PJ[1]==1) { int h=pk-bf+rand()%10+1; cout<<PN<<"对"<<boss_name[p]<<"造成了"<<h<<"点伤害\n"; cout<<PN<<"吸取了"<<h<<"点鲜血\n"; k-=h; t+=h; } } if(l%4==1&&PJ[2]!=0) { cout<<PN<<"对"<<boss_name[p]<<"使用了"<<jinengg[PJ[2]]<<"\n"; if(PJ[2]==2) { float h=max(0,pk*2-bf)+rand()%100+1; int u=(int)h*1.8; cout<<PN<<"对"<<boss_name[p]<<"造成了"<<u<<"点伤害\n"; k-=u; } } if(l%4==2&&PJ[3]!=0) { cout<<PN<<"对"<<boss_name[p]<<"使用了"<<jinengg[PJ[3]]<<"\n"; if(PJ[3]==3) { cout<<PN<<"对"<<boss_name[p]<<"造成了"<<PK<<"点伤害\n"; k-=PK; bk1*=0.8; bf*=0.8; pk*=1.2; pf*=1.2; cout<<PN<<"的攻防属性提高了20%\n"<<boss_name[p]<<"的攻防属性降低了20%\n"; } } if(rand()%100+1<boss_shanbi[p]){printf("对手闪避了你的攻击!!\n");/*Sleep(500);*/continue;} int w=max(0,pk-bf)+rand()%pk/3+1,y=1; bool f=rand()%100+1<=PBJ?1:0; if(f)y=1.8+((rand()%2)-0.5)*0.14; w*=y; cout<<PN<<"对"<<boss_name[p]<<"造成了"<<w<<"点伤害\n"; t+=w*PX/100; if(t>PB)t=PB; k-=w; //Sleep(500); } for(int i=1;i<=max(0,boss_sudu[p]/PS)+rand()%1+1;i++) { if(t<=0||k<=0)break; cout<<"你的血量:"<<max(0,t)<<" "<<boss_name[p]<<"的血量:"<<max(0,k)<<endl; if(rand()%4==0&&boss_jineng[p]!=0) { cout<<boss_name[p]<<"对"<<PN<<"使用了"<<jinengg[boss_jineng[p]]<<"\n"; if(boss_jineng[p]==1) { int h=max(0,bk1-PF)+rand()%10+1; cout<<boss_name[p]<<"对"<<PN<<"造成了"<<h<<"点伤害\n"; cout<<boss_name[p]<<"吸取了"<<h<<"点鲜血\n"; t-=h; k+=h; } if(boss_jineng[p]==2) { float h=max(0,bk1*2-PF)+rand()%100+1; int u=(int)h*1.8; cout<<boss_name[p]<<"对"<<PN<<"造成了"<<u<<"点伤害\n"; t-=u; } if(boss_jineng[p]==3) { cout<<boss_name[p]<<"对"<<PN<<"造成了"<<bk1<<"点伤害\n"; t-=bk1; bk1*=1.2; bf*=1.2; pk*=0.8; pf*=0.8; cout<<boss_name[p]<<"的攻防属性提高了20%\n"<<PN<<"的攻防属性降低了20%\n"; } if(boss_jineng[p]==4) { cout<<boss_name[p]<<"对"<<PN<<"造成了"<<(int)t*0.9<<"点伤害\n"; t*=0.1; } } if(rand()%100+1<PSB){printf("你闪避了对手的攻击!!\n");/*Sleep(500);*/continue;} int x=max(0,bk1-pf)+rand()%10+1,q=1; bool g=rand()%100+1<=PBJ?1:0; if(g)q=1.8+((rand()%2)-0.5)*0.14; x*=q; cout<<boss_name[p]<<"对"<<PN<<"造成了"<<x<<"点伤害\n"; t-=x; //Sleep(500); } } cout<<"战斗结束...\n"; cout<<"你的血量:"<<max(0,t)<<" "<<boss_name[p]<<"的血量:"<<max(0,k)<<endl; Sleep(1000); if(t<=0)cout<<"你被击倒了!\n",Sleep(3000); else { if(boss[p]==0) { boss[p]=1; PB+=boss_bloodp[p]; PK+=boss_killp[p]; PS+=boss_sudup[p]; PF+=boss_fyp[p]; if(boss_jinengp[p])PJ[++a[0].jns]=boss_jinengp[p]; PM+=boss_moneyp[p]; PE+=boss_exp[p]; PSB+=boss_sbp[p]; } cout<<"你战胜了"<<boss_name[p]<<endl; if(p==gk)gk++; int o; o=getchar(); o=getchar(); return; } return; } return; } void wuqi() { printf("武器列表:\n"); for(int i=1;i<=wqs;i++) { cout<<i<<"."<<wuqi_name[i]<<endl; cout<<"武器效果:\n"; cout<<"攻击力增强:"<<wuqi_gongji[i]<<endl; cout<<"攻速增强:"<<wuqi_sudu[i]<<endl; cout<<"价格:"<<wuqim[i]<<endl; cout<<endl; } int r; cin>>r; if(r==666)return; if(r>wqs)cout<<"指令无效!"<<endl,Sleep(2000); else { if(PM<wuqim[r]) { system("cls"); cout<<"你的余额不足!!"<<endl; Sleep(2000); wuqi(); } else { int oo=0; if(r==6)oo=1; cout<<"购买成功!\n"; PZ[++a[0].zbs]=r*-1; PM-=wuqim[r]; PK+=wuqi_gongji[r]; PS+=wuqi_sudu[r]; if(oo==1)wuqim[r]=1<<31-1; Sleep(2000); cout<<"是否继续购买?(1 YES 2 NO)\n"; int e; cin>>e; if(e==1) { system("cls"); wuqi(); } else return; } } return; } void kaijia() { printf("铠甲列表:\n"); for(int i=1;i<=kjs;i++) { cout<<i<<"."<<kaijia_name[i]<<endl; cout<<"铠甲效果:\n"; cout<<"血量增加:"<<kaijia_blood[i]<<endl; cout<<"防御增强:"<<kaijia_fangyu[i]<<endl; cout<<"价格:"<<kaijiam[i]<<endl; cout<<endl; } int r; cin>>r; if(r==666)return; if(r>kjs)cout<<"指令无效!"<<endl,Sleep(2000); else { if(PM<kaijiam[r]) { system("cls"); cout<<"你的余额不足!!"<<endl; Sleep(2000); kaijia(); } else { PZ[++a[0].zbs]=r; cout<<"购买成功!\n"; PM-=kaijiam[r]; PB+=kaijia_blood[r]; PF+=kaijia_fangyu[r]; Sleep(2000); cout<<"是否继续购买?(1 YES 2 NO)\n"; int e; cin>>e; if(e==1) { system("cls"); kaijia(); } else return; } } return; } void shop() { system("cls"); printf("请问您要购买什么?\n1.武器 2.铠甲\n"); int p; cin>>p; system("cls"); if(p==1)wuqi(); else if(p==2)kaijia(); else { cout<<"指令无效!"<<endl,Sleep(2000); } system("cls"); cout<<"继续购买吗?(1 YES 2 NO)\n"; int h; cin>>h; if(h==1)shop(); else return; } void zhuangtai() { system("cls"); cout<<"你的等级:"<<PL<<endl; cout<<"你的经验值:"<<PE<<"/"<<lev[PL]<<endl; cout<<"你的血量上限:"<<PB<<endl; cout<<"你的攻击力:"<<PK<<endl; cout<<"你的速度:"<<PS<<endl; cout<<"你的防御:"<<PF<<endl; cout<<"你的闪避:"<<PSB<<"%"<<endl; cout<<"你的金钱:"<<PM<<endl; cout<<"你的暴击几率:"<<PBJ<<"%"<<endl; cout<<"你的吸血:"<<PX<<"%"<<endl; cout<<"你的装备:\n"; for(int i=1;i<=a[0].zbs;i++) { if(PZ[i]<0)cout<<wuqi_name[PZ[i]*-1]<<endl; if(PZ[i]>0)cout<<kaijia_name[PZ[i]]<<endl; } cout<<"你的技能:\n"; for(int i=1;i<=a[0].jns;i++) { cout<<jinengg[PJ[i]]<<endl; } cout<<endl; int o; o=getchar(); o=getchar(); return; } void xiulian() { system("cls"); printf("您要选择在哪里修炼?\n"); cout<<"1.民间(50%成功,费用40) 2.山境(80%成功,费用70) 3.佛地(100%成功,费用300)\n"; int u; cin>>u; if(u==666)return; if(u==1) { if(PM<20) { system("cls"); cout<<"你的余额不足!!"<<endl; Sleep(2000); xiulian(); } else { if(rand()%100+1<=50) { cout<<"修炼成功!\n"; int s; s=abs(rand()%50+1); PB+=s; cout<<"血量提升"<<s<<"点\n"; s=abs(rand()%10+1); PK+=s; cout<<"攻击力提升"<<s<<"点\n"; s=abs(rand()%10+1); PF+=s; cout<<"防御提升"<<s<<"点\n"; s=abs(rand()%10+1); PS+=s; cout<<"速度提升"<<s<<"点\n"; s=abs(rand()%2+1); PBJ+=s; cout<<"暴击提升"<<s<<"点\n"; s=abs(rand()%2+1); PX+=s; cout<<"吸血提升"<<s<<"点\n"; PM-=40; } else { cout<<"修炼失败,元气受损...\n"; int s; s=abs(rand()%50+1); PB-=s; cout<<"血量降低"<<s<<"点\n"; s=abs(rand()%10+1); PK-=s; cout<<"攻击力降低"<<s<<"点\n"; s=abs(rand()%10+1); PF-=s; cout<<"防御降低"<<s<<"点\n"; s=abs(rand()%10+1); PS-=s; cout<<"速度降低"<<s<<"点\n"; s=abs(rand()%2+1); PBJ-=s; cout<<"暴击降低"<<s<<"点\n"; s=abs(rand()%2+1); PX-=s; cout<<"吸血降低"<<s<<"点\n"; PM-=40; } } } else if(u==2) { if(PM<50) { system("cls"); cout<<"你的余额不足!!"<<endl; Sleep(2000); xiulian(); } else { if(rand()%100+1<=80) { cout<<"修炼成功!\n"; int s; s=abs(rand()%100+1); PB+=s; cout<<"血量提升"<<s<<"点\n"; s=abs(rand()%30+1); PK+=s; cout<<"攻击力提升"<<s<<"点\n"; s=abs(rand()%30+1); PF+=s; cout<<"防御提升"<<s<<"点\n"; s=abs(rand()%20+1); PS+=s; cout<<"速度提升"<<s<<"点\n"; s=abs(rand()%5+1); PBJ+=s; cout<<"暴击提升"<<s<<"点\n"; s=abs(rand()%5+1); PX+=s; cout<<"吸血提升"<<s<<"点\n"; PM-=70; } else { cout<<"修炼失败,元气受损...\n"; int s; s=abs(rand()%100+1); PB-=s; cout<<"血量降低"<<s<<"点\n"; s=abs(rand()%30+1); PK-=s; cout<<"攻击力降低"<<s<<"点\n"; s=abs(rand()%30+1); PF-=s; cout<<"防御降低"<<s<<"点\n"; s=abs(rand()%30+1); PS-=s; cout<<"速度降低"<<s<<"点\n"; s=abs(rand()%5+1); PBJ-=s; cout<<"暴击降低"<<s<<"点\n"; s=abs(rand()%5+1); PX-=s; cout<<"吸血降低"<<s<<"点\n"; PM-=70; } } } else if(u==3) { if(PM<300) { system("cls"); cout<<"你的余额不足!!"<<endl; Sleep(2000); xiulian(); } else { cout<<"修炼成功!\n"; int s; s=abs(rand()%200+1); PB+=s; cout<<"血量提升"<<s<<"点\n"; s=abs(rand()%50+1); PK+=s; cout<<"攻击力提升"<<s<<"点\n"; s=abs(rand()%50+1); PF+=s; cout<<"防御提升"<<s<<"点\n"; s=abs(rand()%40+1); PS+=s; cout<<"速度提升"<<s<<"点\n"; s=abs(rand()%15+1); PBJ+=s; cout<<"暴击提升"<<s<<"点\n"; s=abs(rand()%15+1); PX+=s; cout<<"吸血提升"<<s<<"点\n"; s=abs(rand()%3+1); PSB+=s; cout<<"闪避提升"<<s<<"点\n"; PM-=300; } } else { system("cls"); cout<<"指令无效!"<<endl,Sleep(2000); xiulian(); } cout<<"继续修炼吗?(1 YES 2 NO)\n"; int q; cin>>q; if(q==1)xiulian(); else return; } void begin() { printf(" 欢迎来到剑·途!(V 1.3 制作:HZW)\n请输入你的名字:"); cin>>PN; cout<<endl; if(PN=="test") { PB=1000000000; PL=1; PK=1000; PF=5; PS=10; PBJ=2; PX=3; PM=50; PSB=99; gk=12; } else { PB=100; PL=1; PK=15; PF=5; PS=10; PBJ=2; PX=3; PM=50; PSB=5; } int f=1; system("cls"); for(int i=1;;i++) { if(gk>=10&&f==1)f=0,wuqim[6]=0; system("cls"); while(PE>=lev[PL]) { system("cls"); cout<<"等级提升!!"; PL++; PE-=lev[PL-1]; Sleep(2000); } system("cls"); printf("请选择你要做的事\n1.挑战 2.购买 3.修炼 4.状态\n"); int c; cin>>c; if(c==1)fight(); else if(c==2)shop(); else if(c==3)xiulian(); else if(c==4)zhuangtai(); else if(c==638)PM+=1000; else { system("cls"); printf("指令无效!"); Sleep(1000); continue; } } } int main() { system("color 0E"); srand(time(0)); begin(); return 0; }