问题标题: 镜界战记-商店更新!

1
0
已解决
杨家瑞
杨家瑞
新手光能
新手光能
/*
镜界战记 0.11
作者:沐
0.11版较为low
请见谅 
*/
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
struct human{
    string name;
    int aggressivity;
    int blood;
    int Defense;
    string Skills1;
    int Skillaggressivity;
    int Skillnl;
};
void changecolor(){
    system("color 01");
    system("color 02");
    system("color 03");
    system("color 04");
    system("color 05");
    system("color 06");
    system("color 07");
}
void output(){
    Sleep(2000);
}
void clear(){
    system("cls");
}
void buy(int p,int m){
    if(m<p){
        cout<<"钱不够了!"<<endl;
    }
    else{
        cout<<"购买成功!"<<endl;
        m-=p;
    }
}
bool tfbuy(int p,int m){
    if(m<p){
        return false;
    }
    else{
        return true;
    }   
} 
void buysp(int p,int m){
    if(m<p){
        cout<<"钱不够了!"<<endl;
    }
    else{
        cout<<"购买成功!"<<endl;
        m-=p;
    }
}
bool tfbuysp(int p,int m){
    if(m<p){
        return false;
    }
    else{
        return true;
    }   
} 
human a;
string name[11]={"盛海易","天宇","秋风","SY","夕灵浮","永连","森月","修影","空凌初","王魔沐"};
int blood[11]={125,128,115,118,135,130,310,180,350,400};
int aggressivity[11]={10,12,10,15,8,9,38,25,35,55};
int Defense[11]={5,6,5,3,8,7,16,15,16,17};
string Skills1[11]={"沐斩流","深海怒涛劈","飞凌踢","狂嗜砍","梦化反盾","海涛旋涡","亡月斩流","鬼影攻击","光萧长鸣","混辉风暴"};
int Skillaggressivity[11]={85,78,75,80,60,70,200,170,190,195};
int Skillnl[11]={20,30,30,30,20,20,30,30,25,30};
int wespjg[11]={10,10,10,10,10,10,30,30,30,30};
int sp[11]={10,15,20,20,40,80,20,20,100,800};
bool Possession[11]={0};
int wesp[11]={0};
int dj[11]={0};
int Current; 
string gamername;
int money=100;
int Experience=0;
int play;
int main(){ 
    cout<<"由于该版本是0.11版本,所以简陋,后续会更新,请见谅。";
    output();
    clear();
    for(int i=1;i<=5;i++){
        cout<<"镜界战记-0.11";
        changecolor();
        clear();
    } 
    cout<<"输入你的姓名。"<<endl;
    getline(cin,gamername);
    cout<<"你的姓名是:"<<gamername;
    output();
    clear();
    cout<<"随机初始人物抽取中...";
    output();
    output();
    srand((int)time(0));
    int x=rand()%10;
    cout<<endl<<"你的初始人物是:"<<name[x];
    cout<<endl<<"人物初始血量:"<<blood[x];
    cout<<endl<<"人物初始攻击:"<<aggressivity[x];
    cout<<endl<<"人物初始防御:"<<Defense[x];
    cout<<endl<<"人物技能:"<<Skills1[x];
    cout<<endl<<"技能初始伤害:"<<Skillaggressivity[x];
    cout<<endl<<"技能所需能量:"<<Skillnl[x]; 
    Possession[x]=1;
    Current=x;
    output();
    output();
    clear();
    while(true){
        cout<<gamername<<",欢迎来到镜界营地!"<<endl;
        cout<<"1-商人 2-镜兽 3-人物 4-剧情(**中)5-家园(**中) 6-探索(**中) 7.穿梭(**中) 8.更多(**中)";
        cout<<endl<<"当前使用人物:"<<name[Current];
        cout<<endl<<"血量:"<<blood[Current];
        cout<<endl<<"攻击:"<<aggressivity[Current];
        cout<<endl<<"防御:"<<Defense[Current];
        cout<<endl<<"技能:"<<Skills1[Current];
        cout<<endl<<"技能伤害:"<<Skillaggressivity[Current];
        cout<<endl<<"技能所需能量:"<<Skillnl[Current];
        cout<<endl<<"钱:"<<money;
        cout<<endl<<"经验值:"<<Experience<<endl;
        cin>>play;
        clear();
        if(play==1){
            cout<<"欢迎来到商人所在的商店!!!"<<endl;
            cout<<" _______________________"<<endl;
            cout<<"|    商品      价格     |"<<endl;
            cout<<"|                       |"<<endl;
            cout<<"|辅助类                 |"<<endl;
            cout<<"|                       |"<<endl;
            cout<<"|1   小血书       10    |"<<endl;
            cout<<"|2   中血书       15    |"<<endl;
            cout<<"|3   大血书       20    |"<<endl;
            cout<<"|4   小经验书     20    |"<<endl;
            cout<<"|5   中经验书     40    |"<<endl;
            cout<<"|6   大经验书     80    |"<<endl;
            cout<<"|7   暴击书       20    |"<<endl;
            cout<<"|8   寒冰书       20    |"<<endl;
            cout<<"|9   镜咒-灭顶    1000  |"<<endl;
            cout<<"|10  镜咒-斩      800   |"<<endl;
            cout<<"|                       |"<<endl;
            cout<<"|碎片类(随机出售)     |"<<endl;
            cout<<"  ———————————" <<endl;
            srand((int)time(0));
            int x=rand()%10;
            cout<<"11 "<<name[x]<<"碎片"<<" "<<"价格:"<<endl;
            cout<<wespjg[x]<<endl;
            cout<<"选择你想买的辅助类(如果不买输入0)"<<endl;
            cin>>play;
            if(play!=0){
                if(tfbuy(sp[play],money)){
                    dj[play]++;
                }
                buy(sp[play],money);
            }
            cout<<"是否购买出售的碎片?(如果不买输入0,想输入1)"<<endl;
            cin>>play;
            if(play!=0){
                if(tfbuysp(wespjg[play],money)){
                    wespjg[play]++;
                }
                buysp(wespjg[play],money);
            }
            cout<<"谢谢惠顾,下次再来!"<<endl;
            output();
            clear();            
        }   
    }
} 

比改编版的复杂


0
0
0
我要回答