半成品
2025-09-04 19:06:46
发布于:浙江
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
const int N = 20;
bool firstplay=false; // 是否第一次玩
string plname[N] = {"", "俞思源", "赵老师", "史铁生", "食雪生"}; // 人物
int choice_hero,attempt_hero=0; // choice=选择的人物 atthero=拥有的数量
int x_health=50,y_health=100; // 玩家初始血量数 & 体伤数 区间
int x_damage=1,y_damage=10;
string P[20000] = {"","Basic","Basic","Basic","Basic","Basic"};
int pd[20000] = {0,5,5,5,5,5};
int pm = 5; // petal数量
string moblvl[N] = {"","Common","Unsuall","Rare","Epic","Legendary","Mythic","Ultra","Super","Unique"};
string g_mob[N] = {"","蜜蜂","蜈蚣","瓢虫","雄峰","雌蜂","蒲公英","岩石"};
int gm_damage[N] = {15,4,5,9,7,3,6};
int gm_health[N] = {50,15,20,40,35,15,60};
int mlv_x=1,mlv_y=1; // 可随机的生物等级区间
int gml_x=1,gml_y=3; // garden_mob_list_x-y
int cw; // centipede way;
int missile=10;
bool mp[8] = {0,1,0,0,0}; // garden desert ocean jungle
string mpn[8] = {"", "花园", "沙漠", "海洋", "丛林"};
int wh = 0; // 地点标记
bool alive=false;
/*
struct Ptl {
string petal;
float pdamage;
float phealth;
}pt[N];
*/
struct Att {
string name;
float health;
float damage;
} A[N];
/*
struct GardenAtt{
string gmname;
float gmhealth;
float gmdamage;
};
*/
int random1(int x,int y) {
srand(time(0));
return (rand()%(y-x+1)+x);
}
void help() {
cout << "h -> 查看所有提示\n";
cout << "p -> 查看你所使用的所有花瓣\n";
}
void my_hunt() {
}
void mob_hunt() {
}
void search_mob() {
int a=random1(mlv_x,mlv_y);
int b=random1(gml_x,gml_y);
switch (b) {
case 1:
cout << "已搜寻到一只<" << moblvl[a] << ">等级的可爱被动生物<" << g_mob[b] << ">";
Sleep(750);
cout << "他的血量为<" << gm_health[b] << "> 体伤为 <" << gm_damage[b] << ">";
Sleep(500);
//system("color 4");
cout << "请问你是否要打它?(回答1.是 2.否)\n>";
int q;
cin >> q;
if (q == 1) {
if (a < 3) my_hunt();
else {
my_hunt();
mob_hunt();
}
}
break;
}
}
void update() {
int x=1;
cout << "\n";
for (int i = 1;i <= 9;i ++) {
if (x >= 4) x=1;
cout << "正在寻找生物中";
for (int i = 1;i <= x;i ++) cout << ".";
x++;
Sleep(750);
system("cls");
}
search_mob();
}
int show() {
cout << "玩家:" << plname[choice_hero] << " 你现在使用的花瓣是";
for (int i = 1;i <= pm;i ++) cout << P[i] << " ";
}
int main() {
if (!firstplay) {
firstplay=true;
cout << "欢迎来到Florr.io!\n";
this_thread::sleep_for(std::chrono::seconds(1));
cout << "请选择你的角色:\n";
for (int i = 1; i <= 4; i ++) cout << i << ": " << plname[i] << "\n";
cout << "> ";
cin >> choice_hero;
this_thread::sleep_for(std::chrono::seconds(1));
cout << "你选择了" << plname[choice_hero] << "\n";
attempt_hero++;
this_thread::sleep_for(std::chrono::seconds(1));
A[attempt_hero].name = plname[choice_hero];
A[attempt_hero].health = random1(x_health,y_health);
A[attempt_hero].damage = random1(x_damage,y_damage);
cout << "血量为" << A[attempt_hero].health << " ";
cout << "体伤为" << A[attempt_hero].damage << "\n";
this_thread::sleep_for(std::chrono::seconds(2));
}
system("cls");
while (alive == false) {
bool tmp = 1;
while (tmp) {
cout << "选择你的初始地图\n";
for (int i = 1; i <= 4; i ++) cout << i << ":" << mpn[i] << (mp[i]? "\n": "(未拥有)\n");
cout << "> "; cin >> wh;
this_thread::sleep_for(std::chrono::seconds(1));
if (mp[wh]) {
tmp = 0;
cout << "你已进入" << mpn[wh] << "\n";
alive=true;
this_thread::sleep_for(std::chrono::seconds(1));
system("cls");
break;
} else {
cout << "还未解锁" << mpn[wh] << "哦, 请重新选择~\n";
this_thread::sleep_for(std::chrono::seconds(1));
}
}
}
this_thread::sleep_for(std::chrono::seconds(1));
int ch='0'; //取键盘的按键
while (alive == true) {
cout << "按下h(help)键可查看所有提示";
if (_kbhit()){ //如果有按键按下 则_kbhit()函数返回真
ch = _getch(); //使用_getch()函数获取按下的键值
cout << ch << "\n";
if (ch == 104){ help(); } // ch = h
else if(ch == 10) { show(); }
}
update();
}
}
这里空空如也
有帮助,赞一个