正文
增加 16 行删除 436 行
12345678979 行未改动899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553692 行未改动62963063163263363463563663776 行未改动714715716717718719720721722141 行未改动全部展开864865866867868869870871872873874875876```#include <bits/stdc++.h>using namespace std;class enemy{public:struct enemykind79 行未改动}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;}#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;92 行未改动private:int qenergy=180;//e技能能量、q技能能量};class operate{public:int generate()//生成敌方{76 行未改动return 0;}};class display{public:string screen_stirp[20]={"==============================================================",//0 //界面显示条,长最长60+2字符"| |",//1141 行未改动全部展开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;}```12345678979 行未改动899091929394959697989910010110210310410510610710810911011111292 行未改动20520620720820921021121221376 行未改动290291292293294295296297298141 行未改动全部展开440441442443444445446447448449450451452453454455456```#include <bits/stdc++.h>using namespace std;class enemy//敌人总基类{public:struct enemykind79 行未改动}private:};class Ordinary_Enemy : public enemy //普通敌人{virtual void attack_1(int* player_life) = 0;//第一种普攻virtual void attack_2(int* player_life) = 0;//第二种普攻};class Elite_Enemy : public enemy //精英敌人{virtual void attack_1(int* player_life) = 0;//第一种普攻virtual void attack_2(int* player_life) = 0;//第二种普攻virtual void generate() = 0;//召唤};enemy en_o;//敌人对象class The_lost//玩家{public:int att_power=100;92 行未改动private:int qenergy=180;//e技能能量、q技能能量};class operate//操作类{public:int generate()//生成敌方{76 行未改动return 0;}};class display//显示类{public:string screen_stirp[20]={"==============================================================",//0 //界面显示条,长最长60+2字符"| |",//1141 行未改动全部展开int main(){display screen;//screen.start_screen();//不知道为啥,把注释解了就会出事screen.choose_look_or_fight();// operate fight;// fight.generate();// fight.select(1);//只有一个角色return 0;}```在团队123186的团队文件里有它的压缩包,我建了个git仓库对于没有下过Git的,详见:[git下载地址](https://git-scm.com/install/)