版本比较
Game
正文
增加 24 行删除 24 行
181 行未改动全部展开1821831841851861871881891901911921931941951961971981994 行未改动2042052062072082092102112123 行未改动2162172182192202212222232242252262272282292302318 行未改动24024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827941 行未改动3213223233243253263273283293303313323333343353363373383393403 行未改动34434534634734834935035135212 行未改动36536636736836937037137237341 行未改动41541641741841942042142242342442542642742810 行未改动4394404414424434444454464474484494504514524534544554564573 行未改动46146246346446546646746846912 行未改动48248348448548648748848949040 行未改动531532533534535536537538539540541542543544165 行未改动全部展开181 行未改动全部展开// 任务完成检测void checkTaskComplete() {for (auto& t : tasks) {if (t.is_completed || !t.is_received) continue;if (strcmp(t.id, "主线01") == 0 && day >= 3 && hunger <= 80) {t.is_completed = true;money += t.reward_money;hp = min(hp_max, hp + t.reward_hp);food.count += t.reward_food;ammo_bullet += t.reward_bullet;ammo_shell += t.reward_shell;maps[1].is_unlocked = true;clr(); gradientPrint("【任务完成】" + t.title, COLOR_GREEN);cout << "解锁:废弃都市废墟\n";system("pause");}4 行未改动food.count += t.reward_food;ammo_bullet += t.reward_bullet;ammo_shell += t.reward_shell;maps[2].is_unlocked = true;clr(); gradientPrint("【任务完成】" + t.title, COLOR_GREEN);cout << "解锁:军事要塞外围\n";system("pause");}3 行未改动// 初始化游戏数据void init() {srand(time(0));weather = weathers[rand()%6];// 食物初始化food.name = "压缩干粮";food.price = 50;food.count = 8;food.recover_hunger = 20;food.recover_hp = 50;// 武器初始化weapon.push_back({"军用匕首", 80, 1, 60, "无", 0, false});weapon.push_back({"弹弓", 10, 0, 25, "无", 0, false});weapon.push_back({"弓箭", 30, 0, 40, "无", 0, false});8 行未改动weapon.push_back({"TNT炸药", 5500, 0, 500, "无", 0, false});weapon.push_back({"医疗包", 100, 0, 0, "无", 0, false});weapon.push_back({"通用子弹1000发", 50, 0, 0, "子弹", 0, false});weapon.push_back({"通用炮弹20发", 200, 0, 0, "炮弹", 0, false});// 地图和敌人初始化vector<Enemy> wild = {{"流浪匪徒", "持铁棍歹徒", 180,250,25,40,20,80,150},{"野狗群", "疯狂扑咬", 120,200,20,35,15,50,120}};Enemy wild_boss = {"荒野屠夫", "手持巨斧的BOSS", 800,800, 80,80, 200, 800,1500};maps.push_back({"荒野荒原", "杂草丛生,废弃车辆遍地", 40,1,true,wild,wild_boss,true});vector<Enemy> city = {{"武装劫匪","持枪歹徒",300,400,40,60,40,200,350},{"废墟拾荒者","凶狠好斗",250,350,35,50,35,150,250}};Enemy city_boss = {"废墟霸主","全副武装的BOSS",1500,1500,120,120,350,1500,3000};maps.push_back({"废弃都市废墟","断壁残垣,危机四伏",70,2,false,city,city_boss,true});vector<Enemy> military = {{"重装守卫","护甲士兵",500,700,60,90,60,300,500},{"机械哨兵","自动机器人",600,800,70,100,70,400,600}};Enemy military_boss = {"机甲战神","终极防御机甲BOSS",3000,3000,200,200,500,3000,6000};maps.push_back({"军事要塞外围","重兵把守,极度危险",90,3,false,military,military_boss,true});// 任务初始化Task t1; strcpy(t1.id, "主线01");t1.type = "主线"; t1.title = "生存启蒙";t1.target = "存活3天,饥饿≤80";t1.reward_money = 500; t1.reward_hp = 200; t1.reward_food = 5;t1.reward_bullet = 500; t1.reward_shell = 20;t1.is_completed = false; t1.is_received = true;tasks.push_back(t1);Task t2; strcpy(t2.id, "主线02");t2.type = "主线"; t2.title = "积累财富";t2.target = "金钱≥5000";t2.reward_money = 1500; t2.reward_hp = 400; t2.reward_food = 10;41 行未改动Map& m = maps[current_map];Enemy e = m.enemies[rand() % m.enemies.size()];int e_hp = e.min_hp + rand() % (e.max_hp - e.min_hp + 1);int e_atk = e.min_atk + rand() % (e.max_atk - e.min_atk + 1);cout << "【环境】" << m.desc << " | 天气:" << weather << "\n";gradientPrint("遭遇:" + e.name, COLOR_YELLOW);cout << e.desc << " 血量:" << e_hp << "\n";system("pause");while (e_hp > 0 && hp > 0) {clr(); show_state();cout << "敌人:" << e.name << " 血量:" << e_hp << "\n";cout << "1.攻击 2.吃食物 3.医疗包 4.换枪 5.逃跑\n";int c; cin >> c;if (c == 1) {Weapon& w = weapon[current_weapon];if (w.count == 0 && w.ammo_type != "无") {flashPrint("无武器"); system("pause"); continue;3 行未改动if (w.ammo_type == "炮弹" && ammo_shell < w.ammo_per_use) aok = false;if (!aok) {flashPrint("弹药不足"); system("pause"); continue;}int cnt = w.is_auto ? 3 : 1;int total = 0;for (int i = 0; i < cnt; i++) {if (e_hp <= 0 || hp <= 0) break;12 行未改动} else {gradientPrint(w.name + " 打出 " + intToStr(total) + " 点伤害!");}system("pause");if (e_hp > 0) {hp -= e_atk;flashPrint(e.name + " 反击!受伤:" + intToStr(e_atk));system("pause");41 行未改动else if (c == 5) {flashPrint("成功逃跑!"); system("pause");next_half(); return;}if (hp <= 0) {clr(); flashPrint("你被击败了!"); system("pause"); exit(0);}}player_exp += e.exp_val;long long mon = e.min_money + rand() % (e.max_money - e.min_money + 1);money += mon;gradientPrint("胜利!获得经验:" + intToStr(e.exp_val) + " 金钱:" + llToStr(mon));10 行未改动}Enemy e = m.boss;int e_hp = e.min_hp;int e_atk = e.min_atk;gradientPrint("警告:进入BOSS战:" + e.name, COLOR_RED);cout << e.desc << " BOSS血量:" << e_hp << "\n";system("pause");while (e_hp > 0 && hp > 0) {clr(); show_state();cout << "BOSS:" << e.name << " 血量:" << e_hp << "\n";cout << "1.猛攻 2.食物 3.医疗包 4.换枪 5.逃跑\n";int c; cin >> c;if (c == 1) {Weapon& w = weapon[current_weapon];if (w.count == 0 && w.ammo_type != "无") {flashPrint("无武器"); system("pause"); continue;3 行未改动if (w.ammo_type == "炮弹" && ammo_shell < w.ammo_per_use) aok = false;if (!aok) {flashPrint("弹药不足"); system("pause"); continue;}int cnt = w.is_auto ? 3 : 1;int total = 0;for (int i = 0; i < cnt; i++) {if (e_hp <= 0 || hp <= 0) break;12 行未改动} else {gradientPrint(w.name + " 打出 " + intToStr(total) + " 伤害!");}system("pause");if (e_hp > 0) {hp -= e_atk;flashPrint("BOSS反击!受到" + intToStr(e_atk) + "伤害!");system("pause");40 行未改动}else if (c == 5) {flashPrint("你逃离了BOSS战场!"); system("pause"); return;}if (hp <= 0) {clr(); flashPrint("你被BOSS击杀!"); system("pause"); exit(0);}}player_exp += e.exp_val;long long mon = e.min_money;money += mon;gradientPrint("恭喜击败BOSS!获得经验:" + intToStr(e.exp_val) + " 金钱:" + llToStr(mon), COLOR_GREEN);165 行未改动全部展开181 行未改动全部展开1821831841851861871881891901911921931941951961971981994 行未改动2042052062072082092102112123 行未改动2162172182192202212222232242252262272282292302318 行未改动24024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827941 行未改动3213223233243253263273283293303313323333343353363373383393403 行未改动34434534634734834935035135212 行未改动36536636736836937037137237341 行未改动41541641741841942042142242342442542642742810 行未改动4394404414424434444454464474484494504514524534544554564573 行未改动46146246346446546646746846912 行未改动48248348448548648748848949040 行未改动531532533534535536537538539540541542543544165 行未改动全部展开181 行未改动全部展开// 任务完成检测void checkTaskComplete() {for (auto& t : tasks) {if (t.is_completed || !t.is_received) continue;if (strcmp(t.id, "主线01") == 0 && day >= 3 && hunger <= 80) {t.is_completed = true;money += t.reward_money;hp = min(hp_max, hp + t.reward_hp);food.count += t.reward_food;ammo_bullet += t.reward_bullet;ammo_shell += t.reward_shell;maps[1].is_unlocked = true;clr(); gradientPrint("【任务完成】" + t.title, COLOR_GREEN);cout << "解锁:废弃都市废墟\n";system("pause");}4 行未改动food.count += t.reward_food;ammo_bullet += t.reward_bullet;ammo_shell += t.reward_shell;maps[2].is_unlocked = true;clr(); gradientPrint("【任务完成】" + t.title, COLOR_GREEN);cout << "解锁:军事要塞外围\n";system("pause");}3 行未改动// 初始化游戏数据void init() {srand(time(0));weather = weathers[rand()%6];// 食物初始化food.name = "压缩干粮";food.price = 50;food.count = 8;food.recover_hunger = 20;food.recover_hp = 50;// 武器初始化weapon.push_back({"军用匕首", 80, 1, 60, "无", 0, false});weapon.push_back({"弹弓", 10, 0, 25, "无", 0, false});weapon.push_back({"弓箭", 30, 0, 40, "无", 0, false});8 行未改动weapon.push_back({"TNT炸药", 5500, 0, 500, "无", 0, false});weapon.push_back({"医疗包", 100, 0, 0, "无", 0, false});weapon.push_back({"通用子弹1000发", 50, 0, 0, "子弹", 0, false});weapon.push_back({"通用炮弹20发", 200, 0, 0, "炮弹", 0, false});// 地图和敌人初始化vector<Enemy> wild = {{"流浪匪徒", "持铁棍歹徒", 180,250,25,40,20,80,150},{"野狗群", "疯狂扑咬", 120,200,20,35,15,50,120}};Enemy wild_boss = {"荒野屠夫", "手持巨斧的BOSS", 800,800, 80,80, 200, 800,1500};maps.push_back({"荒野荒原", "杂草丛生,废弃车辆遍地", 40,1,true,wild,wild_boss,true});vector<Enemy> city = {{"武装劫匪","持枪歹徒",300,400,40,60,40,200,350},{"废墟拾荒者","凶狠好斗",250,350,35,50,35,150,250}};Enemy city_boss = {"废墟霸主","全副武装的BOSS",1500,1500,120,120,350,1500,3000};maps.push_back({"废弃都市废墟","断壁残垣,危机四伏",70,2,false,city,city_boss,true});vector<Enemy> military = {{"重装守卫","护甲士兵",500,700,60,90,60,300,500},{"机械哨兵","自动机器人",600,800,70,100,70,400,600}};Enemy military_boss = {"机甲战神","终极防御机甲BOSS",3000,3000,200,200,500,3000,6000};maps.push_back({"军事要塞外围","重兵把守,极度危险",90,3,false,military,military_boss,true});// 任务初始化Task t1; strcpy(t1.id, "主线01");t1.type = "主线"; t1.title = "生存启蒙";t1.target = "存活3天,饥饿≤80";t1.reward_money = 500; t1.reward_hp = 200; t1.reward_food = 5;t1.reward_bullet = 500; t1.reward_shell = 20;t1.is_completed = false; t1.is_received = true;tasks.push_back(t1);Task t2; strcpy(t2.id, "主线02");t2.type = "主线"; t2.title = "积累财富";t2.target = "金钱≥5000";t2.reward_money = 1500; t2.reward_hp = 400; t2.reward_food = 10;41 行未改动Map& m = maps[current_map];Enemy e = m.enemies[rand() % m.enemies.size()];int e_hp = e.min_hp + rand() % (e.max_hp - e.min_hp + 1);int e_atk = e.min_atk + rand() % (e.max_atk - e.min_atk + 1);cout << "【环境】" << m.desc << " | 天气:" << weather << "\n";gradientPrint("遭遇:" + e.name, COLOR_YELLOW);cout << e.desc << " 血量:" << e_hp << "\n";system("pause");while (e_hp > 0 && hp > 0) {clr(); show_state();cout << "敌人:" << e.name << " 血量:" << e_hp << "\n";cout << "1.攻击 2.吃食物 3.医疗包 4.换枪 5.逃跑\n";int c; cin >> c;if (c == 1) {Weapon& w = weapon[current_weapon];if (w.count == 0 && w.ammo_type != "无") {flashPrint("无武器"); system("pause"); continue;3 行未改动if (w.ammo_type == "炮弹" && ammo_shell < w.ammo_per_use) aok = false;if (!aok) {flashPrint("弹药不足"); system("pause"); continue;}int cnt = w.is_auto ? 3 : 1;int total = 0;for (int i = 0; i < cnt; i++) {if (e_hp <= 0 || hp <= 0) break;12 行未改动} else {gradientPrint(w.name + " 打出 " + intToStr(total) + " 点伤害!");}system("pause");if (e_hp > 0) {hp -= e_atk;flashPrint(e.name + " 反击!受伤:" + intToStr(e_atk));system("pause");41 行未改动else if (c == 5) {flashPrint("成功逃跑!"); system("pause");next_half(); return;}if (hp <= 0) {clr(); flashPrint("你被击败了!"); system("pause"); exit(0);}}player_exp += e.exp_val;long long mon = e.min_money + rand() % (e.max_money - e.min_money + 1);money += mon;gradientPrint("胜利!获得经验:" + intToStr(e.exp_val) + " 金钱:" + llToStr(mon));10 行未改动}Enemy e = m.boss;int e_hp = e.min_hp;int e_atk = e.min_atk;gradientPrint("警告:进入BOSS战:" + e.name, COLOR_RED);cout << e.desc << " BOSS血量:" << e_hp << "\n";system("pause");while (e_hp > 0 && hp > 0) {clr(); show_state();cout << "BOSS:" << e.name << " 血量:" << e_hp << "\n";cout << "1.猛攻 2.食物 3.医疗包 4.换枪 5.逃跑\n";int c; cin >> c;if (c == 1) {Weapon& w = weapon[current_weapon];if (w.count == 0 && w.ammo_type != "无") {flashPrint("无武器"); system("pause"); continue;3 行未改动if (w.ammo_type == "炮弹" && ammo_shell < w.ammo_per_use) aok = false;if (!aok) {flashPrint("弹药不足"); system("pause"); continue;}int cnt = w.is_auto ? 3 : 1;int total = 0;for (int i = 0; i < cnt; i++) {if (e_hp <= 0 || hp <= 0) break;12 行未改动} else {gradientPrint(w.name + " 打出 " + intToStr(total) + " 伤害!");}system("pause");if (e_hp > 0) {hp -= e_atk;flashPrint("BOSS反击!受到" + intToStr(e_atk) + "伤害!");system("pause");40 行未改动}else if (c == 5) {flashPrint("你逃离了BOSS战场!"); system("pause"); return;}if (hp <= 0) {clr(); flashPrint("你被BOSS击杀!"); system("pause"); exit(0);}}player_exp += e.exp_val;long long mon = e.min_money;money += mon;gradientPrint("恭喜击败BOSS!获得经验:" + intToStr(e.exp_val) + " 金钱:" + llToStr(mon), COLOR_GREEN);165 行未改动全部展开