正文
增加 479 行删除 13 行
11 行未改动12131415161718192021222324252627282930313233343536373839404142434445464748495051160 行未改动全部展开2122132142152162172182192202 行未改动223224225226227228229230231133 行未改动全部展开36536636736836937037137237321 行未改动39539639739839940040140240340440540640740840941011 行未改动int bl_v;int enemy_at_powwer;};enemykind kind[1000]={{"natural",500,100},{},};int Enemy_Unit_Combination[10][10000]={{1,1,1,1,1}};int e[100],at_powwer[100];void emy(int en_co)//敌方初始化{for(int i=0;i<5;i++){e[i]=kind[Enemy_Unit_Combination[i][en_co-1]].bl_v;at_powwer[i]=kind[Enemy_Unit_Combination[i][en_co-1]].enemy_at_powwer;}}void print()//显示敌方状态{cout<<"-------------------------------"<<endl;cout<<"| | | | | |"<<endl;for(int i=0;i<5;i++){cout<<"|";if(e[i]==0){cout<<" 消亡";continue;}printf("%5d",e[i]);}cout<<"|"<<endl;cout<<"| | | | | |"<<endl;cout<<"-------------------------------"<<endl;}int ifkia()//全灭判断{for(int i=0;i<10;i++)160 行未改动全部展开int d;en_o.print();cout<<"请选择目标(1~5):"<<endl;cin>>d;d-=1;lost.lostaskill(d,&lost.lostnl,en_o.e,&lost.rationality);en_o.print();cout<<endl;}2 行未改动int d;en_o.print();cout<<"请选择目标(1~5):"<<endl;cin>>d;d-=1;en_o.print();lost.losteskill(d,&lost.lostnl,en_o.e,&lost.rationality);en_o.print();cout<<endl;133 行未改动全部展开cout<<screen_stirp[1]<<endl;cout<<screen_stirp[0]<<endl;string a;// 清除输入缓冲区cin.ignore(numeric_limits<streamsize>::max(), '\n');cout<<"请输入:";cin>>a;// 清除输入缓冲区cin.ignore(numeric_limits<streamsize>::max(), '\n');21 行未改动int main(){display screen;//screen.start_screen();screen.choose_look_or_fight();// operate fight;// fight.generate();// fight.select(1);//只有一个角色return 0;}```11 行未改动12131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081160 行未改动全部展开2422432442452462472482492502 行未改动253254255256257258259260261133 行未改动全部展开39539639739839940040140240321 行未改动42542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587611 行未改动int bl_v;int enemy_at_powwer;};enemykind kind[1000]={{" natural",500,100},{},};int Enemy_Unit_Combination[10][10000]={{1,1,1,1,1}};int e[100],at_powwer[100];string enemy_name[100];void emy(int en_co)//敌方初始化{for(int i=1;i<=5;i++){enemy_name[i]=kind[Enemy_Unit_Combination[i][en_co-1]].name;e[i]=kind[Enemy_Unit_Combination[i][en_co-1]].bl_v;at_powwer[i]=kind[Enemy_Unit_Combination[i][en_co-1]].enemy_at_powwer;}}void print()//显示敌方状态{cout<<" 敌方状态 "<<endl;cout<<" -----------------------------------------------------------------------"<<endl;cout<<" | | | | | |"<<endl;cout<<" 名字";for(int i=1;i<=5;i++){cout<<"|";if(e[i]==0){printf(" ");continue;}cout<<enemy_name[i];//printf("%13s",enemy_name[i]);}cout<<"|"<<endl;cout<<"生命值";for(int i=1;i<=5;i++){cout<<"|";if(e[i]==0){//string s="消亡";cout<<" 消亡";continue;}printf("%13d",e[i]);}cout<<"|"<<endl;cout<<"攻击力";for(int i=1;i<=5;i++){cout<<"|";if(e[i]==0){printf(" ");continue;}printf("%13d",at_powwer[i]);}cout<<"|"<<endl;cout<<" 位置| 1 | 2 | 3 | 4 | 5 |"<<endl;cout<<" -----------------------------------------------------------------------"<<endl;}int ifkia()//全灭判断{for(int i=0;i<10;i++)160 行未改动全部展开int d;en_o.print();cout<<"请选择目标(1~5):"<<endl;cin>>d;//d-=1;lost.lostaskill(d,&lost.lostnl,en_o.e,&lost.rationality);en_o.print();cout<<endl;}2 行未改动int d;en_o.print();cout<<"请选择目标(1~5):"<<endl;cin>>d;//d-=1;en_o.print();lost.losteskill(d,&lost.lostnl,en_o.e,&lost.rationality);en_o.print();cout<<endl;133 行未改动全部展开cout<<screen_stirp[1]<<endl;cout<<screen_stirp[0]<<endl;string a;// 清除输入缓冲区cin.ignore(numeric_limits<streamsize>::max(),'\n');cout<<"请输入:";cin>>a;// 清除输入缓冲区cin.ignore(numeric_limits<streamsize>::max(), '\n');21 行未改动int main(){display screen;//screen.start_screen();//不知道为啥,把注释解了就会出事cin.ignore(numeric_limits<streamsize>::max(),'\n');screen.choose_look_or_fight();// operate fight;// fight.generate();// fight.select(1);//只有一个角色return 0;}#include <bits/stdc++.h>using namespace std;class enemy{public:struct enemykind{string name;int bl_v;int enemy_at_powwer;};enemykind kind[1000]={{" natural",500,100},{},};int Enemy_Unit_Combination[10][10000]={{1,1,1,1,1}};int e[100],at_powwer[100];string enemy_name[100];void emy(int en_co)//敌方初始化{for(int i=1;i<=5;i++){enemy_name[i]=kind[Enemy_Unit_Combination[i][en_co-1]].name;e[i]=kind[Enemy_Unit_Combination[i][en_co-1]].bl_v;at_powwer[i]=kind[Enemy_Unit_Combination[i][en_co-1]].enemy_at_powwer;}}void print()//显示敌方状态{cout<<" 敌方状态 "<<endl;cout<<" -----------------------------------------------------------------------"<<endl;cout<<" | | | | | |"<<endl;cout<<" 名字";for(int i=1;i<=5;i++){cout<<"|";if(e[i]==0){printf(" ");continue;}cout<<enemy_name[i];//printf("%13s",enemy_name[i]);}cout<<"|"<<endl;cout<<"生命值";for(int i=1;i<=5;i++){cout<<"|";if(e[i]==0){//string s="消亡";cout<<" 消亡";continue;}printf("%13d",e[i]);}cout<<"|"<<endl;cout<<"攻击力";for(int i=1;i<=5;i++){cout<<"|";if(e[i]==0){printf(" ");continue;}printf("%13d",at_powwer[i]);}cout<<"|"<<endl;cout<<" 位置| 1 | 2 | 3 | 4 | 5 |"<<endl;cout<<" -----------------------------------------------------------------------"<<endl;}int ifkia()//全灭判断{for(int i=0;i<10;i++){if(e[i]){return 0;}}return 1;}private:};enemy en_o;//敌人对象class The_lost{public:int att_power=100;int lostnl=0,life=1500;string name="the lost";bool recovery_state = false; // 「回复」状态标记int recovery_turn = 0; // 「回复」状态剩余回合int damage_record = 0; // 「回复」状态下记录的伤害值int rationality=0;//理性点,普攻后增加,消耗以发动e技能,理智点属于各个角色独有,不与其他角色共享The_lost(){att_power=100;lostnl=0;}void lostaskill(int d,int *lostnl,int *e,int *rationality)//普攻{*lostnl=*lostnl+20;int damage = 0.8 * att_power;e[d]-=damage;if(recovery_state) {damage_record += damage;cout<<"【回复状态】记录普攻伤害:"<<damage<<" 累计:"<<damage_record<<endl;}*rationality+=1;if(e[d] <= 0){e[d] = 0;}}void losteskill(int d,int *lostnl,int *e,int *rationality)//e技能{if(*rationality>0){*rationality-=1;}else{cout<<"理性不足"<<endl;return;}int damage = 2 * att_power;e[d]-=damage;if(recovery_state) {damage_record += damage;cout<<"【回复状态】记录E技能伤害:"<<damage<<" 累计:"<<damage_record<<endl;}*lostnl+=30;if(e[d] <= 0){e[d] = 0;}}void lostqskill(int *lostnl,int *e)//大招{if(*lostnl>=qenergy){*lostnl-=qenergy;}else{cout<<"能量不足"<<endl;return;}// 大招核心逻辑:回复2个理性点,进入回复状态(持续2回合),重置伤害记录rationality += 2;recovery_state = true;recovery_turn = 3+1;damage_record = 0;cout<<"【Q技能生效】回复2个理性点(当前:"<<rationality<<"),进入「回复」状态,持续3回合!"<<endl;// 回复状态结束处理(如果是状态到期)- 此处由回合逻辑触发,这里仅初始化状态*lostnl+=30;}//每回合结束时调用,更新回复状态void update_recovery_state() {if(recovery_state){int damage_record_per=0.5;recovery_turn--;cout<<"【回复状态】剩余回合:"<<recovery_turn<<endl;int heal = damage_record * damage_record_per;damage_record*=damage_record_per;life += heal;// 生命值不超过上限if(life > 1500) life = 1500;cout<<"【回复状态】累计造成伤害:"<<damage_record<<",转化"<<heal<<"点记录值(当前:"<<life<<")"<<endl;if(recovery_turn==0){recovery_state = false;damage_record = 0;}}}private:int qenergy=180;//e技能能量、q技能能量};class operate{public:int generate()//生成敌方{cout<<"战斗开始"<<endl;en_o.emy(1);en_o.print();return 0;}The_lost lost;queue <string>actionqueue;//行动队列//行动队列中的单位会轮换行动int select(int rs)//选择角色{for(int i=0;i<5;i++){actionqueue.push("monster");}for(int i=0;i<rs;i++){string rolename;cout<<"踏上前来,你是:(me)"<<endl;cin>>rolename;actionqueue.push(rolename);}while (!en_o.ifkia())//回合轮换{string ppp=actionqueue.front();move(ppp);actionqueue.pop();actionqueue.push(ppp);}cout<<"战斗胜利"<<endl;return 0;}int move(string role){if(role=="me")//迷途之人便是你 你的操作{//cout<<"迷途之人"<<endl;cout<<" 选择操作 当前能量:"<<lost.lostnl<<" 理性点:"<<lost.rationality<<endl;cout<<"a e q"<<endl;char operationoptions;cin>>operationoptions;if(operationoptions=='a'){int d;en_o.print();cout<<"请选择目标(1~5):"<<endl;cin>>d;//d-=1;lost.lostaskill(d,&lost.lostnl,en_o.e,&lost.rationality);en_o.print();cout<<endl;}if(operationoptions=='e'){int d;en_o.print();cout<<"请选择目标(1~5):"<<endl;cin>>d;//d-=1;en_o.print();lost.losteskill(d,&lost.lostnl,en_o.e,&lost.rationality);en_o.print();cout<<endl;}if(operationoptions=='q'){en_o.print();lost.lostqskill(&lost.lostnl,en_o.e);en_o.print();cout<<endl;}lost.update_recovery_state();}else if(role=="monster"){cout<<"pass"<<endl;}return 0;}};class display{public:string screen_stirp[20]={"==============================================================",//0 //界面显示条,长最长60+2字符"| |",//1"| wating. |",//2"| wating.. |",//3"| wating... |",//4"| "," |",//小型区(10+1)// 5 6" "};//mini款// 7//------------------------------------------------------------------------游戏开始显示struct AnimationFrame {string text;string progress_bar;};// 预定义动画帧vector<AnimationFrame> loading_frames = {{screen_stirp[2], "□□□□□□□□□□□□□□□□□□□□"},{screen_stirp[3], "■□□□□□□□□□□□□□□□□□□□"},{screen_stirp[4], "■■□□□□□□□□□□□□□□□□□□"},{screen_stirp[2], "■■■□□□□□□□□□□□□□□□□□"},{screen_stirp[3], "■■■■□□□□□□□□□□□□□□□□"},{screen_stirp[4], "■■■■■□□□□□□□□□□□□□□□"},{screen_stirp[2], "■■■■■■□□□□□□□□□□□□□□"},{screen_stirp[3], "■■■■■■■□□□□□□□□□□□□□"},{screen_stirp[4], "■■■■■■■■□□□□□□□□□□□□"},{screen_stirp[2], "■■■■■■■■■□□□□□□□□□□□"},{screen_stirp[3], "■■■■■■■■■■□□□□□□□□□□"},{screen_stirp[4], "■■■■■■■■■■■□□□□□□□□□"},{screen_stirp[2], "■■■■■■■■■■■■□□□□□□□□"},{screen_stirp[3], "■■■■■■■■■■■■■□□□□□□□"},{screen_stirp[4], "■■■■■■■■■■■■■■□□□□□□"},{screen_stirp[2], "■■■■■■■■■■■■■■■□□□□□"},{screen_stirp[3], "■■■■■■■■■■■■■■■■□□□□"},{screen_stirp[4], "■■■■■■■■■■■■■■■■■□□□"},{screen_stirp[2], "■■■■■■■■■■■■■■■■■■□□"},{screen_stirp[3], "■■■■■■■■■■■■■■■■■■■□"},{screen_stirp[4], "■■■■■■■■■■■■■■■■■■■■"}};// 渲染单个帧的通用方法void render_frame(const AnimationFrame& frame) {cout << screen_stirp[0] << endl << screen_stirp[1] << endl;cout << screen_stirp[1] << endl << screen_stirp[1] << endl;cout << screen_stirp[1] << endl << screen_stirp[1] << endl;cout <<frame.text << endl;cout << screen_stirp[5] + screen_stirp[7] + screen_stirp[7];cout << frame.progress_bar;cout << screen_stirp[7] + screen_stirp[7] + screen_stirp[6] << endl;cout << screen_stirp[1] << endl << screen_stirp[0] << endl;}int start_screen()//开始屏幕显示{int a;cout<<screen_stirp[0]<<endl<<screen_stirp[1]<<endl;cout<<screen_stirp[5]<<"-- --"<<screen_stirp[6]<<endl;cout<<screen_stirp[5]<<"( 名为数学的游戏 )"<<screen_stirp[6]<<endl;cout<<screen_stirp[5]<<"-- --"<<screen_stirp[6]<<endl<<screen_stirp[1]<<endl;cout<<screen_stirp[5]<<" (输入任意内容以开始游戏) "<<screen_stirp[6]<<endl<<screen_stirp[1]<<endl<<screen_stirp[1]<<endl<<screen_stirp[0]<<endl;cout<<"输入任意内容以开始游戏:";cin>>a;cout<<endl;cout<<"欢迎来到“名为数学的游戏”游戏马上开始"<<endl;// 播放加载动画for (const auto& frame : loading_frames) {render_frame(frame);std::this_thread::sleep_for(std::chrono::milliseconds(300));}return 0;}//------------------------------------------------------------------------游戏开始显示//------------------------------------------------------------------------角色 or 战斗int display_role(){// 显示角色string name;cout<<"请输入名称(me):";cin>>name;if(name=="me"){cout<<"角色名称:"<<name<<endl;cout<<"角色技能:"<<endl;cout << screen_stirp[7] + "天赋:探索者 羁绊:独行者" << endl;cout << screen_stirp[7] + screen_stirp[7] + "天赋: 作为独行于此的你,步步为艰,你将探索此地,学习便是你最好的武器,(经过学习你将会获得新的一套技能)" << endl;cout << screen_stirp[7] + "形态:无知 初来乍到,你一无所知" << endl;cout << screen_stirp[7] + screen_stirp[7] + "普攻a: 回复一个理性点,对指定敌方单体造成80%攻击力的伤害,回复20能量" << endl;cout << screen_stirp[7] + screen_stirp[7] + "E技能e: 消耗一个理性点,对指定敌方单体造成200%攻击力的伤害,回复30能量" << endl;cout << screen_stirp[7] + screen_stirp[7] + "Q技能q: 消耗180能量,回复两个理性点,进入「回复」状态,持续三回合,此状态下记录角色造成的伤害,在状态中,每回合结束后将记录的伤害的50%转化为血量回复量" << endl;}else{cout<<"(请勿重复进行无效输入,否则电脑堆栈将爆炸)木有欧"<<endl;display_role();}return 0;}int choose_look_or_fight(){cout<<screen_stirp[0]<<endl;cout<<screen_stirp[1]<<endl;cout<<screen_stirp[1]<<endl;cout<<screen_stirp[1]<<endl;cout<<"| 输入“c”查看角色 |"<<endl;cout<<"| 输入“f”开始战斗 |"<<endl;cout<<screen_stirp[1]<<endl;cout<<screen_stirp[1]<<endl;cout<<screen_stirp[1]<<endl;cout<<screen_stirp[0]<<endl;string a;// 清除输入缓冲区cin.ignore(numeric_limits<streamsize>::max(),'\n');cout<<"请输入:";cin>>a;// 清除输入缓冲区cin.ignore(numeric_limits<streamsize>::max(), '\n');if(a=="c"){display_role();}else if(a=="f"){operate fight;fight.generate();fight.select(1);//只有一个角色}else{cout<<"(请勿重复进行无效输入,否则电脑堆栈将爆炸)无效输入,请重新输入:"<<endl;choose_look_or_fight();}return 0;}};int main(){display screen;//screen.start_screen();//不知道为啥,把注释解了就会出事cin.ignore(numeric_limits<streamsize>::max(),'\n');screen.choose_look_or_fight();// operate fight;// fight.generate();// fight.select(1);//只有一个角色return 0;}```