剑·途

Posted 2006hanziwei

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了剑·途相关的知识,希望对你有一定的参考价值。

技术图片
//程序名:新的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
using namespace std;
struct player

    string name;
    int level,blood,kill,fy,sudu,jineng[5],jns,money,zhuangbei[7],zbs,baoji,xixue,ex;
a[1];
string boss_name[10]="御宝司","梨将","六灵","巫师","战士队长","骑手","大力士";
int boss_kill[10]=10,23,40,50,120,200,500;
int boss_blood[10]=30,120,500,770,1300,1000,2000;
int boss_fy[10]=5,13,26,60,100,100,200;
int boss_sudu[10]=6,11,20,40,80,230,160;
int boss_jineng[10]=0,0,0,1,0,0,0;
int boss_killp[10]=5,17,30,50,100,130,150;
int boss_bloodp[10]=30,90,150,150,200,210,250;
int boss_fyp[10]=4,13,22,30,50,20,70;
int boss_sudup[10]=6,8,12,30,50,80,50;
int boss_jinengp[10]=0,0,0,1,0,0,0;
int boss_moneyp[10]=10,60,100,130,150,100,200;
int boss_exp[10]=60,80,300,500,700,700,1000;
string wuqi_name[6]="","石剑","快刀","铁斧","环扣剑","守护碎刃";
int wuqi_gongji[6]=0,6,0,14,0,15;
int wuqi_sudu[6]=0,0,6,0,12,15;
int wuqim[6]=0,12,12,30,30,60;
string kaijia_name[6]="","布甲","铁盾","石甲","轻盾","守护铠";
int kaijia_blood[6]=0,50,0,90,0,300;
int kaijia_fangyu[6]=0,0,5,0,10,25;
int kaijiam[6]=0,12,12,30,30,60;
int lev[12]=0,50,100,150,200,300,500,800,1000,1200;
string jinengg[6]="","鲜血汲取";
int gk=6,wqs=5,kjs=5;
bool boss[6];
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
    
        int t=PB,k=boss_blood[p-1];
        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;
                if(rand()%4==0&&PJ[1]!=0)
                
                    cout<<PN<<""<<boss_name[p]<<"使用了"<<jinengg[PJ[1]]<<"\n";
                    if(PJ[1]==1)
                    
                        int h=PK-boss_fy[p]+rand()%10+1;
                        cout<<PN<<""<<boss_name[p]<<"造成了"<<h<<"点伤害\n";
                        cout<<PN<<"吸取了"<<h<<"点鲜血\n";
                        k-=h;
                        t+=h;
                    
                
                int w=max(0,PK-boss_fy[p])+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,boss_kill[p]-PF)+rand()%10+1;
                        cout<<boss_name[p]<<""<<PN<<"造成了"<<h<<"点伤害\n";
                        cout<<boss_name[p]<<"吸取了"<<h<<"点鲜血\n";
                        t-=h;
                        k+=h;
                    
                
                int x=max(0,boss_kill[p]-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];
            
            cout<<"你战胜了"<<boss_name[p]<<endl;
            if(p==gk)gk++;
            Sleep(3000);
        
        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 
        
            cout<<"购买成功!\n";
            PZ[++a[0].zbs]=r*-1;
            PM-=wuqim[r];
            PK+=wuqi_gongji[r];
            PS+=wuqi_sudu[r];
            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<<"你的金钱:"<<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%成功,费用20) 2.山境(80%成功,费用50) 3.佛地(100%成功,费用200)\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-=20;
            
            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-=20;
            
        
    
    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-=50;
            
            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-=50;
            
        
    
    else if(u==3)
    
        if(PM<200)
        
            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";
            PM-=200;
        
    
    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.0 制作:HZW)\n请输入你的名字:");
    cin>>PN;
    cout<<endl;
    PB=100;
    PL=1;
    PK=15;
    PF=5;
    PS=10;
    PBJ=2;
    PX=3;
    PM=50;
    system("cls");
    for(int i=1;;i++)
    
        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==720)PM+=1000;
        else 
        
            system("cls");
            printf("指令无效!");
            Sleep(1000);
            continue;
        
    

int main()

    srand(time(0));
    begin();

    return 0;
剑·途

 

以上是关于剑·途的主要内容,如果未能解决你的问题,请参考以下文章

七绝·丝路吟

查理·芒格南加大毕业典礼演讲:如果你想获得某样东西,那就让自己配得上它!

《Go题库·1》Golang里的数组和切片有了解过吗?

富途证券招股书解读:近2个月客户资产下降

编程习惯与代码风格总结之C/C++篇(更新······)

QQ,微博与微信的接口(崩溃啊!!!上一次写了一大半结果死机,死机···死机了·······)(代码